/*========================================
= ARCHIVE EVENT LAYOUT (ONE PER ROW)     =
========================================*/

.event-archive-grid {
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}



/*========================================
= CARD BASE                              =
========================================*/

.event-card {
    width: 100%;
    background: transparent;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    border: none;
}

.event-card:hover {
    transform: none;
    box-shadow: none;
}

/*========================================
= HEADER LAYOUT                          =
========================================*/

.event-card-header {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 16px 18px 10px;
}

.event-card-image-column {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

/*========================================
= IMAGE + TITLE                          =
========================================*/

.event-card-image-link {
    display: block;
    width: 100%;
    position: relative;
}

/* Edit Event Button - Overlay on Image */
.event-edit-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    transition: background 0.2s ease, transform 0.1s ease;
    z-index: 10;
}

.event-edit-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: scale(1.02);
}

.event-edit-btn svg {
    flex-shrink: 0;
}

.event-card-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
    border-radius: 10px;
}

.placeholder-image {
    width: 100%;
    height: 160px;
    background: #f0f0f0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 13px;
}

.event-card-title-under {
    margin: 8px 0 12px;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    color: #111827;
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    text-align: center;
}

.event-card-title-under a {
    text-decoration: none;
    color: inherit;
}

.event-card-title-under a:hover {
    color: #0057ff;
}

/*========================================
= MAIN SUMMARY COLUMN                    =
========================================*/

.event-card-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Rating + Recommend line */
.event-card-summary-topline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    margin-bottom: 4px;
}

.event-card-rating,
.event-card-recommend {
    font-size: 13px;
}

