/* Variables CSS - Couleurs Royal Air Maroc */
:root {
    --primary-color: #C41E3A;
    --primary-dark: #A01830;
    --secondary-color: #64748b;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --warning-color: #ea580c;
    --info-color: #0891b2;
    --light-bg: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f1f5f9;
    color: var(--text-primary);
}

body {
    display: flex;
    flex-direction: column;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-svg {
    width: 40px;
    height: 40px;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 0.75rem 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    flex: 1;
}

/* Alerte */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.alert-info {
    background-color: #cffafe;
    color: #164e63;
    border-left: 4px solid var(--info-color);
}

.alert-warning {
    background-color: #ffedd5;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

/* Boutons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

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

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

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

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

.btn-danger:hover {
    background-color: #b91c1c;
}

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

.btn-info:hover {
    background-color: #0e7490;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Formulaires */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.form-group input:disabled {
    background-color: var(--light-bg);
    color: var(--text-secondary);
}

/* Grid de formulaire */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

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

/* Login */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, #8B0000 100%);
}

.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 1.5rem;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.login-logo svg {
    width: 60px;
    height: 60px;
}

.login-box h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
    color: var(--primary-color);
}

.login-box h2 {
    font-size: 1rem;
    color: var(--text-secondary);
}

.login-form {
    margin-bottom: 1.5rem;
}

.login-note {
    background-color: var(--light-bg);
    padding: 1rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    border-left: 4px solid var(--primary-color);
}

/* Tableau */
.table-responsive {
    overflow-x: auto;
    margin: 2rem 0;
    background: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-bottom: 2px solid var(--primary-color);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 700;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

.text-center {
    text-align: center;
    color: var(--text-secondary);
}

/* Recherche */
.search-box {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.search-form {
    display: flex;
    gap: 1rem;
}

.search-form input {
    flex: 1;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.95rem;
}

.search-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

/* Modal */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

.modal-backdrop.active {
    display: block;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
}

.modal.active {
    display: block;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 0.75rem 0.75rem 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    font-size: 2rem;
    cursor: pointer;
    color: white;
    background: none;
    border: none;
    text-decoration: none;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.modal-close:hover {
    opacity: 1;
}

.modal-content {
    display: flex;
    flex-direction: column;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.edit-form {
    padding: 1.5rem;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.page-link {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    transition: all 0.2s ease;
}

.page-link:hover {
    background-color: var(--light-bg);
    border-color: var(--primary-color);
}

.page-link.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Historique */
.info-box {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary-color);
}

.info-box h2 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.history-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.history-card {
    background: white;
    border-left: 4px solid var(--primary-color);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.history-header {
    background-color: var(--light-bg);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.history-header strong {
    color: var(--primary-color);
    font-size: 1rem;
}

.history-user {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.history-date {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
}

.history-content {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.history-value {
    flex: 1;
    min-width: 150px;
}

.history-value .label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.old-value {
    display: block;
    padding: 0.5rem;
    background-color: #fee2e2;
    border-left: 3px solid var(--danger-color);
    border-radius: 0.25rem;
    color: #7f1d1d;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.new-value {
    display: block;
    padding: 0.5rem;
    background-color: #dcfce7;
    border-left: 3px solid var(--success-color);
    border-radius: 0.25rem;
    color: #166534;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.history-arrow {
    font-size: 1.5rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-container {
        flex-direction: column;
        gap: 1rem;
    }

    .navbar-title {
        flex-direction: column;
        text-align: center;
    }

    .navbar-user {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .search-form {
        flex-direction: column;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        width: 95%;
        max-width: 90vw;
    }

    .history-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-date {
        margin-left: 0;
    }

    .history-content {
        flex-direction: column;
    }

    .history-arrow {
        display: none;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem;
    }

    .login-box {
        max-width: 90%;
    }
}

/* Logo Circulaire */
.logo-circular {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background-color: #C41E3A;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.logo-circular img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Version plus grande pour la page de connexion */
.login-logo .logo-circular {
    width: 80px;
    height: 80px;
    border-width: 4px;
}

.login-logo .logo-circular img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Version responsive */
@media (max-width: 768px) {
    .logo-circular {
        width: 45px;
        height: 45px;
    }
    
    .login-logo .logo-circular {
        width: 70px;
        height: 70px;
    }
}