/* ===== POLAS Design System — Navy + Maroon ===== */
:root {
    --navy:         #0d1b2a;
    --navy-light:   #1b2f45;
    --navy-hover:   #243d56;
    --accent:       #8c1c3f;
    --accent-hover: #6e1531;
    --accent-light: #f3d9e1;
    --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: calc(10px + (20 - 16) * ((100vw - 320px) / 680));
    position: relative;
    min-height: 100%;
}

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

.body {
    height: 80vh;
}

.footer {
    height: 1rem;
}

.image-size {
    height: 22%;
    width: 22%;
}

/* ===== Header ===== */
#header {
    background: var(--navy) !important;
    border-bottom: 3px solid var(--accent);
    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(--accent-light);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: .5px;
    margin-left: .5rem;
}

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

#header .nav-profile img { border: 2px solid var(--accent-light); }
#header .nav-link { color: rgba(255,255,255,.85) !important; }
#header .nav-link:hover { color: var(--accent-light) !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(220,190,200,.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(--accent) !important;
    color: var(--white) !important;
}

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

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

.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(220,190,200,.65) !important;
    font-size: .83rem;
    padding: 6px 14px 6px 32px;
    display: block;
    transition: color .2s;
}

.sidebar-nav .nav-content li a:hover { color: var(--white) !important; }
.sidebar-nav .nav-content li a i { color: var(--accent-light); }

/* ===== 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(--accent);
}

#footer .copyright,
#footer .credits {
    color: rgba(255,255,255,.6) !important;
}

/* ===== 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(--accent);
}

.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(--accent-light) !important;
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .4px;
    padding: 10px 12px;
    border: none;
    text-align: left;
}

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

.table-sortable th {
    background-color: var(--navy) !important;
    color: var(--accent-light) !important;
    cursor: pointer;
}

.table-sortable .th-sort-asc::after {
    content: "\25b4"
}

.table-sortable .th-sort-desc::after {
    content: "\25be"
}

.table-sortable .th-sort-asc::after,
.table-sortable .th-sort-desc::after {
    margin-left: 5px;
}

.table-sortable .th-sort-asc,
.table-sortable .th-sort-desc {
    background: var(--navy-hover) !important;
}

/* ===== 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(--accent) !important;
}

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

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

.openbtn {
    font-size: calc(15px + (20 - 16) * ((100vw - 320px) / 680));
    cursor: pointer;
    background-color: var(--navy);
    color: white;
    padding: 10px 15px;
    border: none;
}

.openbtn:hover {
    background-color: var(--navy-light);
}

/* ===== 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,
input[type=text]:focus {
    border: 1px solid var(--accent);
    box-shadow: 0 0 0 3px rgba(140,28,63,.15);
    outline: none;
}

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

.txtarea {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    width: 100%;
}

legend {
    margin-right: 0.3rem;
    margin-left: 0.3rem;
}

.row {
    margin-right: 1rem;
    margin-left: 1rem;
}

.controls {
    display: flex;
    margin-left: 1%;
    margin-bottom: 1%;
    justify-content: space-between;
}

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

.polas-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;
}

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

.polas-tabs .nav-link.active {
    background: var(--navy);
    color: var(--accent-light) !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; }

/* Legacy manual tab widget (used by older views) */
.tab {
    overflow: hidden;
    border: 1px solid var(--border);
    background-color: var(--navy);
}

.tab button {
    background-color: inherit;
    color: white;
    float: left;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: 0.3s;
}

.tab button:hover {
    background-color: var(--navy-light);
}

.tab button.active {
    background-color: var(--accent);
}

.tablink {
    background-color: var(--navy);
    color: white;
    float: left;
    border: thin;
    outline: auto;
    cursor: pointer;
    width: 20%;
}

.tabcontent {
    display: none;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-top: none;
}

td a:hover,
p a:hover {
    background-color: var(--accent-light);
}

/* ===== Modal ===== */
.modal-header {
    background: var(--navy);
    color: var(--white);
    border-bottom: 3px solid var(--accent);
    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(--accent); color: var(--white); }
.back-to-top:hover { background: var(--accent-hover); color: var(--white); }

/* ===== Loading overlay ===== */
#loading {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(13,27,42,.45);
    z-index: 1000;
}

#loadingcontent {
    display: table;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

#loadingspinner {
    display: table-cell;
    vertical-align: middle;
    width: 100%;
    text-align: center;
    font-size: larger;
    padding-top: 80px;
}

/* ===== Stat cards (dashboard) ===== */
.stat-card {
    border-left: 5px solid var(--accent);
    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(--accent);
    opacity: .85;
}

/* ===== 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(--accent-light); 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(--accent); 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(--accent); color: var(--white); }

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

/* ===== Caret (expand/collapse arrow) ===== */
.caret {
    cursor: pointer;
    user-select: none;
}

.caret::before {
    content: "\25B6";
    color: var(--navy);
    display: inline-block;
    margin-right: 4%;
    border: none;
}

.caret-down::before {
    transform: rotate(90deg);
}
