/* ==========================================================================
   ADRASEC 06 - Custom Styles
   Couleurs officielles : Bleu marine, Rouge sécurité civile, Orange alerte
   ========================================================================== */

:root {
    /* ADRASEC Colors */
    --adrasec-primary: #1e3a5f;
    --adrasec-primary-light: #2d5a8a;
    --adrasec-primary-dark: #0f1f33;
    --adrasec-secondary: #e74c3c;
    --adrasec-accent: #f39c12;
    --adrasec-success: #27ae60;
    --adrasec-info: #3498db;
    --adrasec-warning: #f1c40f;
    --adrasec-danger: #c0392b;
    
    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --topnav-height: 60px;
    
    /* Transitions */
    --transition-speed: 0.3s;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f5f7fa;
    min-height: 100vh;
}

a {
    color: var(--adrasec-primary);
    text-decoration: none;
}

a:hover {
    color: var(--adrasec-primary-light);
}

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--adrasec-primary-dark) 0%, var(--adrasec-primary) 100%);
    color: #fff;
    z-index: 1000;
    transition: width var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
    text-decoration: none;
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--adrasec-accent);
}

.sidebar-nav {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.nav-section {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    padding: 1rem 1.25rem 0.5rem;
    margin-top: 0.5rem;
}

.nav-item {
    margin: 0.125rem 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-link.active {
    background: var(--adrasec-secondary);
    color: #fff;
    font-weight: 500;
}

.nav-link i {
    font-size: 1.125rem;
    width: 1.5rem;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar,
.user-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-avatar-placeholder {
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.user-callsign {
    font-size: 0.75rem;
    color: var(--adrasec-accent);
}

/* ==========================================================================
   Main Content
   ========================================================================== */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-speed) ease;
}

.top-nav {
    position: sticky;
    top: 0;
    height: var(--topnav-height);
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    z-index: 100;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--adrasec-primary);
    cursor: pointer;
    padding: 0.25rem;
}

.search-form {
    flex: 1;
    max-width: 400px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper i {
    position: absolute;
    left: 0.875rem;
    color: #6c757d;
}

.search-input-wrapper input {
    width: 100%;
    padding: 0.5rem 0.875rem 0.5rem 2.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

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

.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--adrasec-primary);
    transition: all 0.2s ease;
}

.nav-action:hover {
    background: #f8f9fa;
    color: var(--adrasec-secondary);
}

.page-content {
    padding: 1.5rem;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
}

.card-header {
    background: none;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--adrasec-primary);
}

.card-body {
    padding: 1.25rem;
}

/* Stat Cards */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    opacity: 0.1;
    color: var(--adrasec-primary);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--adrasec-primary);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.stat-card.stat-primary { border-left: 4px solid var(--adrasec-primary); }
.stat-card.stat-success { border-left: 4px solid var(--adrasec-success); }
.stat-card.stat-warning { border-left: 4px solid var(--adrasec-warning); }
.stat-card.stat-danger { border-left: 4px solid var(--adrasec-danger); }
.stat-card.stat-info { border-left: 4px solid var(--adrasec-info); }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn-adrasec {
    background: var(--adrasec-primary);
    border-color: var(--adrasec-primary);
    color: #fff;
}

.btn-adrasec:hover {
    background: var(--adrasec-primary-light);
    border-color: var(--adrasec-primary-light);
    color: #fff;
}

.btn-adrasec-secondary {
    background: var(--adrasec-secondary);
    border-color: var(--adrasec-secondary);
    color: #fff;
}

.btn-adrasec-secondary:hover {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
}

.btn-adrasec-outline {
    background: transparent;
    border-color: var(--adrasec-primary);
    color: var(--adrasec-primary);
}

.btn-adrasec-outline:hover {
    background: var(--adrasec-primary);
    color: #fff;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid var(--adrasec-primary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--adrasec-primary);
    padding: 0.75rem;
}

