/* =========================================================
   FCAI GPMS – Application Styles
   ========================================================= */

:root {
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --primary:  #1a3a5c;
    --accent:   #007bff;
    --sidebar-bg:   #1a3a5c;
    --sidebar-text: #c8d8e8;
    --sidebar-hover: rgba(255,255,255,0.1);
    --sidebar-active: rgba(255,255,255,0.18);
    --body-bg: #f4f6f9;
}

/* ---- Base ---- */
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; background: var(--body-bg); color: #333; }

/* ---- Sidebar Layout ---- */
body.sidebar-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 1040;
    transition: transform 0.25s ease;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}

/* ---- Sidebar Brand ---- */
.sidebar-brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px;
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* ---- Sidebar User ---- */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.user-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-role { font-size: 10px; }

/* ---- Sidebar Nav ---- */
.sidebar-nav { list-style: none; padding: 10px 0; margin: 0; flex: 1; }
.sidebar-nav .nav-item { margin: 1px 0; }
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
    font-size: 14px;
}
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--sidebar-active); color: #fff; font-weight: 600;
    border-left: 3px solid #5bc0de; }
.sidebar-nav .nav-link i { width: 18px; text-align: center; }
.nav-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 8px 15px; }

/* ---- Topbar ---- */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    display: flex; align-items: center;
    padding: 0 20px;
    gap: 15px;
    position: sticky; top: 0; z-index: 1020;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.topbar-title { flex: 1; font-weight: 600; color: #333; }
.sidebar-toggle { border: none; background: none; font-size: 18px; color: #666; cursor: pointer; }

/* ---- Page Body ---- */
.page-body { padding: 24px; flex: 1; }

/* ---- Cards ---- */
.card { border: none; box-shadow: 0 1px 6px rgba(0,0,0,0.08); border-radius: 8px; }
.card-header { background: #f8f9fa; border-bottom: 1px solid #e9ecef; font-weight: 600; padding: 12px 16px; border-radius: 8px 8px 0 0 !important; }

/* ---- Stat Cards ---- */
.stat-card {
    border-radius: 10px; padding: 20px;
    display: flex; align-items: center; gap: 16px;
    color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.stat-icon { font-size: 36px; opacity: 0.8; }
.stat-number { font-size: 32px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 13px; opacity: 0.85; }

/* ---- Tables ---- */
.table th { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.table td { vertical-align: middle; }
.thead-dark th { background: var(--primary); color: #fff; }

/* ---- Buttons ---- */
.btn-xs { padding: 2px 8px; font-size: 11px; line-height: 1.5; border-radius: 3px; }

/* ---- Auth Layout ---- */
body.auth-layout {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a3a5c 0%, #0d1f33 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.auth-wrapper { width: 100%; max-width: 420px; }
.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 36px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.auth-header { text-align: center; margin-bottom: 24px; color: var(--primary); }
.auth-header i { color: var(--primary); }

/* ---- Badges override ---- */
.badge { font-size: 11px; }

/* ---- Avatar small ---- */
.avatar-sm {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}

/* ---- Sidebar collapsed ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .page-body { padding: 16px; }
}

/* ---- Print ---- */
@media print {
    .sidebar, .topbar, .btn, .sidebar-toggle { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* ---- Misc ---- */
pre, code { font-size: 12px; }
.border-left { border-left: 4px solid !important; }
.border-left.border-primary { border-left-color: #007bff !important; }
