/* ----------------------------------------------------
    SOTRANE FRONTEND STYLES (FINAL UI VERSION)
-----------------------------------------------------*/

/* === 1. Global / Container === */
.sotrane-frontend-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
    font-family: Inter, system-ui, Arial, Helvetica, sans-serif;
    background: #f8fafc; /* Light background for a solid feel */
}

/* --- 2. Controls (Dropdowns, Filter) --- */
.sotrane-controls {
    display: flex;
    /* CRITICAL CHANGE: Center all items horizontally */
    justify-content: center; 
    gap: 12px; /* Increased gap for better spacing */
    flex-wrap: wrap;
    margin-bottom: 24px; /* Increased margin */
    align-items: center;
    padding: 12px;
    background: #fff; /* Solid background for control bar */
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(2, 6, 23, 0.05);
}

/* NEW: Wrapper for input fields to prevent them from stretching to the edges, allowing centering */
.sotrane-input-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    /* Limit the overall width of the input group */
    max-width: 600px; 
}

/* Targeted styles for inputs/selects within the new group */
.sotrane-input-group input,
.sotrane-input-group select {
    flex: 1 1 auto; /* Allow items to grow/shrink but not take up all remaining space */
    min-width: 150px; /* Minimum width for inputs before wrapping */
    padding: 10px 12px;
    border: 1px solid #cbd5e1; /* Solid, light border */
    border-radius: 8px;
    background: #fff;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05); /* Solid inset shadow */
    transition: none; /* Remove transitions */
    appearance: none; /* Remove default browser styling for select */
}

.sotrane-controls button {
    flex-shrink: 0; /* Keep button size stable */
    padding: 10px 16px;
    border-radius: 8px;
    background: #0ea5a4; /* Solid color */
    color: #fff;
    border: 0;
    cursor: default; /* Remove pointer effect */
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(14, 165, 164, 0.4); /* Solid button shadow */
    /* Remove all hover/active effects */
    transition: none !important;
}

/* === 3. Grid and Cards === */
.sotrane-results .sotrane-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.sotrane-card {
    display: flex;
    gap: 16px; /* Increased gap */
    padding: 16px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(2, 6, 23, 0.1); /* Solid shadow for prominence */
    align-items: flex-start;
    border: 1px solid #e5e7eb; /* Solid card border */
    transition: none; /* Remove transitions */
}

.sotrane-card-left {
    flex-shrink: 0;
}

.sotrane-card-left img {
    width: 200px; /* Slightly reduced width for better fit on desktop */
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

.sotrane-card-right {
    flex: 1;
}

/* Title */
.sotrane-card-title {
    margin: 0 0 4px 0;
    font-size: 18px;
    color: #0f172a;
    line-height: 1.3;
}

/* --- 4. Metadata (Colors Finalized) --- */

.sotrane-card-meta {
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.5;
    white-space: nowrap; /* Keep meta line on one line if possible */
}

/* Reset inherited color so theme cannot override */
.sotrane-card-meta span {
    color: inherit !important;
}

/* Event Date: Red */
.sotrane-card-meta span.sotrane-date {
    color: #dc2626 !important; /* RED */
    font-weight: bold !important;
}

/* Category: Green */
.sotrane-card-meta span.sotrane-category {
    color: #16a34a !important; /* GREEN */
    font-weight: bold !important;
}

/* Time Added: Orange */
.sotrane-card-meta span.sotrane-time-added {
    color: #e25032 !important; /* ORANGE */
    font-weight: bold !important;
}

/* Extra protection */
div.sotrane-card-meta span.sotrane-date,
div.sotrane-card-meta span.sotrane-category,
div.sotrane-card-meta span.sotrane-time-added {
    font-weight: bold !important;
}

/* --- 5. Excerpt and Actions --- */

.sotrane-card-excerpt {
    color: #4b5563;
    margin: 0 0 10px 0;
    font-size: 14px;
}

.sotrane-card-actions {
    margin-top: 8px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.sotrane-open-btn,
.sotrane-download,
.sotrane-loadmore-wrap button {
    /* Base styles for all buttons/links */
    padding: 9px 14px;
    border-radius: 8px;
    font-weight: 600;
    cursor: default;
    transition: none !important;
}

/* View Details Button (Solid Dark) */
.sotrane-open-btn {
    background: #1f2937;
    color: #fff;
    border: 1px solid #1f2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Download Link (Solid Border) */
.sotrane-download {
    border: 1px solid #d1d5db;
    background: #f9fafb;
    text-decoration: none;
    color: #374151;
}

/* Load more button */
.sotrane-loadmore-wrap {
    text-align: center;
    margin-top: 30px;
}

.sotrane-loadmore-wrap button {
    background: #0ea5a4;
    color: #fff;
    border: 0;
    box-shadow: 0 4px 10px rgba(14, 165, 164, 0.4);
}

/* --- 6. Modal --- */
.sotrane-modal {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Darker overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.sotrane-modal-inner {
    background: #fff;
    border-radius: 12px;
    padding: 24px; /* 24px padding kept for text content */
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.sotrane-modal-close {
    position: sticky; /* Keep it visible at the top */
    top: 0;
    float: right;
    background: #ef4444;
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: default;
    font-size: 16px;
    line-height: 1;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.5);
}

.sotrane-modal-inner h2 {
    margin-top: 0;
}

/* FINAL FIX: Image takes up full width of modal inner container */
.sotrane-modal-img {
    /* Push the image out into the 24px padding on both sides */
    width: calc(100% + 48px); /* 100% of content area + (24px left + 24px right padding) */
    margin-left: -24px;      /* Negative margin counters left padding */
    margin-right: -24px;     /* Negative margin counters right padding */
    margin-top: -24px;       /* Negative margin counters top padding (for tight fit) */
    
    max-width: none;         /* Must override max-width to allow full bleed */
    height: auto;
    object-fit: cover;
    /* Optional: Round top corners only, as sides are flush with padding */
    border-radius: 8px 8px 0 0; 
    margin-bottom: 15px;     /* Space below the image before the metadata starts */
    display: block;
}

.sotrane-modal-meta {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 15px;
    font-weight: 600;
}

/* --- 7. Responsive Adjustments --- */
@media (max-width: 1000px) {
    /* On medium screens, controls take more space, causing cleaner wraps */
    .sotrane-input-group select {
        flex: 1 1 45%; /* Inputs take nearly half the row within the group */
    }
}

@media (max-width: 800px) {
    /* Mobile-specific changes */
    .sotrane-controls {
        padding: 10px;
        gap: 8px;
    }
    
    /* Input group should go full width on mobile */
    .sotrane-input-group {
        max-width: 100%;
        width: 100%;
        gap: 8px;
    }

    /* Force all controls (inputs and button) to full width for beautiful stacking */
    .sotrane-input-group select,
    .sotrane-input-group input,
    .sotrane-controls button {
        flex: 1 1 100%; 
        box-sizing: border-box; /* Ensure padding doesn't push them over */
    }

    .sotrane-results .sotrane-grid {
        grid-template-columns: 1fr; /* Single column layout for cards */
        gap: 15px;
    }

    .sotrane-card {
        flex-direction: column; /* Stack image above content on mobile */
    }

    .sotrane-card-left img {
        width: 100%;
        height: 180px;
        object-fit: cover;
    }
}
