/* =========================
   BASE
========================= */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: "Inter", Arial, sans-serif;
    background: #f1f5f9;
    color: #0f172a;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: auto;
}

/* =========================
   HEADER
========================= */
.navbar {
    background: white;
    border-bottom: 1px solid #e2e8f0;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
}

.logo {
    font-weight: 700;
    font-size: 20px;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: #475569;
    margin-left: 15px;
    font-size: 14px;
}

.nav-btn {
    padding: 8px 14px;
    border-radius: 6px;
}

.nav-login {
    border: 1px solid #cbd5e1;
}

.nav-register {
    background: #dc2626;
    color: white !important;
}

.nav-register:hover {
    background: #b91c1c;
}

.nav-user {
    margin-right: 15px;
    font-size: 14px;
}

.nav-logout {
    background: #ef4444;
    color: white !important;
}

/* =========================
   BUTTONS
========================= */
.btn {
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    transition: 0.2s;
}

.btn-primary {
    background: #dc2626;
    color: white;
}

.btn-primary:hover {
    background: #b91c1c;
}

.btn-secondary {
    background: #e2e8f0;
}

.btn-block {
    width: 100%;
    text-align: center;
}

/* =========================
   HERO (INDEX)
========================= */
.hero {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    text-align: center;
    margin-top: 40px;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* =========================
   FEATURES RESPONSIVE PRO
========================= */

/* MOBILE (par défaut) */
.features {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 40px 0 60px 0;
}

/* TABLET */
@media (min-width: 768px) {
    .features {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

/* DESKTOP */
@media (min-width: 1024px) {
    .features {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* CARD */
.feature {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    min-width: 0; /* évite débordement */
}

/* =========================
   AUTH (LOGIN / REGISTER)
========================= */
.auth-wrapper {
    min-height: calc(100vh - 140px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

/* =========================
   FORM
========================= */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
}

/* =========================
   DASHBOARD
========================= */
.dashboard {
    margin-top: 40px;
    padding-bottom: 60px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

/* =========================
   CALENDAR
========================= */
.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-top: 15px;
}

.calendar-day {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px;
    font-size: 12px;
}

.calendar-event {
    background: #dc2626;
    color: white;
    padding: 4px;
    border-radius: 4px;
    font-size: 11px;
    margin-top: 4px;
}

/* =========================
   LIST
========================= */
.reservation-item {
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 0;
}

/* =========================
   FOOTER
========================= */
.footer {
    margin-top: auto;
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 30px 0;
    text-align: center;
    font-size: 14px;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* 📱 CALENDRIER MOBILE CLEAN */
@media (max-width: 768px) {

    .calendar {
        display: grid;
        grid-template-columns: repeat(7, 1fr); /* 🔥 toujours 7 jours */
        gap: 3px;
    }

    .calendar-day {
        min-height: 55px;
        padding: 3px;
        font-size: 10px;
    }

    .calendar-day strong {
        font-size: 10px;
    }

    .calendar-event {
        font-size: 8px;
        padding: 2px;
        margin-top: 2px;
        border-radius: 3px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .event-meta {
        display: none;
    }

    .event-title {
        font-size: 8px;
    }
}

/* REGISTER FIX */
.auth-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 60px;
    align-items: flex-start;
}

/* FORM BOX */
.auth-box {
    max-width: 500px;
    width: 100%;
}

/* TEXTE */
.auth-info {
    padding-top: 20px;
}

/* MOBILE */
@media (max-width: 768px) {
    .auth-page {
        grid-template-columns: 1fr;
    }

    .auth-box {
        max-width: 100%;
    }
}

.reservations-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Mobile */
@media (max-width: 768px) {
    .reservations-grid {
        grid-template-columns: 1fr;
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #1e293b;
    padding: 25px;
    border-radius: 12px;
    width: 350px;
    color: white;
}

.close {
    float: right;
    font-size: 22px;
    cursor: pointer;
}

/* Dropdown utilisateur */
.user-dropdown {
    position: relative;
}

.nav-user-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
}

/* ===== USER DROPDOWN ===== */

.user-dropdown {
    position: relative;
}

/* 🔥 bouton stylé */
.nav-user-btn {
    background: #334155;
    color: white;
    border: 1px solid #475569;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

/* hover */
.nav-user-btn:hover {
    background: #475569;
}

/* petit effet clic */
.nav-user-btn:active {
    transform: scale(0.97);
}

/* dropdown */
.dropdown-menu {
    position: absolute;
    top: 110%;
    right: 0;
    background: #1e293b;
    border-radius: 10px;
    padding: 8px 0;
    display: none;
    min-width: 180px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    z-index: 999;
    animation: fadeIn 0.15s ease;
}

.dropdown-menu a {
    display: block;
    padding: 10px 15px;
    color: white;
    text-decoration: none;
    font-size: 14px;
}

.dropdown-menu a:hover {
    background: #334155;
}

.dropdown-menu .logout {
    color: #f87171;
}

.dropdown-menu.show {
    display: block;
}

/* animation légère */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.calendar-day {
    min-height: 100px;
    border: 1px solid #eee;
    padding: 5px;
    position: relative;
}

.calendar-event {
    padding: 6px;
    border-radius: 6px;
    color: white;
    font-size: 11px;
    margin-top: 4px;
    transition: 0.2s;
}

.calendar-event:hover {
    transform: scale(1.03);
    opacity: 0.9;
}

.event-title {
    font-weight: 600;
}

.event-meta {
    font-size: 10px;
    opacity: 0.85;
}

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 280px;
    max-width: 350px;
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 12px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    animation: slideIn 0.4s ease;
}

.toast.success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.toast-close {
    cursor: pointer;
    opacity: 0.8;
    font-size: 16px;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.dashboard-left h1 {
    margin: 0;
}

.dashboard-left p {
    margin: 5px 0 0 0;
}

.dashboard-right {
    display: flex;
    align-items: center;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-right {
        width: 100%;
    }

    .guide-btn {
        width: 100%;
        text-align: center;
    }

}

.btn-secondary {
    cursor: pointer;
    opacity: 0.7;
}

.btn-secondary:hover {
    opacity: 1;
}

/* 🔥 FIX FORCE GRID MOBILE */
@media (max-width: 768px) {

    .calendar {
        display: grid !important; /* 🔥 force le grid */
        grid-template-columns: repeat(7, 1fr) !important;
        width: 100% !important;
        gap: 2px !important;
    }

    .calendar-day {
        width: 100% !important;
        min-height: 50px !important;
        padding: 2px !important;
        font-size: 9px !important;
    }

    .calendar-event {
        font-size: 7px !important;
        padding: 2px !important;
        margin-top: 2px !important;
    }

    .event-meta {
        display: none !important;
    }
}

/* 🔥 FIX DEFINITIF CALENDRIER MOBILE */
@media (max-width: 768px) {

    .calendar {
        display: grid !important;
        grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
        width: 100% !important;
    }

    .calendar-day {
        width: auto !important; /* 🔥 LE FIX IMPORTANT */
        min-height: 50px !important;
        padding: 2px !important;
        font-size: 9px !important;
    }

}

/* 🔥 FIX EMPTY DAYS */
.empty-day {
    visibility: hidden;
}

@media (max-width: 768px) {
    .calendar > * {
        min-width: 0 !important;
    }
}