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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.navbar {
    background: #2c3e50;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 600;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: white;
    text-decoration: none;
}

.nav-links a:hover {
    text-decoration: underline;
}

.user-info {
    opacity: 0.8;
}

.logout-form {
    display: inline;
}

.logout-form button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

/* Responsive navbar */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem;
        min-width: 320px; /* Empêcher le rétrécissement */
    }
    
    .nav-brand {
        font-size: 0.9rem;
    }
    
    .nav-links {
        gap: 0.5rem;
        font-size: 0.8rem;
    }
    
    .nav-links a {
        font-size: 0.8rem;
    }
    
    .logout-form button {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .user-info {
        display: none; /* Cacher le nom sur mobile */
    }
}

/* Très petits écrans */
@media (max-width: 400px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .nav-links {
        width: 100%;
        justify-content: space-between;
    }
}

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

@media (min-width: 768px) {
    .container {
        padding: 2rem;
    }
}

.login-container {
    max-width: 400px;
    margin: 4rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.login-container h1 {
    margin-bottom: 1.5rem;
    text-align: center;
}

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

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

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

.btn-primary:hover {
    background: #2980b9;
}

.login-form .btn-primary {
    width: 100%;
}

.calendar-container {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#calendar {
    min-height: 600px;
}

.calendar-toolbar {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.search-box {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.search-box input,
.search-box select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.search-box input {
    min-width: 200px;
}

@media (max-width: 768px) {
    .calendar-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .search-box {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .search-box input {
        flex: 1;
        min-width: 150px;
        width: 100%;
    }
    
    .search-box select {
        flex: 1;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .search-box {
        flex-direction: column;
    }
    
    .search-box input,
    .search-box select,
    .search-box button {
        width: 100%;
    }
}

.btn-danger {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
}

select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background: white;
}

/* Dashboard Styles */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-container h1 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

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

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
}

.stat-label {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.dashboard-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.dashboard-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.dashboard-card h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.25rem;
}

.occupancy-display {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.occupancy-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #ecf0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

.occupancy-details {
    color: #7f8c8d;
}

.occupancy-details p {
    margin: 0.25rem 0;
}

.type-chart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chart-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-label {
    width: 100px;
    font-size: 0.9rem;
    color: #2c3e50;
}

.chart-bar-bg {
    flex: 1;
    height: 24px;
    background: #ecf0f1;
    border-radius: 12px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 12px;
    transition: width 0.3s ease;
}

.chart-value {
    width: 40px;
    text-align: right;
    font-weight: 600;
    color: #2c3e50;
}

.no-data {
    color: #7f8c8d;
    text-align: center;
    padding: 2rem;
}

.full-width {
    grid-column: 1 / -1;
}

.user-chart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-row {
        grid-template-columns: 1fr;
    }
    
    .occupancy-display {
        flex-direction: column;
        text-align: center;
    }
}

/* History Styles */
.history-container {
    max-width: 1200px;
    margin: 0 auto;
}

.history-container h1 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.history-filters {
    margin-bottom: 1rem;
}

.history-filters select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-action {
    font-weight: 600;
    color: #2c3e50;
}

.history-date {
    color: #7f8c8d;
    font-size: 0.85rem;
}

.history-content p {
    margin: 0.25rem 0;
    color: #34495e;
}

.history-changes {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: monospace;
}

.history-changes .old {
    color: #e74c3c;
}

.history-changes .new {
    color: #27ae60;
}

.history-changes .arrow {
    margin: 0 0.5rem;
    color: #7f8c8d;
}

/* Notifications */
.notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notification {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    border-left: 4px solid #27ae60;
}

.notification-error {
    border-left: 4px solid #e74c3c;
}

.notification-warning {
    border-left: 4px solid #f39c12;
}

.notification-info {
    border-left: 4px solid #3498db;
}

.notification-icon {
    font-size: 1.25rem;
}

.notification-message {
    flex: 1;
    color: #2c3e50;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    color: #2c3e50;
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.1);
}

/* FullCalendar Button Styles */
.fc .fc-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4em 0.65em;
    font-size: 1em;
    line-height: 1.5;
    border: 1px solid transparent;
    border-radius: 0.25em;
    background-color: #2c3e50;
    color: white;
    cursor: pointer;
    font-family: inherit;
    text-transform: none;
    overflow: visible;
    margin-right: 2px;
}

.fc .fc-button:hover {
    background-color: #1a252f;
}

.fc .fc-button:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(44, 62, 80, 0.25);
}

.fc .fc-button:active {
    background-color: #1a252f;
}

.fc .fc-button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.fc .fc-button-primary {
    background-color: #2c3e50;
    border-color: #2c3e50;
    color: white;
}

.fc .fc-button-primary:hover {
    background-color: #1a252f;
    border-color: #1a252f;
}

.fc .fc-button-primary:disabled {
    background-color: #2c3e50;
    border-color: #2c3e50;
}

.fc .fc-button-group {
    display: inline-flex;
    position: relative;
    vertical-align: middle;
}

.fc .fc-button-group > .fc-button {
    position: relative;
    flex: 1 1 auto;
    margin-right: 0;
}

.fc .fc-button-group > .fc-button:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: 1px solid rgba(255,255,255,0.2);
}

.fc .fc-button-group > .fc-button:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
}

.fc .fc-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5em;
}

.fc .fc-toolbar-title {
    font-size: 1.25em;
    margin: 0;
    font-weight: 600;
}

.fc .fc-toolbar.fc-header-toolbar {
    margin-bottom: 1.5em;
}

.fc .fc-prev-button .fc-icon,
.fc .fc-next-button .fc-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    text-align: center;
    font-family: monospace;
    font-weight: bold;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
    font-size: 1.2em;
}

.fc .fc-prev-button .fc-icon:before {
    content: "‹";
}

.fc .fc-next-button .fc-icon:before {
    content: "›";
}

.fc .fc-today-button {
    text-transform: capitalize;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-color: #1a1a2e;
    --text-color: #eee;
    --card-bg: #16213e;
    --border-color: #0f3460;
}

[data-theme="dark"] body {
    background: var(--bg-color);
    color: var(--text-color);
}

[data-theme="dark"] .navbar {
    background: #0f3460;
}

[data-theme="dark"] .calendar-container,
[data-theme="dark"] .dashboard-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .admin-container,
[data-theme="dark"] .history-item,
[data-theme="dark"] .modal-content {
    background: var(--card-bg);
    color: var(--text-color);
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
    background: #1a1a2e;
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .admin-table th {
    background: #0f3460;
    color: var(--text-color);
}

[data-theme="dark"] .admin-table td {
    border-color: var(--border-color);
}

[data-theme="dark"] .notification {
    background: var(--card-bg);
    color: var(--text-color);
}

[data-theme="dark"] .notification-message {
    color: var(--text-color);
}

/* Admin Table Styles */
.admin-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.admin-container h1 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.admin-toolbar {
    margin-bottom: 1.5rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.admin-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.admin-table tr:hover {
    background: #f8f9fa;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 0.25rem;
}

.btn-small:hover {
    opacity: 0.8;
}