/* Organiser (space) inline chip */
.event-card-organiser {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.organiser-label {
    font-size: 13px;
}

/*========================================
= META GRID                              =
========================================*/

.event-card-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 8px 18px;
    font-size: 13px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta-icon {
    font-size: 14px;
    line-height: 1;
}

.meta-label {
    font-weight: 600;
    color: #555;
}

.meta-value {
    color: #333;
}

/*========================================
= DESCRIPTION SNIPPET                    =
========================================*/

.event-card-snippet {
    font-size: 13px;
    color: #555;
    margin-top: 4px;
}

/*========================================
= PRIMARY ACTIONS                        =
========================================*/

.event-card-primary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.event-card-button,
.event-card-toggle-details {
    border-radius: 999px;
    border: none;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}

.event-card-button {
    background: #0057ff;
    color: #fff;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 87, 255, 0.35);
}

.event-card-button:hover {
    background: #0041c0;
    box-shadow: 0 3px 8px rgba(0, 65, 192, 0.45);
}

.event-card-toggle-details {
    background: #f3f3f3;
    color: #333;
}

.event-card-toggle-details:hover {
    background: #e2e2e2;
}

.event-card-button:active,
.event-card-toggle-details:active {
    transform: scale(0.97);
}

/*========================================
= INVITE BAR                             =
========================================*/

.event-card-invite-bar {
    border-top: 1px solid #f0f0f0;
    padding: 8px 18px 10px;
    background: #fafafa;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

/* Status badge from reject.php */
.event-card-invite-status {
    margin: 0;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

/* Colours for statuses */
.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-accepted {
    background: #d4edda;
    color: #155724;
}

.status-rejected {
    background: #f8d7da;
    color: #721c24;
}

/* Expert action buttons container from reject.php */
.event-card-expert-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.expert-action-form {
    margin: 0;
}

.expert-btn {
    padding: 6px 10px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: background 0.15s ease, transform 0.08s ease;
}

.expert-btn:active {
    transform: scale(0.97);
}

.accept-btn {
    background: #28a745;
    color: #fff;
}

.accept-btn:hover {
    background: #1e7e34;
}

.reject-btn {
    background: #dc3545;
    color: #fff;
}

.reject-btn:hover {
    background: #b02a37;
}

/*========================================
= PERSON CHIPS (expert & space)          =
========================================*/

.person-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.person-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f3f4f6;
    text-decoration: none;
    border: 1px solid #e5e7eb;
}

.person-chip.organiser-chip {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.person-chip:hover {
    background: #e5e7eb;
}

.person-avatar {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #d1d5db;
    flex-shrink: 0;
}

.person-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.person-avatar-fallback {
    font-size: 11px;
    font-weight: 700;
    color: #111827;
}

.person-name {
    font-size: 12px;
    font-weight: 600;
    color: #111827;
}

/*========================================
= COLLAPSIBLE DETAILS                    =
========================================*/

.event-card-details {
    padding: 0 18px 16px;
    background: transparent;
    border-top: none;
}

.details-section {
    margin-top: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #ececec;
}

.details-section:last-child {
    border-bottom: none;
}

.details-title {
    margin: 0 0 8px 0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #555;
    border-left: 3px solid var(--primary-color, #0073aa);
    padding-left: 8px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px 18px;
}

.details-item {
    font-size: 13px;
}

.details-item-full {
    grid-column: 1 / -1;
}

.details-label {
    display: block;
    font-size: 12px;
    color: #888;
    font-weight: 600;
    margin-bottom: 2px;
}

.details-value {
    font-size: 13px;
    color: #333;
}

.details-row {
    font-size: 13px;
    margin-bottom: 6px;
}

.details-block {
    margin-top: 6px;
    font-size: 13px;
}

.details-content {
    margin-top: 3px;
    color: #444;
    line-height: 1.5;
}

.details-tag {
    display: inline-block;
    padding: 2px 6px;
    margin: 2px 4px 0 0;
    border-radius: 4px;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 11px;
}

/*========================================
= TTC SECTION                            =
========================================*/

.ttc-details {
    background: #fff8e1;
    border-radius: 8px;
    padding: 10px 12px;
    border: 1px solid #ffe082;
}

/*========================================
= REGISTRATION BUTTON                    =
========================================*/

.event-card-register-btn {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 999px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.event-card-register-btn:hover {
    background: #005f8a;
}

/*========================================
= REVIEW BLOCK                           =
========================================*/

.details-review-block {
    margin-top: 6px;
    font-size: 13px;
}

/*========================================
= NO EVENTS MESSAGE                      =
========================================*/

.no-events-message {
    text-align: center;
    padding: 40px 10px;
    font-size: 15px;
    color: #666;
}

/*========================================
= RESPONSIVE                             =
========================================*/

@media (max-width: 640px) {

    .event-card-header {
        grid-template-columns: 1fr;
    }

    .event-card-image-column {
        max-width: 100%;
        margin-bottom: 0; /* Removed extra spacing */
    }

    .event-card-image {
        height: 200px;
    }

    .event-card-meta-grid {
        grid-template-columns: 1fr;
    }

    .event-card-primary-actions {
        flex-direction: column;
    }

    .event-card-button,
    .event-card-toggle-details {
        width: 100%;
        text-align: center;
    }

    .event-card-invite-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/*========================================
= EXPERTS GRID (MATCHING SINGLE SPACE)   =
========================================*/

.experts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 20px;
    margin-top: 8px;
}

.expert-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    transition: background 0.2s ease;
}

.expert-card:hover {
    background: #fbfbfb; /* var(--bg-surface) fallback */
}

.expert-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.expert-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.expert-avatar--blue {
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 700;
    font-size: 24px;
}

.expert-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827; /* var(--text-primary) fallback */
    text-align: center;
    line-height: 1.3;
}

@media (max-width: 640px) {
    .experts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    .expert-avatar {
        width: 64px;
        height: 64px;
    }
    .expert-name {
        font-size: 13px;
    }
}

/*========================================
= EVENT CARD TABS                        =
========================================*/

.event-tab-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 2px; /* Reduced gap */
    margin-bottom: 16px;
    border-bottom: 1px solid #e0e0e0; /* Material divider color */
    padding-bottom: 0; /* Tabs sit on the line */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.event-tab-nav::-webkit-scrollbar {
    display: none;
}

.event-tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-bottom: 2px solid transparent; /* Indicator */
    padding: 8px 12px; /* Increased padding for better touch target and spacing */
    min-width: 60px; /* Increased min-width */
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    text-align: center;
    color: #5f6368; /* Material secondary text */
    border-radius: 4px 4px 0 0; /* Rounded top corners */
    gap: 4px; /* Ensure gap between icon and text */
}

.event-tab-btn:hover {
    background-color: #f5f5f5;
    color: #202124;
}

.event-tab-btn.active {
    color: #1a73e8; /* Material primary blue */
    border-bottom-color: #1a73e8;
    background: none; /* Remove background for cleaner look */
}

.event-tab-btn .material-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
    margin-bottom: 4px;
}

.tab-label {
    font-family: 'Roboto', sans-serif;
    font-size: 10px; /* Reduced font size */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.2px; /* Reduced tracking */
    line-height: 1.2;
}

.event-tab-content {
    position: relative;
    min-height: 100px;
    font-family: 'Roboto', sans-serif; /* Ensure font consistency */
    color: #202124;
}

.event-tab-pane {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Material Icon General Style */
.material-icon {
    display: inline-block;
    vertical-align: middle;
    fill: currentColor;
}

/* Refined Meta Grid for Info Tab */
.event-card-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 16px;
    margin-bottom: 16px;
}

.meta-item {
    display: flex;
    align-items: center;
    font-size: 14px;
    line-height: 20px;
    color: #3c4043;
}

.meta-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: #5f6368;
}

