/* ============================================
   Layout: Sidebar + Top Bar
   ============================================ */

:root {
    --sidebar-width: 250px;
    --topbar-height: 56px;
    --sidebar-bg: #fff;
    --sidebar-text: #495057;
    --sidebar-hover: #f0f4f8;
    --sidebar-active-bg: #2fa4e7;
    --sidebar-active-text: #fff;
    --sidebar-heading: #adb5bd;
    --topbar-bg: #2fa4e7;
    --content-bg: #f5f8fb;
}

body {
    background: var(--content-bg);
    min-height: 100vh;
}

/* Top bar */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--topbar-bg);
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.topbar .brand {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    margin-right: auto;
}
.topbar .brand:hover {
    color: #fff;
}
.topbar .topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}
.topbar .topbar-right .tax-year-badge {
    background: rgba(255,255,255,.2);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}
.topbar .topbar-right a {
    color: rgba(255,255,255,.8);
    text-decoration: none;
    font-size: 0.85rem;
}
.topbar .topbar-right a:hover {
    color: #fff;
}
.topbar .topbar-right .dropdown-menu a {
    color: #212529;
    font-size: 0.875rem;
}
.topbar .topbar-right .dropdown-menu a:hover {
    color: #212529;
    background: #f0f4f8;
}

/* Sidebar toggle button */
.sidebar-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px 8px;
    margin-right: 12px;
    border-radius: 4px;
}
.sidebar-toggle:hover {
    background: rgba(255,255,255,.15);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    overflow-y: auto;
    z-index: 1020;
    transition: transform 0.3s ease;
    padding-top: 10px;
    padding-bottom: 40px;
    border-right: 1px solid #e9ecef;
}
.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.1);
    border-radius: 2px;
}

/* Sidebar nav */
.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-nav .nav-heading {
    color: #6c757d;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 10px 20px;
    margin: 0;
    background: #f0f2f5;
    border-top: 1px solid #e2e6ea;
    border-bottom: 1px solid #e2e6ea;
}
.sidebar-nav .nav-heading:first-child {
    border-top: none;
}
.sidebar-nav .nav-link {
    display: block;
    padding: 9px 20px 9px 36px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}
.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #2fa4e7;
    font-weight: 700;
}
.sidebar-nav .nav-link.active {
    color: var(--sidebar-active-text);
    font-weight: 700;
    border-left: 16px solid #d0d4d9;
    background: var(--sidebar-active-bg);
    margin-right: 18px;
    padding-left: 28px;
    position: relative;
}
.sidebar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    right: -18px;
    top: 0;
    bottom: 0;
    width: 18px;
    border-top: 19px solid transparent;
    border-bottom: 19px solid transparent;
    border-left: 18px solid var(--sidebar-active-bg);
    border-radius: 0 4px 4px 0;
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 24px 30px;
    min-height: calc(100vh - var(--topbar-height));

}

/* Page title */
.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1c2434;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

/* Cards */
.card-style {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    border: 1px solid #e9ecef;
}
.card-style h6 {
    font-weight: 600;
    margin-bottom: 12px;
    color: #1c2434;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}
.table th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    border-bottom-width: 2px;
}
.table td {
    vertical-align: top;
    font-size: 0.9rem;
}

/* Action buttons in tables */
.btn-action {
    padding: 4px 10px;
    font-size: 0.78rem;
    border-radius: 4px;
}

/* Step number circles */
.step-number {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 50%;
    background-color: var(--sidebar-active-bg);
    color: #fff;
    font-weight: bold;
    font-size: 0.85em;
    margin-right: 6px;
}

/* Process/Upload cards */
.card.card-body {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    margin-bottom: 1rem;
}

/* Drop zone */
.dropzone {
    border: 2px dashed #adb5bd;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    background: #f8f9fa;
    margin-bottom: 15px;
}
.dropzone:hover {
    border-color: var(--sidebar-active-bg);
    background: #e8f0fe;
}
.dropzone.dragover {
    border-color: var(--sidebar-active-bg);
    background: #d4e5fd;
}
.dropzone.has-file {
    border-color: #198754;
    background: #d1e7dd;
}
.dropzone .dropzone-icon {
    font-size: 2rem;
    color: #6c757d;
    margin-bottom: 8px;
}
.dropzone.has-file .dropzone-icon {
    color: #198754;
}
.dropzone .dropzone-text {
    color: #6c757d;
    font-size: 0.95rem;
}
.dropzone.has-file .dropzone-text {
    color: #198754;
    font-weight: bold;
}
.dropzone .dropzone-hint {
    color: #adb5bd;
    font-size: 0.8rem;
    margin-top: 4px;
}

/* Alerts */
.alert-info {
    font-size: 0.9em;
    padding: 0.5rem 0.75rem;
}

/* Print */
.pagebreak {
    page-break-before: always;
}
.no-print {
    /* visible on screen */
}
.print-only {
    display: none;
}
@media print {
    .topbar, .sidebar, .sidebar-overlay, .no-print {
        display: none !important;
    }
    .print-only {
        display: block !important;
    }
    .main-content {
        margin-left: 0 !important;
        margin-top: 0 !important;
        padding: 0 !important;
    }
    .page-title {
        display: none;
    }
    .card-style {
        box-shadow: none;
        border: 1px solid #ccc;
        padding: 8px 12px;
        margin-bottom: 8px;
        break-inside: avoid;
    }
    .card-style h6 {
        margin-bottom: 4px;
        font-size: 9pt;
    }
    .row.mb-4 .card-style {
        border: none;
        padding: 4px 8px;
    }
    .row.mb-4 {
        margin-bottom: 4px !important;
    }
    .mb-4 {
        margin-bottom: 8px !important;
    }
    .mb-3 {
        margin-bottom: 4px !important;
    }
    body {
        background: #fff;
        font-size: 9pt;
    }
    .table {
        font-size: 8pt;
    }
    .table td, .table th {
        padding: 2px 6px;
    }
    .text-muted {
        color: #555 !important;
    }
    a {
        text-decoration: none;
        color: inherit;
    }
    .collapse:not(.show) {
        display: none !important;
    }
    .collapse.show {
        display: block !important;
        height: auto !important;
    }
    /* Hide entire nonbusiness card if section is collapsed */
    #nonbusiness-card:has(.collapse:not(.show)) {
        display: none !important;
    }
    /* Summary cards - compact */
    .print-summary-value {
        font-size: 12pt !important;
    }
    .print-header {
        text-align: center;
        margin-bottom: 8px;
        padding-bottom: 6px;
        border-bottom: 2px solid #333;
    }
    .print-header h2 {
        margin: 0;
        font-size: 14pt;
    }
    .print-header p {
        margin: 2px 0 0;
        font-size: 8pt;
        color: #555;
    }
    /* Total row in tables */
    .table strong {
        font-size: inherit !important;
    }
    /* Force two-column layout in print */
    .row {
        display: flex !important;
        flex-wrap: nowrap !important;
    }
    .col-lg-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
    .col-md-4 {
        flex: 0 0 33.333% !important;
        max-width: 33.333% !important;
    }
}

/* Sidebar collapsed state */
body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}
body.sidebar-collapsed .main-content {
    margin-left: 0;
}

/* Mobile */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,.4);
        z-index: 1015;
    }
    .sidebar-overlay.show {
        display: block;
    }
}
