:root {
    /* Base colors will be overwritten by theme_loader.php */
    --bg-main: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary-dark: #1e40af;
}

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1.5rem 5rem;
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    padding-top: 5rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    letter-spacing: -0.03em;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 400;
}

/* Event Banner / Tabs */
.event-selector {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.event-banner {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--glass-border);
    flex: 1;
    max-width: 400px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.event-banner.clickable {
    cursor: pointer;
}

.event-banner.clickable:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}

.event-banner.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.event-banner.active h2,
.event-banner.active .date {
    color: white;
}

.event-content {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.event-content.active {
    display: block;
}

.event-banner h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--primary);
}

.event-banner .date {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.day-tabs {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.day-tab {
    padding: 0.75rem 1.5rem;
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.day-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.day-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 10px 15px -5px var(--primary-light);
}

/* Hide inactive sections */
.day-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.day-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Day title removed as we use tabs now */
.day-title {
    display: none;
}

/* Modern Grid Wrapper */
.day-wrapper {
    margin-bottom: 6rem;
    animation: slideUpFade 1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Glassmorphism Table */
.volunteer-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 4px;
    table-layout: fixed;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.05);
}

.volunteer-grid th {
    background: rgba(255, 255, 255, 0.3);
    padding: 1.5rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.volunteer-grid td {
    height: 70px;
    border: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lieu-cell {
    width: 220px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    font-weight: 700;
    padding: 0 1.5rem !important;
    color: var(--text-main);
    position: sticky;
    left: 0;
    z-index: 10;
    font-size: 0.95rem;
}

.slot {
    cursor: pointer;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: calc(var(--radius) / 2);
    position: relative;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.slot:hover:not(.complet) {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.1);
    z-index: 20;
}

.slot.libre {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.slot.warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.slot.complet {
    background: #fef2f2;
    color: var(--danger);
    cursor: default;
    border-color: #fecaca;
}

/* Modal Styling - Ultra Modern */
#modal-container {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: white;
    margin: 5vh auto;
    padding: 0;
    width: 92%;
    max-width: 650px;
    border-radius: var(--radius);
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modalSpring 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header {
    background: #f8fafc;
    padding: 2rem 2.5rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

#form-loader {
    padding: 2.5rem;
    max-height: 82vh;
    overflow-y: auto;
}

/* Flat Form Controls */
.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #475569;
}

input,
select {
    width: 100%;
    padding: 1rem 1.25rem;
    border-radius: calc(var(--radius) / 2);
    border: 2px solid #f1f5f9;
    background: #f8fafc;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
    color: var(--text-main);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.v-line {
    border-left: 4px solid var(--primary);
    padding: 2rem;
    margin-bottom: 2.5rem;
    background: #f8fafc;
    border-radius: calc(var(--radius) / 2);
}

.v-line strong {
    display: block;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 800;
}

.btn-submit {
    background: var(--primary);
    color: white;
    width: 100%;
    padding: 1.25rem;
    border-radius: calc(var(--radius) / 2);
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 20px -5px var(--primary-light);
}

.btn-submit:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 20px 30px -10px var(--primary-light);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalSpring {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(40px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Empty State / Centered Banner */
.empty-state-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 6rem 1rem;
    animation: fadeIn 0.8s ease-out;
    flex: 1;
    width: 100%;
}

.empty-state-container .event-banner {
    max-width: 600px;
    width: 100%;
    padding: 3.5rem 2.5rem;
    border-width: 2px;
    flex: none;
    margin: 0 auto !important;
    background: white;
}

.empty-state-message {
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 1.25rem;
    max-width: 500px;
    line-height: 1.6;
}

/* Support Floating Button */
#support-trigger {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px var(--primary-light), 0 5px 10px -5px rgba(0, 0, 0, 0.3);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#support-trigger:hover {
    transform: scale(1.1) rotate(5deg);
    background: var(--primary-dark);
}

#support-modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
}

#support-modal .modal-content {
    margin: 10vh auto;
}

.support-body {
    padding: 2.5rem;
}

#support-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

/* Mobile Responsive Overhaul */
@media (max-width: 1024px) {
    .main-container {
        padding: 0 1rem 4rem;
    }

    header {
        margin-bottom: 2rem;
        padding-top: 3rem;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .event-selector {
        gap: 15px;
    }

    .event-banner {
        max-width: 100%;
        padding: 1.25rem;
    }

    /* Transformation from Grid to Cards - Bruteforce Specifity */
    .day-section > div {
        overflow-x: visible !important;
        overflow-y: visible !important;
        margin-top: 0 !important;
    }

    table.volunteer-grid {
        background: transparent !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
        border: none !important;
        display: block !important;
        border-spacing: 0 !important;
        width: 100% !important;
    }

    table.volunteer-grid thead {
        display: none !important;
    }

    table.volunteer-grid tbody, 
    table.volunteer-grid tbody tr, 
    table.volunteer-grid tbody td {
        display: block !important;
        width: 100% !important;
    }

    table.volunteer-grid tbody tr {
        background: white !important;
        border-radius: var(--radius) !important;
        padding: 1.5rem !important;
        margin-bottom: 2rem !important;
        box-shadow: 0 10px 25px -10px rgba(0, 0, 0, 0.05) !important;
        border: 1px solid var(--glass-border) !important;
        height: auto !important;
    }

    table.volunteer-grid tbody td.lieu-cell {
        background: none !important;
        padding: 0 0 1rem 0 !important;
        margin-bottom: 1.25rem !important;
        border-bottom: 1px solid #f1f5f9 !important;
        font-size: 1.25rem !important;
        position: static !important;
        color: var(--primary) !important;
        font-weight: 800 !important;
        height: auto !important;
    }

    table.volunteer-grid tbody td:not(.lieu-cell):not(.slot) {
        display: none !important; /* Hide empty cells */
    }

    table.volunteer-grid tbody td.slot {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 1rem 1.25rem !important;
        margin-bottom: 0.75rem !important;
        height: auto !important;
        text-align: left !important;
        font-size: 1rem !important;
        border-radius: 12px !important;
        border: 1px solid rgba(0,0,0,0.05) !important;
    }

    .volunteer-grid td.slot:last-child {
        margin-bottom: 0;
    }

    .slot:before {
        content: attr(data-time);
        font-weight: 600;
        opacity: 0.8;
    }

    .slot:after {
        content: "S'inscrire";
        font-size: 0.8rem;
        background: rgba(255, 255, 255, 0.5);
        padding: 3px 8px;
        border-radius: 6px;
        margin-left: 10px;
    }

    .slot.complet:after {
        content: "Plein";
        background: rgba(220, 38, 38, 0.1);
        color: var(--danger);
    }

    /* Modals adjustment */
    .modal-content {
        margin: 2vh auto;
        width: 95%;
        border-radius: 20px;
    }

    .modal-header {
        padding: 1.5rem;
    }

    #form-loader {
        padding: 1.5rem;
    }

    .v-line {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr !important;
    }

    .support-body {
        padding: 1.5rem;
    }
}