.meta-icon .material-icon {
    width: 20px;
    height: 20px;
}

.meta-label {
    font-weight: 500;
    margin-right: 4px;
    color: #5f6368;
}

.meta-value {
    color: #202124;
}

/* Refined Details Rows & Blocks */
.details-row, .details-block, .details-grid {
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.details-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #5f6368;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.details-value, .details-content {
    color: #202124;
}

.details-row {
    display: flex;
    align-items: baseline;
}

.details-row .details-label {
    margin-bottom: 0;
    margin-right: 8px;
    min-width: 80px; /* Align values */
}

/* Experts Grid Refinement */
.experts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.expert-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: inherit;
}

.expert-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 8px;
    background-color: #e0e0e0;
}

.expert-name {
    font-size: 13px;
    font-weight: 500;
    color: #202124;
    line-height: 1.4;
}

/* Primary Action Button Refinement */
.event-card-primary-actions {
    margin-top: 24px;
    text-align: right;
}

.event-card-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 16px;
    background-color: #1a73e8;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s;
}

.event-card-button:hover {
    background-color: #1557b0;
    color: #fff;
}

/* Adjustments for content inside tabs */
.event-tab-pane .event-card-summary-topline {
    margin-top: 0;
    margin-bottom: 16px;
}

/*========================================
= EVENT INFO LIST (Single Column)        =
========================================*/

.event-info-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 16px;
}

.event-info-row {
    display: flex;
    align-items: center;
    padding: 12px 4px;
    background: transparent;
    border-bottom: 1px solid #eff1f3; /* var(--border-light) fallback */
    gap: 16px;
    transition: background-color 0.2s ease;
}

.event-info-row:hover {
    background: #fafafa;
}

.event-info-row:last-child {
    border-bottom: none;
}

.event-info-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f3f5; /* var(--bg-tertiary) fallback */
    border-radius: 50%;
    flex-shrink: 0;
    color: #5f6368;
}

.event-info-icon .material-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.event-info-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.event-info-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ea7b0; /* var(--text-tertiary) fallback */
    font-weight: 600;
}

.event-info-value {
    font-size: 14px; /* var(--text-base) approx */
    color: #181c20; /* var(--text-primary) fallback */
    font-weight: 500;
    word-break: break-word;
    line-height: 1.4;
}

