/* Arivance Platform Styles — uses CSS variables from themes.css */

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
}

/* ── Navbar ── */
.navbar {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    box-shadow: var(--navbar-shadow);
    background: var(--navbar-bg) !important;
}

.navbar-brand {
    padding: 0;
    margin-right: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--navbar-text) !important;
}

.navbar .nav-link {
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.2px;
    padding: 0.35rem 0.5rem !important;
    border-radius: 5px;
    transition: background 0.15s ease;
    color: var(--navbar-link) !important;
    white-space: nowrap;
}

.navbar .nav-link:hover:not(.active) {
    background: var(--navbar-link-hover);
}

.navbar .nav-link.active {
    background: var(--navbar-link-active);
    font-weight: 600;
}

.navbar .badge {
    background: var(--navbar-badge-bg) !important;
    color: var(--navbar-badge-text) !important;
}

/* Dashboard Cards */
.stat-card {
    border: none;
    border-radius: 12px;
    background: var(--bg-card);
    box-shadow: var(--card-shadow);
    transition: transform 0.2s;
}

.stat-card:hover,
.dash-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.dash-link {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-card .stat-label {
    color: var(--stat-label);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tables */
.table th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom-width: 2px;
    border-color: var(--table-border);
}

.table td {
    border-color: var(--table-border);
    color: var(--text-primary);
}

/* Inline rate inputs in tables — use theme var so text matches surrounding cells */
.rate-input, .table .form-control-sm.border-0 {
    background: transparent !important;
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    font-weight: 600;
    font-size: 0.9rem;
}
.rate-input:hover, .table .form-control-sm.border-0:hover {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
}
.rate-input:focus, .table .form-control-sm.border-0:focus {
    background: var(--bg-input) !important;
    border: 1px solid var(--accent-primary) !important;
}
/* Hide spin buttons */
.rate-input::-webkit-outer-spin-button,
.rate-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.rate-input { -moz-appearance: textfield; }

/* Make table text bold weight for readability */
.assignments-table tbody td {
    color: var(--text-primary);
    font-weight: 500;
}
.assignments-table tbody tr td a {
    color: var(--accent-primary);
    font-weight: 600;
    text-decoration: none;
}
.assignments-table tbody tr td a:hover {
    text-decoration: underline;
}

.table-hover tbody tr:hover {
    background-color: var(--bg-table-hover);
}

/* Status badges */
.badge-draft { background-color: #6c757d; }
.badge-submitted { background-color: var(--accent-primary); }
.badge-approved { background-color: var(--accent-success); }
.badge-processed { background-color: #6f42c1; }
.badge-rejected { background-color: var(--accent-danger); }
/* Invoice status badges */
.badge-sent { background-color: var(--accent-primary); }
.badge-paid { background-color: var(--accent-success); }
.badge-void { background-color: var(--accent-danger); }

/* Remove number input spinners (up/down arrows) site-wide */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

/* Timesheet grid */
.timesheet-grid input {
    width: 80px;
    text-align: center;
}

.timesheet-grid th {
    text-align: center;
    min-width: 90px;
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    background: var(--bg-card);
    color: var(--text-primary);
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
    background: var(--bg-card-header);
    border-color: var(--border-light);
}

/* Forms */
.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Profit colors */
.profit-positive { color: var(--profit-positive); font-weight: 600; }
.profit-negative { color: var(--profit-negative); font-weight: 600; }

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h2 {
    margin: 0;
    font-weight: 700;
    color: var(--text-heading);
}

/* ── Compliance Document Management ── */
.compliance-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 12px 14px;
    text-align: center;
}
.compliance-stat-label {
    font-size: .7rem;
    font-weight: 600;
    color: var(--stat-label);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 4px;
}
.compliance-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--stat-value);
}
.compliance-progress-bar {
    background: var(--border-light);
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
}
.compliance-progress-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.4s ease;
}
/* Snapshot panel */
.snapshot-item:hover {
    background: #fff8e1;
}
.snapshot-item.snapshot-dragover {
    background: #e3f2fd !important;
    outline: 2px dashed var(--accent-primary);
    outline-offset: -2px;
}
.snapshot-item.snapshot-uploading {
    opacity: .6;
    pointer-events: none;
}
.snapshot-upload-btn:hover {
    background: var(--accent-primary) !important;
    color: #fff !important;
    border-color: var(--accent-primary) !important;
}
.snapshot-upload-btn:hover i { color: #fff !important; }
#snapshotPanel .card-body::-webkit-scrollbar { width: 4px; }
#snapshotPanel .card-body::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 2px; }

.compliance-item-summary:hover {
    background: var(--compliance-hover) !important;
}
.compliance-item-row .compliance-item-detail {
    animation: slideDown 0.15s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}
.compliance-dropzone:hover,
.compliance-dropzone.drag-over {
    border-color: var(--accent-primary) !important;
    background: rgba(13, 110, 253, 0.04);
}
.compliance-file-badge {
    color: var(--text-muted);
    font-size: .85rem;
    cursor: default;
}
.compliance-comment-bubble {
    background: var(--compliance-bubble-bg);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 4px;
    font-size: .78rem;
    border-left: 3px solid var(--compliance-bubble-border);
}
.compliance-comment-bubble .comment-meta {
    color: var(--text-secondary);
    font-size: .65rem;
    margin-top: 3px;
}
.doc-row:hover .doc-actions {
    opacity: 1 !important;
}
/* Drag-and-drop ghost */
.sortable-ghost {
    opacity: 0.4;
    background: #e8f0fe !important;
}
.drag-handle:hover {
    color: var(--accent-primary) !important;
}
/* Inline compliance inputs — force interactivity */
.compliance-date,
.compliance-status-select,
.compliance-verified-check {
    pointer-events: auto !important;
    position: relative !important;
    z-index: 5 !important;
}
.compliance-date {
    border: 1px solid var(--border-color) !important;
    border-radius: 4px !important;
    cursor: text !important;
    background: var(--bg-input) !important;
}
.compliance-status-select {
    cursor: pointer !important;
    -webkit-appearance: menulist !important;
    appearance: menulist !important;
}
.compliance-date:hover,
.compliance-status-select:hover {
    border-color: var(--accent-primary) !important;
}
.compliance-date:focus,
.compliance-status-select:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 2px rgba(13,110,253,.15) !important;
    z-index: 10 !important;
}
/* Attachment filename truncation */
.att-filename {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}
.compliance-att-row:hover {
    background: var(--bg-card-header) !important;
}
/* Document preview panel — pushes main content left */
.doc-preview-panel {
    position: fixed;
    top: 0;
    right: -40vw;
    width: 40vw;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    z-index: 1060;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}
