/* ============================================
   Page-Specific Styles
   ============================================ */

/* ============================================
   Dashboard Page
   ============================================ */

.dashboard-page {
    max-width: 100%;
}

/* ============================================
   Invoice Detail Page
   ============================================ */

.invoice-detail-page {
    max-width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.invoice-detail-page .card-header {
    font-weight: 600;
    background-color: var(--ias-bg-muted);
}

/* Tab bar sits between header and content */
.invoice-detail-page .detail-tabs {
    flex-shrink: 0;
    border-bottom: 2px solid var(--ias-border, #dee2e6);
}

.invoice-detail-page .detail-tabs .nav-link {
    color: var(--ias-text-muted, #6c757d);
    font-weight: 500;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.625rem 1rem;
    transition: color 0.15s, border-color 0.15s;
}

.invoice-detail-page .detail-tabs .nav-link:hover {
    color: var(--ias-text, #212529);
    border-bottom-color: var(--ias-border, #dee2e6);
}

.invoice-detail-page .detail-tabs .nav-link.active {
    color: var(--ias-primary, #0d6efd);
    border-bottom-color: var(--ias-primary, #0d6efd);
    background: transparent;
}

/* Tab content fills remaining space */
.invoice-detail-page .detail-tab-content {
    flex: 1;
    min-height: 0;
    padding-top: 1rem;
    overflow-y: auto;
}

/* Row inside the invoice tab inherits flex sizing */
.invoice-detail-page .detail-tab-content > .row {
    flex: 1;
    min-height: 0;
    height: 100%;
}

/* Additional Infos Tab */
.additional-infos-tab {
    max-width: 960px;
    padding-bottom: 2rem;
}

.additional-infos-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.additional-info-card {
    background: var(--ias-bg, #fff);
    border: 1px solid var(--ias-border, #dee2e6);
    border-radius: 0.5rem;
    overflow: hidden;
}

.additional-info-card-header {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0.75rem 1rem;
    background: var(--ias-bg-muted, #f8f9fa);
    border-bottom: 1px solid var(--ias-border, #dee2e6);
}

.additional-info-card-body {
    padding: 1rem;
}

.additional-info-card-body p {
    margin: 0 0 0.5rem 0;
}

.additional-info-card-body p:last-child {
    margin-bottom: 0;
}

    .invoice-detail-page > .row {
        flex: 1;
        min-height: 0;
       
    }

/* Right panel (detail-sidebar) should scroll independently */
.invoice-detail-page .detail-sidebar {
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    padding-right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 24px;
}

/* Prevent detail cards from shrinking */
.invoice-detail-page .detail-sidebar .detail-card {
    flex-shrink: 0;
}

/* ============================================
   Invoice Edit Page (Admin)
   ============================================ */

.admin-page {
    max-width: 100%;
}

/* Make admin page content scrollable */
.admin-page > .row {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Sticky sidebar container for admin pages */
.admin-page .sidebar-sticky-container {
    position: sticky;
    top: 0;
}

/* ============================================
   Invoices Page
   ============================================ */

.invoices-page {
    max-width: 100%;
}

/* ============================================
   Settings Page Styles
   ============================================ */

.settings-page .settings-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* ============================================
   Help Page Styles
   ============================================ */

.help-page {
    --help-accent: var(--ias-primary);
    --help-accent-light: var(--ias-primary-light);
    --help-border: var(--ias-border);
    --help-text: var(--ias-text-primary);
    --help-text-muted: var(--ias-text-secondary);
}

/* Help page layout - content scrolls, TOC stays fixed */
.help-page .help-content-row {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.help-page .help-sections-container {
    height: 100%;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.help-page .help-nav {
    position: sticky;
    top: 0;
}

.help-page h1 {
    color: var(--help-text);
    font-weight: 600;
}

.help-page h1 i {
    color: var(--help-accent);
}

/* Help Section styling */
.help-section {
    background: var(--ias-bg-surface);
    border: 1px solid var(--help-border);
    border-radius: var(--ias-radius-lg);
    overflow: hidden;
    scroll-margin-top: 1rem;
}

.help-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--help-accent-light);
    border-bottom: 1px solid var(--help-border);
}

.help-section-header i {
    font-size: 1.25rem;
    color: var(--help-accent);
}

.help-section-header h5 {
    margin: 0;
    font-weight: 600;
    color: var(--help-text);
}

.help-section-body {
    padding: 1.25rem;
}

.help-section-body h6 {
    color: var(--help-text);
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--help-border);
}

.help-section-body h6:first-child {
    margin-top: 0;
}

/* Feature list */
.feature-list {
    list-style: none;
    padding-left: 0;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.feature-list li i {
    color: var(--help-accent);
    margin-top: 0.2rem;
}

/* Process list */
.process-list {
    padding-left: 1.25rem;
}

.process-list li {
    padding: 0.25rem 0;
}

/* ============================================
   Admin Area Styles
   ============================================ */

.admin-page .breadcrumb {
    font-size: 0.8125rem;
    margin-bottom: 0.25rem;
}

.admin-page .breadcrumb-item a {
    color: var(--ias-primary);
    text-decoration: none;
}

.admin-page .breadcrumb-item a:hover {
    text-decoration: underline;
}

/* ============================================
   Filter Collapse (Mobile)
   ============================================ */

@media (max-width: 767.98px) {
    .filter-collapse {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .filter-collapse.show {
        max-height: 500px;
    }
}

/* ============================================
   Invoices Page - Table Styles
   ============================================ */

.invoices-page .table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

.invoices-page .table-active {
    background-color: rgba(0, 123, 255, 0.1) !important;
}

/* ============================================
   Audit Logs Page
   ============================================ */

.audit-logs-page .card {
    border: 1px solid var(--ias-border);
    box-shadow: var(--ias-shadow-sm);
    background: var(--ias-bg-surface);
}

.audit-logs-page .table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ias-text-muted);
    border-top: none;
}

.audit-logs-page .badge {
    font-size: 0.75rem;
    font-weight: 500;
}

.audit-logs-page pre {
    font-size: 0.8rem;
    margin: 0;
}

.audit-logs-page code {
    font-size: 0.8rem;
}

/* ============================================
   User Edit Page
   ============================================ */

.user-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--ias-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ias-primary);
    font-size: 1.75rem;
    font-weight: 600;
}

/* ============================================
   Custom Table Row States
   (Theme-aware, works in light and dark mode)
   ============================================ */

.table tbody tr.row-danger {
    background-color: var(--ias-danger-light) !important;
}

.table tbody tr.row-info {
    background-color: var(--ias-info-light) !important;
}

.table tbody tr.row-muted {
    background-color: var(--ias-bg-muted) !important;
    color: var(--ias-text-muted);
}

.table tbody tr.row-success {
    background-color: var(--ias-success-light) !important;
}

.table tbody tr.row-warning {
    background-color: var(--ias-warning-light) !important;
}

/* ============================================
   Summary Timeline
   ============================================ */

.summary-tab {
    max-width: 860px;
    padding-top: 0.25rem;
    padding-bottom: 2rem;
}

/* The vertical line running down the left edge */
.tl {
    position: relative;
    padding-left: 2.5rem;
}

.tl::before {
    content: '';
    position: absolute;
    left: 0.9375rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--ias-border, #dee2e6);
}

/* Each row */
.tl-item {
    position: relative;
    padding-bottom: 1.25rem;
}

.tl-item:last-child {
    padding-bottom: 0;
}

/* The coloured dot sitting on the vertical line */
.tl-dot {
    position: absolute;
    left: -2.5rem;
    top: 0.125rem;
    width: 1.875rem;
    height: 1.875rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #fff;
    z-index: 1;
    box-shadow: 0 0 0 3px var(--ias-bg-body, #f1f5f9);
}

/* ?? kind colours ?? */
.tl-dot--created    { background: var(--ias-secondary, #455a64); }
.tl-dot--assigned   { background: var(--ias-info, #3b82f6); }
.tl-dot--approved   { background: var(--ias-success, #10b981); }
.tl-dot--final      { background: var(--ias-success-dark, #065f46); }
.tl-dot--rejected   { background: var(--ias-danger, #ef4444); }
.tl-dot--delegated  { background: var(--ias-warning, #f59e0b); }
.tl-dot--info       { background: #7c3aed; }
.tl-dot--costcentre { background: #0891b2; }
.tl-dot--unknown    { background: var(--ias-secondary, #455a64); }

/* The content card */
.tl-card {
    background: var(--ias-bg-surface, #fff);
    border: 1px solid var(--ias-border, #dee2e6);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    border-left: 3px solid transparent;
}

.tl-card--created   { border-left-color: var(--ias-secondary, #455a64); }
.tl-card--assigned  { border-left-color: var(--ias-info, #3b82f6); }
.tl-card--approved  { border-left-color: var(--ias-success, #10b981); }
.tl-card--final     { border-left-color: var(--ias-success-dark, #065f46);
                      background: var(--ias-success-light, #d1fae5); }
.tl-card--rejected  { border-left-color: var(--ias-danger, #ef4444);
                      background: var(--ias-danger-light, #fee2e2); }
.tl-card--delegated { border-left-color: var(--ias-warning, #f59e0b);
                      background: var(--ias-warning-light, #fef3c7); }
.tl-card--info      { border-left-color: #7c3aed;
                      background: #f5f3ff; }
.tl-card--costcentre { border-left-color: #0891b2;
                      background: #ecfeff; }
.tl-card--unknown   { border-left-color: var(--ias-secondary, #455a64); }

/* Card head: label + timestamp */
.tl-card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.125rem;
}

.tl-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--ias-text, #212529);
}

.tl-time {
    font-size: 0.75rem;
    color: var(--ias-text-muted, #6c757d);
    white-space: nowrap;
}

/* User row */
.tl-user {
    font-size: 0.8125rem;
    color: var(--ias-text-muted, #6c757d);
    margin-bottom: 0.25rem;
}

/* Comment / rich-text body */
.tl-body {
    font-size: 0.875rem;
    color: var(--ias-text, #212529);
    padding-top: 0.375rem;
    margin-top: 0.375rem;
    border-top: 1px solid var(--ias-border, #dee2e6);
}

.tl-body p {
    margin: 0 0 0.25rem 0;
}

.tl-body p:last-child {
    margin-bottom: 0;
}

/* Dark mode overrides for tinted cards */
[data-theme="dark"] .tl-card--final   { background: rgba(16, 185, 129, 0.10); }
[data-theme="dark"] .tl-card--rejected { background: rgba(239, 68, 68, 0.10); }
[data-theme="dark"] .tl-card--delegated { background: rgba(245, 158, 11, 0.10); }
[data-theme="dark"] .tl-card--info     { background: rgba(124, 58, 237, 0.10); }
[data-theme="dark"] .tl-card--costcentre { background: rgba(8, 145, 178, 0.10); }
[data-theme="dark"] .tl-dot            { box-shadow: 0 0 0 3px var(--ias-bg-body, #0f172a); }
