/* ===== NARPO Design System — Dark Navy + Gold ===== */
:root {
    --navy:        #0d1b2a;
    --navy-light:  #1b2f45;
    --navy-hover:  #243d56;
    --gold:        #c9a227;
    --gold-hover:  #a8861f;
    --gold-light:  #f5e6b8;
    --white:       #ffffff;
    --bg:          #f0f4f8;
    --card-bg:     #ffffff;
    --text:        #1a1a2e;
    --text-muted:  #6c757d;
    --border:      #dee2e6;
    --shadow:      0 2px 12px rgba(13,27,42,.12);
    --radius:      8px;
}

/* ===== Reset / Base ===== */
*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

body {
    font-family: 'Poppins', 'Open Sans', sans-serif;
    background-color: var(--bg);
    color: var(--text);
}

/* ===== Header ===== */
#header {
    background: var(--navy) !important;
    border-bottom: 3px solid var(--gold);
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
    height: 60px;
    padding: 0 1rem;
}

#header .logo img { height: 38px; width: auto; }

#header .logo span {
    color: var(--gold);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: .5px;
    margin-left: .5rem;
}

#header .toggle-sidebar-btn { color: var(--gold); font-size: 1.4rem; }

/* Profile dropdown */
#header .nav-profile img { border: 2px solid var(--gold); }
    #header .nav-link {  color: rgba(255, 255, 255,.85) !important; }
#header .nav-link:hover { color: var(--gold) !important; }

.dropdown-menu.profile {
    border: none;
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

.dropdown-menu.profile .dropdown-header h6 {
    color: var(--navy);
    font-weight: 600;
    margin: 0;
}

/* ===== Sidebar ===== */
#sidebar {
    background: var(--navy) !important;
    border-right: 1px solid var(--navy-light);
    padding-top: 10px;
}

.sidebar-nav .nav-item { padding: 2px 0; }

.sidebar-nav .nav-link {
    color: rgba(180, 180, 255,.75) !important;
    border-radius: 6px;
    margin: 0 8px;
    padding: 9px 14px;
    font-size: .88rem;
    font-weight: 500;
    transition: background .2s, color .2s;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: var(--gold) !important;
    color: var(--navy) !important;
}

.sidebar-nav .nav-link i {
    color: var(--gold);
    font-size: 1rem;
    margin-right: 6px;
    transition: color .2s;
}

.sidebar-nav .nav-link:hover i,
.sidebar-nav .nav-link.active i { color: var(--navy); }

.sidebar-nav .nav-content {
    background: var(--navy-light);
    border-radius: 6px;
    margin: 2px 8px;
    padding: 4px 0;
}

    .sidebar-nav .nav-content li a {
        color: rgba(180, 180, 255,.65) !important;
        font-size: .83rem;
        padding: 6px 14px 6px 32px;
        display: block;
        transition: color .2s;
    }

        .sidebar-nav .nav-content li a:hover { color: rgba(180, 180, 255,.65) !important; }
.sidebar-nav .nav-content li a i { color: var(--gold); }

/* ===== Footer ===== */
#footer {
    background: var(--navy);
    color: rgba(255,255,255,.6);
    font-size: .78rem;
    text-align: center;
    padding: 10px 0;
    border-top: 2px solid var(--gold);
}

/* ===== Main content ===== */
#main { background: var(--bg); padding-top: 20px; }

/* ===== Cards ===== */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--card-bg);
}

.card-header {
    background: var(--navy) !important;
    color: var(--white);
    border-radius: var(--radius) var(--radius) 0 0 !important;
    padding: .8rem 1.2rem;
    border-bottom: 3px solid var(--gold);
}

.card-header h5, .card-header h6 { margin: 0; color: var(--white); }

/* ===== Tables ===== */
table { width: 100%; border-collapse: collapse; }

thead th {
    background: var(--navy) !important;
    color: var(--gold) !important;
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .4px;
    padding: 10px 12px;
    border: none;
}

tbody tr { transition: background .15s; }
tbody tr:nth-child(even) { background: #f5f8fb; }
tbody tr:hover { background: var(--gold-light); }
tbody td { padding: 8px 12px; vertical-align: middle; border-bottom: 1px solid var(--border); }

/* ===== Buttons ===== */
.btn-primary {
    background: var(--navy) !important;
    border-color: var(--navy) !important;
    color: var(--white) !important;
}
.btn-primary:hover {
    background: var(--navy-light) !important;
    border-color: var(--gold) !important;
}

.btn-gold {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--navy);
    font-weight: 600;
}
.btn-gold:hover {
    background: var(--gold-hover);
    border-color: var(--gold-hover);
    color: var(--white);
}

.btn-outline-success { border-color: #198754; color: #198754; }
.btn-outline-success:hover { background: #198754; color: #fff; }

/* ===== Forms ===== */
.form-label { font-weight: 500; font-size: .85rem; color: var(--navy); margin-bottom: 3px; }

.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .87rem;
    padding: .4rem .75rem;
    transition: border-color .2s, box-shadow .2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,162,39,.15);
    outline: none;
}

.form-control:disabled, .form-select:disabled, .form-control[readonly] {
    background: #f1f3f5;
    color: #495057;
    border-color: #e2e6ea;
}

/* ===== Tabs (Bootstrap nav-tabs override) ===== */
.narpo-tabs { border-bottom: 3px solid var(--navy); margin-bottom: 0; }

.narpo-tabs .nav-link {
    color: var(--navy);
    font-weight: 600;
    font-size: .85rem;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: 6px 6px 0 0;
    transition: background .2s, color .2s;
}

