/* ==========================================================
   CEPJ - Application de Gestion d'Expertise Maritime
   Styles personnalisés
   ========================================================== */

:root {
    --sidebar-width: 260px;
    --topbar-height: 56px;
    --primary-color: #0d47a1;
    --primary-light: #1565c0;
    --primary-dark: #0a3470;
    --accent-color: #ff6f00;
    --sidebar-bg: #0d1b2a;
    --sidebar-text: #a8b2c1;
    --sidebar-active: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
}

/* ---- Global ---- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f5f7fa;
    min-height: 100vh;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

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

.sidebar-brand:hover {
    color: #fff;
}

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

.sidebar-nav .nav-section {
    padding: 1rem 1.25rem 0.4rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(168, 178, 193, 0.6);
    font-weight: 600;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}

.sidebar-nav .nav-link:hover {
    background-color: var(--sidebar-hover-bg);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background-color: var(--sidebar-hover-bg);
    color: var(--sidebar-active);
    border-left-color: var(--accent-color);
    font-weight: 500;
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--sidebar-text);
}

.sidebar-toggle {
    color: #fff;
    padding: 0;
}

/* ---- Main content ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---- Topbar ---- */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e0e4e8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar .breadcrumb {
    font-size: 0.875rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.topbar-actions .btn-link {
    color: #6c757d;
    text-decoration: none;
}

.topbar-actions .btn-link:hover {
    color: var(--primary-color);
}

.topbar-toggle {
    color: var(--primary-color);
    text-decoration: none;
    padding: 0;
}

/* ---- Footer ---- */
.app-footer {
    padding: 1rem 0;
    border-top: 1px solid #e0e4e8;
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: auto;
}

/* ---- Cards & Stats ---- */
.stat-card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a2e;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ---- Cards ---- */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #eee;
    font-weight: 600;
}

/* ---- Workflow Steps ---- */
.workflow-steps {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    padding: 1rem 0;
}

.workflow-step {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.workflow-step .step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e9ecef;
    color: #6c757d;
    border: 2px solid #e9ecef;
}

.workflow-step.completed .step-circle {
    background: #198754;
    border-color: #198754;
    color: #fff;
}

.workflow-step.active .step-circle {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.25);
}

.workflow-step .step-line {
    width: 30px;
    height: 2px;
    background: #e9ecef;
}

.workflow-step.completed .step-line {
    background: #198754;
}

.workflow-step .step-label {
    font-size: 0.65rem;
    text-align: center;
    margin-top: 0.25rem;
    color: #6c757d;
    max-width: 60px;
    line-height: 1.2;
}

.workflow-step.active .step-label {
    color: var(--primary-color);
    font-weight: 600;
}

/* ---- Tables ---- */
.table th {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    border-bottom-width: 1px;
}

.table td {
    vertical-align: middle;
}

/* ---- Badges ---- */
.badge {
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ---- Auth page ---- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo i {
    font-size: 3rem;
    color: var(--primary-color);
}

.auth-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-top: 0.5rem;
}

/* ---- Mobile Responsive ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
}

@media (max-width: 767.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .workflow-steps {
        padding: 0.5rem 0;
    }

    .workflow-step .step-label {
        display: none;
    }
}

@media (min-width: 768px) {
    .topbar-toggle,
    .sidebar-toggle {
        display: none !important;
    }
}

/* ---- Utilities ---- */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Expertise Timer ---- */
.expertise-timer {
    font-size: 2.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--primary-color);
    text-align: center;
    padding: 1rem;
    background: rgba(13, 71, 161, 0.05);
    border-radius: 1rem;
}

.expertise-timer.recording {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ---- Empty states ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

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

.empty-state h5 {
    color: #495057;
}

/* ---- Print styles ---- */
@media print {
    .sidebar, .topbar, .app-footer, .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
}