.doc-preview-panel.open {
    right: 0;
}
.doc-preview-header {
    background: var(--bg-card-header);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.doc-preview-body {
    flex: 1;
    overflow: auto;
}
.doc-preview-body iframe,
.doc-preview-body img {
    width: 100%;
    height: 100%;
    border: none;
}
.doc-preview-body img {
    object-fit: contain;
    height: auto;
    max-height: 100%;
}
/* No overlay — let user interact with compliance data while previewing */
.doc-preview-overlay {
    display: none;
}
/* Push page content left when preview is open */
.preview-open {
    margin-right: 40vw !important;
    transition: margin-right 0.3s ease;
}
@media (max-width: 1200px) {
    .doc-preview-panel { width: 50vw; right: -50vw; }
    .preview-open { margin-right: 50vw !important; }
}
@media (max-width: 992px) {
    .doc-preview-panel { width: 70vw; right: -70vw; }
    .preview-open { margin-right: 70vw !important; }
}
.compliance-remove-row-btn:hover {
    color: var(--accent-danger) !important;
}
.compliance-inline-drop {
    border-radius: 6px;
    transition: background .15s;
    padding: 4px;
}
.compliance-inline-drop:hover {
    background: #e8f0fe;
}

/* ── Theme picker ── */
.theme-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.15s;
    display: inline-block;
}
.theme-swatch:hover {
    transform: scale(1.2);
}
.theme-swatch.active {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-primary);
}

