/* =========================================================
   Zamars Admin Panel — AdminLTE overrides
   ========================================================= */
:root {
    --primary: #0175c2;
    --primary-dark: #02569b;
    --ink: #042b59;
    --accent: #13b9fd;
    --surface: #f4f7fb;
    --card: #ffffff;
    --border: #e2e8f0;
    --muted: #64748b;
    --success: #0d9f6e;
    --warning: #d97706;
    --danger: #dc2626;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(4, 43, 89, 0.08);
    --font-display: 'Syne', sans-serif;
    --font-body: 'Figtree', sans-serif;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--surface);
    color: var(--ink);
}

h1, h2, h3, h4, h5, .brand-text, .content-header h1 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

/* ----- Sidebar / Navbar brand ----- */
.main-sidebar {
    background: linear-gradient(180deg, var(--ink) 0%, #031f42 100%) !important;
    box-shadow: 4px 0 24px rgba(4, 43, 89, 0.15);
}

.brand-link {
    display: flex !important;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 0.9rem 1rem !important;
}

.brand-link .brand-image {
    width: 36px;
    height: 36px;
    border-radius: 8px !important;
    margin: 0 !important;
    box-shadow: none !important;
}

.brand-link .brand-text {
    color: #fff !important;
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark)) !important;
    box-shadow: 0 4px 12px rgba(1, 117, 194, 0.35);
    border-radius: 8px;
}

.nav-sidebar .nav-link {
    border-radius: 8px;
    margin: 2px 8px;
    color: rgba(255, 255, 255, 0.75) !important;
}

.nav-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
}

/* Treeview children: keep dark theme (AdminLTE default uses light bg + light text clash) */
.nav-sidebar .nav-treeview > .nav-item > .nav-link {
    color: rgba(255, 255, 255, 0.65) !important;
    background: transparent !important;
}

.nav-sidebar .nav-treeview > .nav-item > .nav-link:hover,
.nav-sidebar .nav-treeview > .nav-item > .nav-link:focus {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

.nav-sidebar .nav-treeview > .nav-item > .nav-link.active {
    background: rgba(1, 117, 194, 0.45) !important;
    color: #fff !important;
    box-shadow: none;
}

.nav-sidebar .nav-treeview > .nav-item > .nav-link.active .nav-icon,
.nav-sidebar .nav-treeview > .nav-item > .nav-link:hover .nav-icon {
    color: #fff !important;
}

.nav-sidebar .nav-header {
    color: var(--accent) !important;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 0.75rem;
}

.main-header.navbar {
    background: #fff !important;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(4, 43, 89, 0.04);
}

.navbar-badge, .badge-primary {
    background-color: var(--primary) !important;
}

.bg-primary, .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    border-color: var(--primary-dark) !important;
}

.btn-primary:hover, .btn-primary:focus {
    filter: brightness(1.05);
    box-shadow: 0 4px 14px rgba(1, 117, 194, 0.35);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.text-primary { color: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }

/* ----- Content ----- */
.content-wrapper {
    background: var(--surface) !important;
}

.content-header h1 {
    font-size: 1.65rem;
}

.breadcrumb-item.active {
    color: var(--muted);
}

/* ----- Cards ----- */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-display);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.card-title {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--ink);
    margin: 0;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--border);
}

/* Stat cards */
.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    color: #fff;
    padding: 1.25rem;
    min-height: 110px;
    box-shadow: var(--shadow);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 0.35rem;
}

.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    opacity: 0.25;
}

.stat-card.bg-ink {
    background: linear-gradient(135deg, var(--ink), var(--primary-dark));
}

.stat-card.bg-blue {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.stat-card.bg-accent {
    background: linear-gradient(135deg, var(--accent), var(--primary));
}

.stat-card.bg-teal {
    background: linear-gradient(135deg, #0d9f6e, #059669);
}

.stat-card.bg-amber {
    background: linear-gradient(135deg, #d97706, #b45309);
}

/* ----- Tables ----- */
.table {
    color: var(--ink);
}

.table thead th {
    border-top: none;
    border-bottom: 2px solid var(--border);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    font-weight: 600;
    white-space: nowrap;
}

.table-hover tbody tr:hover {
    background: rgba(1, 117, 194, 0.04);
}

.table td {
    vertical-align: middle !important;
}

/* ----- Badges ----- */
.badge {
    font-weight: 600;
    padding: 0.35em 0.65em;
    border-radius: 6px;
    font-size: 0.75rem;
}

.badge-success { background: var(--success) !important; }
.badge-warning { background: var(--warning) !important; color: #fff !important; }
.badge-danger { background: var(--danger) !important; }
.badge-info { background: var(--accent) !important; color: var(--ink) !important; }
.badge-primary { background: var(--primary) !important; }
.badge-secondary { background: #94a3b8 !important; }

/* ----- Forms ----- */
.form-control, .custom-select {
    border-radius: 8px;
    border-color: var(--border);
    font-size: 0.95rem;
}

.form-control:focus, .custom-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(19, 185, 253, 0.25);
}

.input-group-text {
    border-radius: 8px;
    border-color: var(--border);
    background: #f8fafc;
}

.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(4, 43, 89, 0.2);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    font-family: var(--font-display);
}

.modal-footer {
    border-top: 1px solid var(--border);
}

/* ----- Pagination ----- */
.card-footer .pagination {
    margin-bottom: 0;
    justify-content: flex-end;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    padding-left: 0;
    list-style: none;
    margin-bottom: 0;
}

.pagination .page-item {
    display: inline-block;
}

.pagination .page-link {
    position: relative;
    display: block;
    padding: 0.4rem 0.75rem;
    margin: 0 2px;
    line-height: 1.25;
    color: var(--primary);
    background-color: #fff;
    border: 1px solid var(--border);
    border-radius: 6px !important;
}

.pagination .page-item.active .page-link {
    z-index: 1;
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.pagination .page-item.disabled .page-link {
    color: var(--muted);
    pointer-events: none;
    background-color: #f8fafc;
    border-color: var(--border);
}

.pagination .page-link:hover {
    color: var(--primary-dark);
    background-color: #f1f5f9;
    border-color: var(--border);
    text-decoration: none;
}

/* ----- Global loader ----- */
#global-loader {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(4, 43, 89, 0.35);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
}

#global-loader.show {
    display: flex !important;
}

#global-loader .loader-inner {
    background: #fff;
    border-radius: 16px;
    padding: 1.75rem 2.25rem;
    box-shadow: var(--shadow);
    text-align: center;
}

#global-loader .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: zamars-spin 0.7s linear infinite;
    margin: 0 auto 0.75rem;
}