.table tbody td {
    padding: 0.875rem 0.75rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background: rgba(30, 58, 95, 0.03);
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge-status {
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-available { background: var(--adrasec-success); color: #fff; }
.badge-in-use { background: var(--adrasec-info); color: #fff; }
.badge-maintenance { background: var(--adrasec-warning); color: #212529; }
.badge-broken { background: var(--adrasec-danger); color: #fff; }

.badge-group {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 500;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-label {
    font-weight: 500;
    color: var(--adrasec-primary);
    margin-bottom: 0.375rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--adrasec-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-check-input:checked {
    background-color: var(--adrasec-primary);
    border-color: var(--adrasec-primary);
}

/* ==========================================================================
   Page Headers
   ========================================================================== */

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

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--adrasec-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-title i {
    color: var(--adrasec-secondary);
}

/* ==========================================================================
   Auth Pages (Login, Register)
   ========================================================================== */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--adrasec-primary-dark) 0%, var(--adrasec-primary) 100%);
    padding: 2rem;
}

.auth-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.auth-card.auth-card-wide {
    max-width: 560px;
}

.auth-header {
    background: var(--adrasec-primary);
    color: #fff;
    padding: 2rem;
    text-align: center;
}

.auth-header h1 {
    font-size: 1.5rem;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-header h1 i {
    color: var(--adrasec-accent);
}

.auth-header p {
    margin: 0.5rem 0 0;
    opacity: 0.8;
    font-size: 0.875rem;
}

.auth-body {
    padding: 2rem;
}

.auth-footer {
    padding: 1rem 2rem 2rem;
    text-align: center;
    border-top: 1px solid #e9ecef;
}

/* ==========================================================================
   Member Cards
   ========================================================================== */

.member-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.member-card:hover {
    background: #f8f9fa;
}

.member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.member-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--adrasec-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.member-info h5 {
    margin: 0;
    font-size: 1rem;
    color: var(--adrasec-primary);
}

.member-info .callsign {
    color: var(--adrasec-accent);
    font-weight: 600;
}

.member-info .email {
    font-size: 0.8rem;
    color: #6c757d;
}

/* ==========================================================================
   Document Cards
   ========================================================================== */

.document-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.document-card:hover {
    border-color: var(--adrasec-primary);
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.1);
}

.document-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--adrasec-primary);
}

.document-icon.pdf { color: #e74c3c; }
.document-icon.doc, .document-icon.docx { color: #2980b9; }
.document-icon.xls, .document-icon.xlsx { color: #27ae60; }
.document-icon.ppt, .document-icon.pptx { color: #e67e22; }

.document-info h5 {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
}

.document-meta {
    font-size: 0.8rem;
    color: #6c757d;
}

/* ==========================================================================
   Filters
   ========================================================================== */

.filters-bar {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: 1rem;
}

.empty-state h4 {
    color: var(--adrasec-primary);
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar-backdrop.show {
        display: block;
    }
}

@media (max-width: 575.98px) {
    .page-content {
        padding: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filters-bar {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.app-footer {
    margin-top: auto;
    padding: 1.5rem 2rem;
    background: #fff;
    border-top: 1px solid #e9ecef;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.footer-brand {
    font-weight: 600;
    color: var(--adrasec-primary);
}

.footer-brand i {
    color: var(--adrasec-accent);
}

.footer-tagline {
    font-size: 0.75rem;
    color: #6c757d;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    font-size: 0.875rem;
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--adrasec-primary);
}

.footer-right {
    text-align: right;
}

.footer-copyright {
    font-size: 0.75rem;
    color: #adb5bd;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-left {
        align-items: center;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }
    
    .footer-right {
        text-align: center;
    }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.text-adrasec { color: var(--adrasec-primary) !important; }
.text-adrasec-secondary { color: var(--adrasec-secondary) !important; }
.text-adrasec-accent { color: var(--adrasec-accent) !important; }

.bg-adrasec { background-color: var(--adrasec-primary) !important; }
.bg-adrasec-secondary { background-color: var(--adrasec-secondary) !important; }
.bg-adrasec-accent { background-color: var(--adrasec-accent) !important; }

.border-adrasec { border-color: var(--adrasec-primary) !important; }

/* Messages container */
.messages-container {
    margin-bottom: 1rem;
}

/* Legal content */
.legal-content {
    line-height: 1.8;
}

.legal-content h2, .legal-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--adrasec-primary);
}