/* ── Sidebar layout ── */
.sidebar {
    position: fixed;
    top: 0;
    width: 240px;
    height: 100vh;
    background: var(--navbar-bg);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: var(--navbar-shadow);
}
.sidebar-left { left: 0; }
.sidebar-right { right: 0; }
.sidebar-brand {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand a {
    color: var(--navbar-text);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-decoration: none;
}
.sidebar-nav {
    flex: 1;
    padding: .5rem 0;
    overflow-y: auto;
}
.sidebar .nav-link {
    display: block;
    padding: .5rem 1.25rem;
    color: var(--navbar-link);
    font-size: .85rem;
    font-weight: 500;
    border-radius: 0;
    transition: background 0.15s;
    text-decoration: none;
}
.sidebar .nav-link:hover {
    background: var(--navbar-link-hover);
    color: var(--navbar-text);
}
.sidebar .nav-link.active {
    background: var(--navbar-link-active);
    font-weight: 600;
    color: var(--navbar-text);
}
.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    margin-right: 8px;
}
.sidebar .badge {
    background: var(--navbar-badge-bg);
    color: var(--navbar-badge-text);
    font-size: .6rem;
    margin-left: 4px;
}
.sidebar-user {
    border-top: 1px solid rgba(255,255,255,.1);
    padding: .75rem 1.25rem;
}
.sidebar-user .nav-link {
    color: var(--navbar-link);
    font-size: .85rem;
    padding: .25rem 0;
    text-decoration: none;
}
.sidebar-user .dropdown-menu {
    min-width: 220px;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

/* Layout margin offsets */
body[data-layout="left"] .main-content { margin-left: 240px; }
body[data-layout="right"] .main-content { margin-right: 240px; }

/* Layout picker button styles */
.layout-option {
    cursor: pointer;
    padding: .2rem .5rem;
}

@media (max-width: 991.98px) {
    .sidebar { display: none; }
    body[data-layout="left"] .main-content,
    body[data-layout="right"] .main-content { margin-left: 0; margin-right: 0; }
}

/* ── Super Admin Standalone Layout ──────────────── */
.sa-standalone { margin: 0; padding: 0; }
.sa-standalone .main-content { display: none; }

.sa-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
    padding: 0 1rem;
    background: var(--bg-card-header, #1a1a2e);
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,.1));
    position: sticky;
    top: 0;
    z-index: 1030;
}
.sa-topbar-brand {
    font-weight: 600;
    font-size: .9rem;
    color: var(--accent-primary, #4a9eff);
}
.sa-topbar-right { display: flex; align-items: center; gap: 1rem; }
.sa-topbar-link {
    color: var(--text-muted, #999);
    text-decoration: none;
    font-size: .82rem;
    transition: color .15s;
}
.sa-topbar-link:hover { color: var(--text-primary, #fff); }
.sa-flash-area { padding: .5rem 1rem 0; }

.sa-layout {
    display: flex;
    min-height: calc(100vh - 44px);
}

/* ── Sidebar container ── */
.sa-subnav {
    width: 260px;
    min-width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 44px);
    position: sticky;
    top: 70px;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb, #ccc) transparent;
}
.sa-subnav::-webkit-scrollbar { width: 5px; }
.sa-subnav::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb, #ccc);
    border-radius: 3px;
}
.sa-subnav::-webkit-scrollbar-track { background: transparent; }

.sa-subnav-header {
    padding: 1rem 1.2rem;
    font-weight: 700;
    font-size: .95rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: .5rem;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 2;
}

.sa-subnav-nav {
    display: flex;
    flex-direction: column;
    padding: .35rem 0 1rem;
}

/* ── Section header (collapsible trigger) ── */
.sa-subnav-section {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1rem .55rem 1.1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: .84rem;
    font-weight: 600;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    cursor: pointer;
    user-select: none;
}
.sa-subnav-section > i:first-child {
    font-size: .95rem;
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}
.sa-subnav-section > span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sa-subnav-section:hover {
    background: var(--bg-body);
    color: var(--text-primary);
    text-decoration: none;
}
.sa-subnav-section.active {
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
}

/* Chevron icon + rotation */
.sa-subnav-chevron {
    font-size: .65rem;
    margin-left: auto;
    transition: transform .25s ease;
    flex-shrink: 0;
    opacity: .5;
}
.sa-subnav-section[aria-expanded="true"] .sa-subnav-chevron {
    transform: rotate(180deg);
}

/* ── Collapsible children container ── */
.sa-subnav-children {
    display: flex;
    flex-direction: column;
    padding: .1rem 0 .3rem;
}

/* ── Individual child link ── */
.sa-subnav-child {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem 1rem .4rem 2.6rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: .8rem;
    font-weight: 400;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sa-subnav-child:hover {
    background: var(--bg-body);
    color: var(--text-primary);
    text-decoration: none;
}
.sa-subnav-child.active {
    background: var(--bg-body);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
    font-weight: 600;
}

/* ── Coming-soon placeholder child ── */
.sa-subnav-child.coming-soon {
    color: var(--text-muted);
    cursor: default;
    opacity: .6;
}
.sa-subnav-child.coming-soon:hover {
    background: transparent;
    color: var(--text-muted);
}
.sa-badge-soon {
    display: inline-block;
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .1rem .4rem;
    border-radius: 3px;
    background: var(--bg-card-header);
    color: var(--text-muted);
    margin-left: auto;
    flex-shrink: 0;
    line-height: 1.3;
}

/* ── Main content area ── */
.sa-content {
    flex: 1;
    padding: 1.5rem;
    overflow-x: auto;
    min-width: 0;
}

/* ── Bootstrap collapse transition override for smoother expand ── */
.sa-subnav .collapse {
    transition: height .25s ease;
}
.sa-subnav .collapsing {
    transition: height .25s ease;
}

/* ── Mobile responsive ── */
@media (max-width: 991.98px) {
    .sa-subnav {
        width: 220px;
        min-width: 220px;
    }
    .sa-subnav-section { font-size: .8rem; padding-left: .8rem; }
    .sa-subnav-child { padding-left: 2.2rem; font-size: .78rem; }
}
@media (max-width: 767.98px) {
    .sa-layout { flex-direction: column; }
    .sa-subnav {
        width: 100%;
        min-width: 100%;
        max-height: none;
        position: static;
        overflow-y: visible;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .sa-subnav-header { position: static; }
    .sa-subnav-section {
        border-left: none;
        border-bottom: 2px solid transparent;
    }
    .sa-subnav-section.active {
        border-left-color: transparent;
        border-bottom-color: var(--accent-primary);
    }
    .sa-subnav-child {
        border-left: none;
        padding-left: 2.8rem;
    }
    .sa-subnav-child.active {
        border-left-color: transparent;
    }
}
