/* Reset et variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #D4721A;
    --primary-dark: #B85E15;
    --secondary: #8B4513;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --white: #ffffff;
    --border: #dee2e6;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f6f9;
    color: #333;
    line-height: 1.6;
}

/* Page de connexion */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 15px;
    box-shadow: 0 15px 60px rgba(0,0,0,0.3);
    padding: 40px;
    backdrop-filter: blur(10px);
}

.logo-section {
    text-align: center;
    margin-bottom: 35px;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 20px;
}

.logo-section .brand-logo-wrap {
    width: 110px;
    height: 110px;
    margin: 0 auto 16px;
    animation: brandArriveAnywhere 1.25s cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
}

.logo-section .brand-logo {
    width: 110px !important;
    height: 110px !important;
    max-width: 110px !important;
    max-height: 110px !important;
    min-width: 110px;
    min-height: 110px;
    object-fit: cover;
    border-radius: 18px;
    margin: 0;
    display: block !important;
    background: #fff;
    border: 2px solid rgba(212, 114, 26, 0.35);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
    transform-origin: center;
    will-change: transform, opacity, box-shadow;
    animation: brandFloat 3.4s ease-in-out 1.25s infinite,
               brandGlow 2.8s ease-in-out 1.25s infinite;
}

@keyframes brandArriveAnywhere {
    0% {
        transform: translate(110vw, -85vh) rotate(680deg) scale(0.15);
        opacity: 0;
    }
    50% {
        transform: translate(-34vw, 14vh) rotate(180deg) scale(0.62);
        opacity: 0.9;
    }
    80% {
        transform: translate(8vw, -5vh) rotate(40deg) scale(0.94);
        opacity: 1;
    }
    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
}

@keyframes brandFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes brandGlow {
    0%, 100% { box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2); }
    50% { box-shadow: 0 22px 55px rgba(212, 114, 26, 0.45); }
}

.logo-section h1 {
    font-size: 30px;
    margin-bottom: 8px;
    font-weight: 900;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    background: linear-gradient(90deg, var(--primary) 0%, #f3b25b 45%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.logo-section p {
    color: #6A3B12;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    position: relative;
    display: inline-block;
    padding-bottom: 10px;
}

.logo-section p::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 56px;
    height: 3px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    box-shadow: 0 6px 18px rgba(212, 114, 26, 0.35);
}

@media (prefers-reduced-motion: reduce) {
    .logo-section .brand-logo-wrap {
        animation: none;
    }

    .logo-section .brand-logo {
        animation: brandGlow 2.8s ease-in-out infinite;
        transform: none;
        opacity: 1;
    }
}

/* Conteneur du mot de passe avec icône */
.password-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-container input {
    width: 100%;
    padding-right: 45px !important;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s ease;
    user-select: none;
}

.toggle-password:hover {
    transform: translateY(-50%) scale(1.15);
    opacity: 0.8;
}

.login-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
    text-align: center;
}

.login-footer p {
    margin: 8px 0;
    color: #666;
    font-size: 13px;
}

.login-footer p:first-child {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
}

.login-footer small {
    color: #888;
    font-weight: 500;
}

/* Formulaires */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    background: #fafbfc;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: #bbb;
    background: #ffffff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(212, 114, 26, 0.15);
    background: #ffffff;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Observation textarea with ruled lines (paper-like) */
.observations-box {
    min-height: 220px; /* approx. 10 lines */
    line-height: 22px;
    padding: 12px 15px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background-color: #fafbfc;
    background-image: repeating-linear-gradient(
        to bottom,
        rgba(0,0,0,0.06) 0px,
        rgba(0,0,0,0.06) 1px,
        transparent 1px,
        transparent 22px
    );
    background-size: 100% 22px;
    background-position: left top;
    background-repeat: repeat-y;
    white-space: pre-wrap;
    resize: vertical;
}

/* When readonly, keep subtle background */
.observations-box[readonly] {
    background-color: #f8f9fa;
    opacity: 0.95;
} 

/* Boutons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 114, 26, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(212, 114, 26, 0.3);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: #333;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-block {
    width: 100%;
    display: block;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    /* Use the sidebar-specific CSS variable if available, otherwise fallback to a solid color */
    background: var(--sidebar-bg, #1e293b);
    color: var(--text-light, #fff);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    left: 0;
    top: 0;
    z-index: 1200;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 25px 20px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 18px;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 12px;
    color: #adb5bd;
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #adb5bd;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 14px;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(212, 114, 26, 0.2);
    color: white;
    border-left: 4px solid var(--primary);
    padding-left: 16px;
}

.sidebar-menu li a span {
    margin-right: 12px;
    font-size: 18px;
}

/* Main Content - CENTRÉ */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    max-width: calc(100% - 260px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-content > * {
    width: 100%;
    max-width: 1200px;
}

.top-bar {
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar h1 {
    font-size: 24px;
    color: var(--dark);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.card-header {
    border-bottom: 2px solid var(--light);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 18px;
    color: var(--dark);
}

.card-body {
    padding: 10px 0;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-icon.primary {
    background: rgba(212, 114, 26, 0.1);
    color: var(--primary);
}

.stat-icon.success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success);
}

.stat-icon.danger {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
}

.stat-icon.info {
    background: rgba(23, 162, 184, 0.1);
    color: var(--info);
}

.stat-details h4 {
    font-size: 28px;
    color: var(--dark);
    margin-bottom: 5px;
}

.stat-details p {
    font-size: 14px;
    color: #6c757d;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table thead {
    background: var(--light);
}

table th,
table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

table th {
    font-weight: 600;
    color: var(--dark);
}

table tbody tr:hover {
    background: #f8f9fa;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 10px;
}

/* Actions */
.actions {
    display: flex;
    gap: 10px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Login Footer */
.login-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: #6c757d;
    font-size: 12px;
}

/* Print Styles */
@media print {
    .sidebar,
    .top-bar,
    .btn,
    .actions {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        page-break-inside: avoid;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .dashboard {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    .main-content {
        margin-left: 0;
        padding: 15px;
    }
}