@keyframes zamars-spin {
    to { transform: rotate(360deg); }
}

/* ----- Login page ----- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(19, 185, 253, 0.25), transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(1, 117, 194, 0.35), transparent 55%),
        linear-gradient(160deg, var(--ink) 0%, var(--primary-dark) 45%, #013a6b 100%);
    padding: 1.5rem;
}

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

.login-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    padding: 2.25rem 2rem;
    overflow: hidden;
}

.login-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-brand img {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    margin-bottom: 0.75rem;
    box-shadow: 0 8px 24px rgba(1, 117, 194, 0.35);
}

.login-brand h1 {
    font-size: 1.75rem;
    margin: 0;
    color: var(--ink);
}

.login-brand p {
    color: var(--muted);
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
}

.login-card .form-group label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ink);
}

.login-card .btn-login {
    width: 100%;
    padding: 0.7rem;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 10px;
    margin-top: 0.5rem;
}

.login-error {
    display: none;
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.login-error.show {
    display: block;
}

.password-toggle {
    cursor: pointer;
    user-select: none;
}

/* ----- Activity feed ----- */
.activity-item {
    display: flex;
    gap: 0.85rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(1, 117, 194, 0.1);
    color: var(--primary);
    flex-shrink: 0;
}

.activity-body .activity-title {
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.activity-body .activity-desc {
    font-size: 0.85rem;
    color: var(--muted);
}

.activity-body .activity-time {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* ----- Filter bar ----- */
.filter-bar {
    background: #fff;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

/* ----- Misc ----- */
.btn-sm {
    border-radius: 6px;
}

.table-actions .btn {
    margin: 0 2px;
}

.page-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.helpdesk-thread .reply {
    background: #f8fafc;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--primary);
}

.helpdesk-thread .reply .meta {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

/* ----- Select2 ----- */
.select2-container--bootstrap4 .select2-selection {
    border-color: var(--border) !important;
    border-radius: 8px !important;
    min-height: calc(2.25rem + 2px);
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
    line-height: calc(2.25rem);
    color: var(--ink);
    padding-left: 0.75rem;
    padding-right: 2.25rem;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
    height: calc(2.25rem);
    right: 0.35rem;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__clear {
    position: absolute;
    right: 1.75rem;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    float: none;
    color: var(--muted);
    font-weight: 700;
    z-index: 2;
}

.select2-container--bootstrap4.select2-container--focus .select2-selection,
.select2-container--bootstrap4.select2-container--open .select2-selection {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.15rem rgba(1, 117, 194, 0.2);
}

.select2-container--bootstrap4 .select2-dropdown {
    border-color: var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    color: var(--ink);
}

.select2-container--bootstrap4 .select2-results__option {
    color: var(--ink);
}

.select2-container--bootstrap4 .select2-results__option--highlighted,
.select2-container--bootstrap4 .select2-results__option--highlighted[aria-selected],
.select2-container--bootstrap4 .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--primary) !important;
    color: #fff !important;
}

.select2-container--bootstrap4 .select2-results__option[aria-selected="true"] {
    background-color: rgba(1, 117, 194, 0.12);
    color: var(--ink);
}

.select2-container--bootstrap4 .select2-search--dropdown .select2-search__field {
    border-radius: 6px;
    border-color: var(--border);
    color: var(--ink);
}

.select2-container--bootstrap4 .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 0.15rem rgba(1, 117, 194, 0.15);
}

@media (max-width: 768px) {
    .stat-card .stat-value {
        font-size: 1.25rem;
    }

    .login-card {
        padding: 1.75rem 1.25rem;
    }

    .content-header h1 {
        font-size: 1.35rem;
    }
}

/* ----- Report tabs ----- */
.nav-tabs .nav-link {
    border-radius: 8px 8px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.nav-tabs .nav-link:hover {
    color: var(--primary);
    border-color: var(--border) var(--border) #fff;
    background: #f8fafc;
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    font-weight: 700;
    border-color: var(--border) var(--border) #fff;
    border-bottom: 3px solid var(--primary) !important;
    background: #fff;
}

.nav-tabs {
    border-bottom: 2px solid var(--border);
}
