@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");
:root {
    /* Thème Original (Beige & Vert) */
    --primary-color: #5d866c;
    --primary-hover: #4a6b56;
    --secondary-color: #c2a68c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --info-color: #3498db;
    --background: #f5f5f0;
    --surface: #ffffff;
    --surface-hover: #e6d8c3;
    --border: #e6d8c3;
    --text-primary: #2d2d2d;
    --text-secondary: #5a5a5a;
    --text-muted: #8a8a8a;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 0.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
    /* Réduit légèrement pour gagner de la place */
    font-size: 14px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}


/* --- HEADER & NAVIGATION --- */

.header {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    flex-direction: column;
    /* On empile le logo et le menu */
    align-items: center;
    /* On centre tout horizontalement */
    justify-content: center;
    padding: 15px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    /* Espace entre logo et menu */
}

.logo img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.nav {
    display: flex;
    gap: 15px;
    /* Espacement entre les liens */
    flex-wrap: wrap;
    justify-content: center;
}

.nav::-webkit-scrollbar {
    height: 4px;
}

.nav::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.nav::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 2px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    transition: all 0.2s;
    font-size: 0.875rem;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-link.dashboard-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
    margin-right: 5px;
}


/* --- PAGE HEADER --- */

.main {
    padding: 2rem 0;
    min-height: 85vh;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.2rem 0;
    line-height: 1.2;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}


/* --- CARDS --- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transition: 0.3s;
}

.card-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.card-content,
.card-body {
    padding: 1.25rem;
    flex: 1;
}


/* --- FORMS --- */

.form-group {
    margin-bottom: 1rem;
    width: 100%;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-input,
.form-select,
.form-textarea,
.form-control {
    width: 100%;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background: white;
}

.form-input:focus,
.form-select:focus,
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(93, 134, 108, 0.1);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}


/* --- BUTTONS --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: white;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #f9fafb;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
}

.btn-icon:hover {
    background-color: #f0f0f0;
    color: var(--primary-color);
}


/* --- CALENDRIER --- */

.calendar-toolbar {
    background-color: var(--surface);
    padding: 1rem 1.5rem;
    border: 1px solid var(--border);
    border-bottom: 1px solid #f0f0f0;
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.calendar-nav-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fdfdfd;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

#calendar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 160px;
    text-align: center;
    margin: 0 0.5rem;
    text-transform: capitalize;
}

.calendar-filters-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.calendar-filters-group .form-select,
.calendar-filters-group .form-input {
    height: 38px;
    padding: 0 1rem;
    margin: 0;
    min-width: 140px;
    font-size: 0.9rem;
}

.calendar-legend-horizontal {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 2rem;
    padding: 0.75rem 1.5rem;
    background-color: #fafafa;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: none;
    font-size: 0.85rem;
}

.legend-item-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.legend-item {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

.legend-item.confirmed {
    background-color: #dcfce7;
    border: 1px solid #16a34a;
}

.legend-item.pending {
    background-color: #ffedd5;
    border: 1px solid #ea580c;
}

.legend-item.cancelled {
    background-color: #fee2e2;
    border: 1px solid #dc2626;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid var(--border);
    border-top: 1px solid var(--border);
    background: var(--surface);
    border-radius: 0 0 var(--radius) var(--radius);
    overflow: hidden;
}

.calendar-day-header {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    background-color: white;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid #f0f0f0;
    color: var(--text-secondary);
}

.calendar-day {
    min-height: 120px;
    padding: 5px;
    border-right: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    background: white;
}

.calendar-day:hover {
    background-color: #fcfcfc;
}

.calendar-day.other-month {
    background-color: #fafafa;
    color: #e0e0e0;
}

.calendar-day.today {
    background-color: #fffaf0;
}

.calendar-day-number {
    text-align: right;
    font-size: 0.85rem;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-muted);
    padding-right: 5px;
}