.narpo-tabs .nav-link:hover { background: var(--gold-light); color: var(--navy); }

.narpo-tabs .nav-link.active {
    background: var(--navy);
    color: var(--gold) !important;
    border-color: var(--navy);
}

.tab-content { border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); }
.tab-pane { padding: 1.2rem; }

/* ===== Modal ===== */
.modal-header {
    background: var(--navy);
    color: var(--white);
    border-bottom: 3px solid var(--gold);
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-header .modal-title { color: var(--white); font-weight: 600; }
.modal-header .btn-close { filter: invert(1); }

/* ===== Back-to-top ===== */
.back-to-top { background: var(--gold); color: var(--navy); }
.back-to-top:hover { background: var(--gold-hover); color: var(--white); }

/* ===== Loading overlay ===== */
#loading {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(13,27,42,.45);
    z-index: 9999;
}

#loadingcontent {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

#loadingspinner img { width: 72px; }

/* ===== Stat cards (dashboard) ===== */
.stat-card {
    border-left: 5px solid var(--gold);
    border-radius: var(--radius);
    padding: 1.2rem 1.4rem;
    background: var(--white);
    box-shadow: var(--shadow);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--navy);
}

.stat-card .stat-label {
    font-size: .8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .6px;
    font-weight: 600;
}

.stat-card .stat-icon {
    font-size: 2.4rem;
    color: var(--gold);
    opacity: .85;
}

/* ===== Select2 override ===== */
.select2-container--default .select2-selection--single {
    border: 1px solid var(--border);
    border-radius: 6px;
    height: 36px;
    line-height: 34px;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,162,39,.15);
}

.select2-container--default .select2-results__option--highlighted {
    background-color: var(--navy) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px;
    font-size: .87rem;
    color: var(--text);
}

/* ===== Login page ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
}

.login-brand {
    background: linear-gradient(160deg, var(--navy) 60%, var(--navy-light));
    color: white;
    width: 42%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.login-brand img { width: 120px; margin-bottom: 1.5rem; filter: drop-shadow(0 4px 8px rgba(0,0,0,.5)); }
.login-brand h2 { color: var(--gold); font-weight: 700; font-size: 1.4rem; margin-bottom: .5rem; }
.login-brand p { color: rgba(255,255,255,.65); font-size: .88rem; }
.login-brand .divider { width: 60px; height: 3px; background: var(--gold); margin: 1.2rem auto; border-radius: 2px; }

.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem 2rem;
}

.login-card h4 { color: var(--navy); font-weight: 700; margin-bottom: 1.5rem; }

.login-card .btn-login {
    background: var(--navy);
    color: var(--white);
    width: 100%;
    padding: .6rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    transition: background .2s;
}

.login-card .btn-login:hover { background: var(--gold); color: var(--navy); }

@media (max-width: 768px) {
    .login-brand { display: none; }
    .login-form-panel { padding: 1rem; }
}

/* ===== Photo preview ===== */
.photo-frame {
    width: 220px;
    height: 280px;
    border: 3px solid var(--navy);
    border-radius: var(--radius);
    object-fit: cover;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-frame img { width: 100%; height: 100%; object-fit: cover; border-radius: calc(var(--radius) - 2px); }

.photo-placeholder {
    color: var(--text-muted);
    font-size: .85rem;
    text-align: center;
}

/* ===== Document panel ===== */
.document-panel-header {
    background: var(--navy) !important;
    border-bottom: 3px solid var(--gold);
}

.document-panel-header h5 { color: var(--white); margin-bottom: .2rem; }
.document-panel-header p  { color: rgba(255,255,255,.65); font-size: .82rem; }

.document-kicker {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gold);
    margin-bottom: .15rem;
}

.doc-count-badge {
    background: rgba(255,255,255,.12);
    color: var(--gold);
    border: 1px solid var(--gold);
    font-size: .78rem;
    font-weight: 600;
    padding: .3rem .8rem;
    border-radius: 20px;
    white-space: nowrap;
}

.document-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.document-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem .75rem .75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    transition: box-shadow .2s, transform .15s, border-color .2s;
}

.document-card:hover {
    box-shadow: 0 6px 18px rgba(13,27,42,.15);
    border-color: var(--gold);
    transform: translateY(-2px);
}

.document-icon-wrap {
    width: 60px;
    height: 60px;
    background: var(--bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.document-icon { width: 36px; height: 36px; object-fit: contain; }

.document-title {
    font-size: .78rem;
    font-weight: 600;
    color: var(--navy);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.document-actions {
    display: flex;
    gap: .4rem;
    width: 100%;
    margin-top: .25rem;
}

.document-empty-state {
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    text-align: center;
    padding: 3rem 1.5rem;
}

.document-empty-state > i {
    font-size: 2.8rem;
    color: var(--border);
    display: block;
}

/* ===== Drop zone (DocumentPartial) ===== */
.document-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    background: var(--bg);
    transition: border-color .2s, background .2s;
}

.document-dropzone:hover,
.document-dropzone.highlight {
    border-color: var(--gold);
    background: var(--gold-light);
}

.document-dropzone-icon { font-size: 2.4rem; color: var(--navy); }

.document-file-list { list-style: none; padding: 0; margin: .75rem 0 0; }

.document-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .35rem .75rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: .4rem;
    font-size: .85rem;
}

.document-file-remove {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 .2rem;
    line-height: 1;
}

.document-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: none;
}

/* ===== Utility ===== */
.section-header {
    background: var(--navy);
    color: var(--gold);
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    padding: 5px 12px;
    border-radius: 4px;
    margin-bottom: .8rem;
}