.event-info-row.block-content {
    align-items: flex-start;
}

.event-info-value.block {
    font-weight: 400;
    line-height: 1.6;
    color: #444;
}

.event-info-value.block p {
    margin: 0 0 10px 0;
}

.event-info-value.block p:last-child {
    margin-bottom: 0;
}

/*========================================
= AVERAGE STAR RATING (From Profile)     =
========================================*/

.profile-average-rating { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 6px; 
    padding: 8px 12px; 
    background: linear-gradient(135deg, #fff9e6 0%, #ffffff 100%); 
    border-left: 4px solid #ffc107; 
    border-radius: 8px; 
    box-shadow: 0 2px 6px rgba(255, 193, 7, 0.15); 
    width: auto; /* Allow it to shrink/grow as needed */
}
.profile-average-rating .avg-single-star { color: #ffc107; font-size: 14px; line-height: 1; }
.profile-average-rating .avg-info { display: flex; align-items: center; gap: 2px; font-size: 14px; line-height: 1; }
.profile-average-rating .avg-value { font-weight: 700; color: #333; }
.profile-average-rating .avg-slash, .profile-average-rating .avg-max { color: #666; font-weight: 500; }
.profile-average-rating .avg-count { color: #666; font-weight: 400; font-style: italic; margin-left: 2px; }

/* Summary Topline Layout */
.event-card-summary-topline {
    display: flex;
    justify-content: space-between; /* Rating left, Recommend right */
    align-items: center;
    gap: 12px;
    margin-bottom: 0; /* Removed spacing to fix empty row above tabs */
    flex-wrap: nowrap; /* Force single line */
    width: 100%;
}

/* Ensure recommend button aligns right */
.event-card-recommend {
    margin-left: auto;
    flex-shrink: 0; /* Prevent shrinking */
}

.event-card-rating {
    flex-shrink: 1; /* Allow shrinking if absolutely necessary, but prefer not to */
    min-width: 0;
    display: flex;
    justify-content: flex-start; /* Align content left */
}

/* Desktop Centering */
@media (min-width: 768px) {
    .event-archive-grid {
        max-width: 800px; /* Or 1000px, user said "desktop way", usually means contained */
        margin: 40px auto; /* Center with some top/bottom spacing */
        padding: 0 20px; /* Prevent touching edges on smaller desktops */
    }
    
    .event-card {
        background: #fff; /* Ensure card has background on desktop */
        border-radius: 16px; /* Restore border radius for desktop card look */
        box-shadow: 0 4px 20px rgba(0,0,0,0.08); /* Add shadow for desktop */
        border: 1px solid #eaeaea;
    }

    .event-card-header {
        display: grid;
        grid-template-columns: 260px minmax(0, 1fr);
        gap: 24px;
        align-items: start;
        padding: 24px 32px 16px; /* More padding on desktop */
    }

    .event-card-details {
        padding: 0 32px 24px;
    }

    /* Smaller, uncropped image for desktop side-by-side layout */
    .event-card-image, .placeholder-image {
        height: auto; /* Natural height */
        width: 100%; /* Fill the column */
        aspect-ratio: auto; /* Ensure aspect ratio is preserved */
        border-radius: 12px;
        object-fit: contain; /* Prevent cropping */
    }

    /* Stack Rating and Recommend on Desktop */
    /* Keep Rating and Recommend side-by-side on Desktop */
    .event-card-summary-topline {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .event-card-recommend {
        margin-left: auto; /* Push to right */
    }
}

/* Force left alignment for the rating component within the event card */
.event-card-rating .profile-average-rating {
    justify-content: flex-start;
    margin: 0; /* Remove any auto margins */
}

/* Mobile check: ensure it fits on very small screens */
@media (max-width: 360px) {
    .event-card-summary-topline {
        gap: 8px;
    }
    .profile-average-rating {
        padding: 6px 10px;
    }
}