.calendar-reservation {
    display: flex;
    flex-direction: column;
    padding: 4px 6px;
    margin-bottom: 3px;
    border-radius: 4px;
    font-size: 0.75rem;
    line-height: 1.25;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.calendar-reservation:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.reservation-client {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}

.reservation-room {
    font-size: 0.7rem;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.calendar-reservation.confirmed {
    background-color: #f0fdf4;
    border-left-color: #16a34a;
}

.calendar-reservation.pending {
    background-color: #fff7ed;
    border-left-color: #ea580c;
}

.calendar-reservation.cancelled {
    background-color: #fef2f2;
    border-left-color: #dc2626;
    opacity: 0.7;
    text-decoration: line-through;
}


/* Vues Semaine/Chambre */

.week-view {
    border: 1px solid var(--border);
    border-top: 1px solid var(--border);
    background: var(--surface);
    border-radius: 0 0 var(--radius) var(--radius);
    overflow: hidden;
    width: 100%;
}

.week-header {
    display: grid;
    grid-template-columns: 150px repeat(7, 1fr);
    background-color: #fafafa;
    border-bottom: 1px solid var(--border);
    width: 100%;
}

.week-room-header {
    padding: 1rem;
    font-weight: 700;
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.week-day-header {
    padding: 0.75rem;
    text-align: center;
    border-right: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-primary);
}

.week-row {
    display: grid;
    grid-template-columns: 150px repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
    width: 100%;
}

.week-room-name {
    padding: 1rem;
    font-weight: 600;
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
    background-color: white;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.week-day-cell {
    border-right: 1px solid #f0f0f0;
    min-height: 80px;
    padding: 4px;
    background-color: white;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    text-align: center;
}

.room-view-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
}

.room-calendar-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.room-calendar-header {
    padding: 1rem;
    background: #fafafa;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

.room-mini-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 0.5rem;
    gap: 2px;
}

.mini-day-header {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding-bottom: 4px;
}

.mini-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
}

.mini-calendar-day:hover {
    background: #eee;
}

.mini-calendar-day.today {
    border: 1px solid var(--primary-color);
    font-weight: bold;
}

.mini-calendar-day.confirmed {
    background-color: #16a34a;
    color: white;
}

.mini-calendar-day.pending {
    background-color: #ea580c;
    color: white;
}

.mini-calendar-day.cancelled {
    background-color: #dc2626;
    color: white;
}


/* --- STATS & ICONS --- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    stroke: white;
}

.stat-icon-primary {
    background-color: var(--primary-color);
}

.stat-icon-success {
    background-color: var(--success-color);
}

.stat-icon-info {
    background-color: var(--info-color);
}

.stat-icon-warning {
    background-color: var(--warning-color);
}

.stat-icon-danger {
    background-color: var(--danger-color);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}


/* --- TABLEAUX --- */

.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    min-width: 600px;
}

.table th {
    background: #f8f9fa;
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid var(--border);
    color: var(--text-secondary);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}


/* --- MODALS --- */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #fafafa;
}


/* --- FACTURE STYLE (Optimisé impression 1 page) --- */

.invoice-document {
    background: white;
    padding: 30px;
    /* Réduit de 40 à 30 */
    border: 1px solid #eee;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    max-width: 800px;
    margin: 0 auto;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.invoice-logo img {
    height: 60px;
    width: auto;
    margin-bottom: 5px;
}

.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 25px;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.invoice-table th {
    background: #f8f9fa;
    padding: 10px;
    border-bottom: 2px solid #ddd;
    text-align: left;
}

.invoice-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.invoice-totals {
    width: 280px;
    margin-left: auto;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.total-row.final {
    font-weight: bold;
    font-size: 1.1rem;
    border-top: 1px solid #ddd;
    padding-top: 10px;
    color: #333;
    margin-bottom: 0;
}

.invoice-notes {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
    font-size: 0.85rem;
    color: #666;
}


/* --- PRINT MEDIA QUERIES (Force 1 page) --- */

@media print {
    body * {
        visibility: hidden;
    }
    .invoice-document,
    .invoice-document * {
        visibility: visible;
    }
    .invoice-document {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 20px;
        border: none;
        box-shadow: none;
        max-width: none;
    }
    .invoice-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }
    .invoice-parties {
        margin-bottom: 15px;
        gap: 20px;
    }
    .invoice-table th,
    .invoice-table td {
        padding: 6px;
    }
    /* Plus compact */
    .invoice-totals {
        padding: 10px;
        margin-top: 10px;
    }
    /* Cache les éléments de navigation */
    .header,
    .nav,
    .page-header,
    .btn,
    .card,
    .modal {
        display: none !important;
    }
    @page {
        margin: 1cm;
        size: auto;
    }
}


/* RESPONSIVE */

@media (max-width: 992px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }
    .nav {
        padding-bottom: 10px;
    }
    .calendar-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .calendar-filters-group {
        flex-direction: column;
    }
    .calendar-filters-group>* {
        width: 100%;
    }
    .week-header,
    .week-row {
        grid-template-columns: 100px repeat(7, 1fr);
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 10px;
    }
    .nav {
        gap: 10px;
    }
}
