/* ================================================
   Port Sec — Admin Interface Styles
   ================================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #012e25;
    --sidebar-hover: #014a3d;
    --sidebar-active: #025B4C;
    --topbar-height: 60px;
    --primary: #025B4C;
    --primary-dark: #014a3d;
    --primary-light: #e6f4f1;
    --primary-mid: #03856d;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font);
    background: #f1f5f9;
    color: #1e293b;
    margin: 0;
}

/* ---- Login ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #012e25 0%, #025B4C 100%);
    padding: 1rem;
}

.login-wrapper { width: 100%; max-width: 420px; }

.login-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 25px 60px rgba(0,0,0,.35);
}

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

.logo-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 24px rgba(2,91,76,.35);
}

.logo-icon i { font-size: 2rem; color: white; }

.login-title {
    font-size: 1.75rem; font-weight: 800;
    color: #0f172a; margin: 0;
}

.login-subtitle { color: #64748b; margin: .25rem 0 0; font-size: .9rem; }

.login-info { text-align: center; }

/* Override Bootstrap primary */
.btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
}
.btn-outline-primary {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}
.btn-outline-primary:hover {
    background-color: var(--primary) !important;
    color: white !important;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .25rem rgba(2,91,76,.2);
}
.page-item.active .page-link {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}
.page-link { color: var(--primary); }

/* ---- Admin Layout ---- */
.admin-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform .3s ease;
    overflow-y: auto;
}

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

.sidebar-logo {
    display: flex; align-items: center; gap: .75rem;
    color: white; font-size: 1.2rem; font-weight: 700;
    text-decoration: none;
}

.sidebar-logo i { font-size: 1.5rem; color: #4ade80; }

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

.sidebar-section {
    padding: .6rem 1.5rem .25rem;
    font-size: .65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .1em;
    color: rgba(255,255,255,.3);
}

.sidebar-item a {
    display: flex; align-items: center; gap: .75rem;
    padding: .65rem 1.5rem;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: .875rem;
    transition: all .2s;
    border-left: 3px solid transparent;
}

.sidebar-item a i { font-size: 1rem; width: 18px; text-align: center; }

.sidebar-item a:hover {
    color: white;
    background: var(--sidebar-hover);
}

.sidebar-item.active a {
    color: white;
    background: rgba(2,91,76,.4);
    border-left-color: #4ade80;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center; gap: .5rem;
}

.user-info {
    flex: 1; display: flex; align-items: center; gap: .75rem;
    overflow: hidden;
}

.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary-mid), var(--primary));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem; font-weight: 700; color: white;
    flex-shrink: 0;
}

.user-details { overflow: hidden; }

.user-name { color: white; font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: rgba(255,255,255,.45); font-size: .7rem; }

.logout-btn {
    color: rgba(255,255,255,.45); font-size: 1rem;
    text-decoration: none; padding: .4rem;
    border-radius: 6px; transition: all .2s;
}
.logout-btn:hover { color: #ef4444; background: rgba(239,68,68,.1); }

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

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.5rem;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.topbar::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--primary);
}

.sidebar-toggle {
    background: none; border: none;
    font-size: 1.3rem; color: #64748b;
    cursor: pointer; padding: .25rem;
    display: none;
}

.topbar-title {
    flex: 1; font-weight: 600; color: #1e293b;
    font-size: 1rem;
}

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

.content-area { padding: 1.75rem; flex: 1; }

/* ---- KPI Cards ---- */
.kpi-card {
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    display: flex; align-items: center; gap: 1rem;
    color: white; box-shadow: 0 4px 15px rgba(0,0,0,.12);
    transition: transform .2s;
}
.kpi-card:hover { transform: translateY(-2px); }
.kpi-icon { font-size: 2rem; opacity: .8; }
.kpi-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.kpi-label { font-size: .8rem; opacity: .85; margin-top: .25rem; }
.kpi-stock   { background: linear-gradient(135deg, #025B4C, #014a3d); }
.kpi-entrant { background: linear-gradient(135deg, #0891b2, #0e7490); }
.kpi-sortant { background: linear-gradient(135deg, #d97706, #b45309); }
.kpi-retard  { background: linear-gradient(135deg, #dc2626, #b91c1c); }

/* ---- Cards ---- */
.card { border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.card-header {
    background: #f8fafc; border-bottom: 1px solid #e2e8f0;
    padding: .85rem 1.25rem;
    font-weight: 600; font-size: .9rem; color: #374151;
    border-radius: 12px 12px 0 0 !important;
}

/* ---- Occupation gauge ---- */
.occupation-gauge { display: flex; justify-content: center; }
.gauge-svg { width: 200px; height: 120px; }
.gauge-text { font-size: 22px; font-weight: 800; fill: #1e293b; }

/* ---- Emplacements grid ---- */
.empl-cell {
    width: 56px; height: 56px;
    border-radius: 8px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 700;
    transition: transform .15s;
}
.empl-cell:hover { transform: scale(1.1); }
.empl-libre  { background: #d1fae5; color: #065f46; border: 2px solid #6ee7b7; }
.empl-occupe { background: #fee2e2; color: #7f1d1d; border: 2px solid #fca5a5; }
.empl-code   { font-size: .65rem; }
.empl-count  { font-size: .6rem; }

/* ---- Client cards ---- */
.client-card { transition: box-shadow .2s; }
.client-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.12); }

/* ---- Tables ---- */
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; font-weight: 600; }
.font-monospace { font-family: 'Courier New', monospace; }

/* ---- Photo preview ---- */
.photo-preview-wrap {
    position: relative;
    display: inline-block;
}
.photo-preview {
    width: 100%; max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--primary);
}
.photo-thumb {
    width: 60px; height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #e2e8f0;
    cursor: pointer;
}
.photo-thumb:hover { border-color: var(--primary); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .content-area { padding: 1rem; }
}
