/* ========================================
   MedTrack Pro — Tax Report Styles
   ======================================== */

.report-page {
    background: var(--bg-body, #f8fafc);
    padding: 32px;
}

body.dark-mode .report-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

/* Action bar (hidden when printing) */
.report-actions {
    max-width: 900px;
    margin: 0 auto 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.report-actions a {
    text-decoration: none;
}

/* Report sheet (the printable area) */
.report-sheet {
    max-width: 900px;
    margin: 0 auto;
    background: var(--report-card-bg, white);
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    padding: 48px 56px;
    border: 1px solid var(--report-border, #e2e8f0);
    color: var(--report-text, #334155);
    transition: var(--transition);
}

body.dark-mode .report-sheet {
    --report-card-bg: #1e293b;
    --report-border: #334155;
    --report-text: #cbd5e1;
}

/* Header */
.report-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid #0d9488;
}

.report-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.125rem;
    font-weight: 700;
    color: #0d9488;
}

.report-logo i {
    font-size: 1.5rem;
}

.report-title h1 {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--report-title, #0f172a);
    margin: 0;
    text-align: right;
    line-height: 1.2;
}

body.dark-mode .report-title h1 {
    --report-title: #f1f5f9;
}

.report-year {
    font-size: 1.125rem;
    color: var(--report-muted, #64748b);
    margin: 6px 0 0;
    text-align: right;
    font-weight: 500;
}

.report-year span {
    color: #0d9488;
    font-weight: 700;
}

/* Sections */
.report-section {
    margin-bottom: 32px;
}

.report-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--report-title, #0f172a);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--report-border, #e2e8f0);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

body.dark-mode .report-section-title {
    color: #f1f5f9;
}

/* Taxpayer Info */
.taxpayer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 32px;
}

.taxpayer-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--report-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.field-line {
    height: 36px;
    border-bottom: 1px solid #cbd5e1;
    background: var(--report-field-bg, #f8fafc);
    border-radius: 4px 4px 0 0;
    transition: background 0.2s;
}

body.dark-mode .field-line {
    --report-field-bg: #0f172a;
    background: var(--report-field-bg);
}

.field-line:hover {
    background: #f1f5f9;
}

body.dark-mode .field-line:hover {
    background: #1e293b;
}

/* Summary */
.summary-section {
    background: var(--report-summary-bg, #f0fdfa);
    border: 1px solid var(--report-summary-border, #ccfbf1);
    border-radius: 10px;
    padding: 20px 24px;
}

body.dark-mode .summary-section {
    --report-summary-bg: rgba(13, 148, 136, 0.1);
    --report-summary-border: rgba(13, 148, 136, 0.3);
}

.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.report-summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

/* Color-coded report summary items */
.report-summary-total {
    border-left: 4px solid #0d9488;
}

.report-summary-total:hover {
    background: rgba(13, 148, 136, 0.08);
}

body.dark-mode .report-summary-total:hover {
    background: rgba(94, 234, 212, 0.1);
}

.report-summary-insurance {
    border-left: 4px solid #0284c7;
}

.report-summary-insurance:hover {
    background: rgba(2, 132, 199, 0.08);
}

body.dark-mode .report-summary-insurance:hover {
    background: rgba(56, 189, 248, 0.1);
}

.report-summary-net {
    border-left: 4px solid #10b981;
}

.report-summary-net:hover {
    background: rgba(16, 163, 74, 0.08);
}

body.dark-mode .report-summary-net:hover {
    background: rgba(74, 222, 128, 0.1);
}

.report-summary-entries {
    border-left: 4px solid #8b5cf6;
}

.report-summary-entries:hover {
    background: rgba(139, 92, 246, 0.08);
}

body.dark-mode .report-summary-entries:hover {
    background: rgba(167, 139, 250, 0.1);
}

.report-summary-dates {
    border-left: 4px solid #f59e0b;
}

.report-summary-dates:hover {
    background: rgba(245, 158, 11, 0.08);
}

body.dark-mode .report-summary-dates:hover {
    background: rgba(251, 191, 36, 0.1);
}

.report-summary-largest {
    border-left: 4px solid #ef4444;
}

.report-summary-largest:hover {
    background: rgba(239, 68, 68, 0.08);
}

body.dark-mode .report-summary-largest:hover {
    background: rgba(248, 113, 113, 0.1);
}

body.dark-mode .report-summary-total {
    border-left-color: #5eead4;
}

body.dark-mode .report-summary-insurance {
    border-left-color: #38bdf8;
}

body.dark-mode .report-summary-net {
    border-left-color: #4ade80;
}

body.dark-mode .report-summary-entries {
    border-left-color: #a78bfa;
}

body.dark-mode .report-summary-dates {
    border-left-color: #fbbf24;
}

body.dark-mode .report-summary-largest {
    border-left-color: #f87171;
}

/* Report summary icons */
.report-summary-label i {
    margin-right: 6px;
    font-size: 0.8125rem;
    opacity: 0.85;
}

.report-summary-total .report-summary-label i {
    color: #0d9488;
}

body.dark-mode .report-summary-total .report-summary-label i {
    color: #5eead4;
}

.report-summary-insurance .report-summary-label i {
    color: #0284c7;
}

body.dark-mode .report-summary-insurance .report-summary-label i {
    color: #38bdf8;
}

.report-summary-net .report-summary-label i {
    color: #10b981;
}

body.dark-mode .report-summary-net .report-summary-label i {
    color: #4ade80;
}

.report-summary-entries .report-summary-label i {
    color: #8b5cf6;
}

body.dark-mode .report-summary-entries .report-summary-label i {
    color: #a78bfa;
}

.report-summary-dates .report-summary-label i {
    color: #f59e0b;
}

body.dark-mode .report-summary-dates .report-summary-label i {
    color: #fbbf24;
}

.report-summary-largest .report-summary-label i {
    color: #ef4444;
}

body.dark-mode .report-summary-largest .report-summary-label i {
    color: #f87171;
}

.report-summary-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

body.dark-mode .report-summary-label {
    color: #94a3b8;
}

.report-summary-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--report-title, #0f172a);
}

body.dark-mode .report-summary-value {
    color: #f1f5f9;
}

/* Tables */
.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-top: 8px;
}

.report-table thead th {
    background: var(--report-thead-bg, #f8fafc);
    padding: 10px 12px;
    font-weight: 600;
    color: var(--report-muted, #475569);
    text-align: left;
    border-top: 2px solid #0d9488;
    border-bottom: 2px solid #0d9488;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

body.dark-mode .report-table thead th {
    --report-thead-bg: #1e293b;
    background: var(--report-thead-bg);
    color: #e2e8f0;
}

.report-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--report-border, #e2e8f0);
    color: var(--report-text, #334155);
    vertical-align: top;
}

body.dark-mode .report-table tbody td {
    --report-border: #334155;
    color: #cbd5e1;
}

.report-table tbody tr:nth-child(even) {
    background: var(--report-row-alt, #f8fafc);
}

body.dark-mode .report-table tbody tr:nth-child(even) {
    --report-row-alt: #1e293b;
    background: var(--report-row-alt);
}

.report-table tfoot td {
    padding: 12px;
    border-top: 2px solid #0d9488;
    border-bottom: 2px solid #0d9488;
    background: var(--report-tfoot-bg, #f0fdfa);
    color: var(--report-title, #0f172a);
}

body.dark-mode .report-table tfoot td {
    --report-tfoot-bg: rgba(13, 148, 136, 0.1);
    background: var(--report-tfoot-bg);
    color: #f1f5f9;
}

.report-table .text-right {
    text-align: right !important;
}

.report-table .amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.report-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.report-category-badge i {
    font-size: 0.75rem;
    width: 16px;
    text-align: center;
}

/* Category table specific */
.category-table tbody td:nth-child(2),
.category-table tbody td:nth-child(3),
.category-table tbody td:nth-child(4),
.category-table tbody td:nth-child(5) {
    font-variant-numeric: tabular-nums;
}

/* Insurance status badges in the report */
.report-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.report-status-badge.report-status-submitted { background: rgba(2, 132, 199, 0.12); color: #0284c7; }
.report-status-badge.report-status-pending   { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.report-status-badge.report-status-approved  { background: rgba(16, 185, 129, 0.14); color: #047857; }
.report-status-badge.report-status-denied    { background: rgba(239, 68, 68, 0.12);  color: #b91c1c; }
.report-status-badge.report-status-na        { background: rgba(100, 116, 139, 0.14); color: #475569; }

body.dark-mode .report-status-badge.report-status-submitted { background: rgba(56, 189, 248, 0.16); color: #38bdf8; }
body.dark-mode .report-status-badge.report-status-pending   { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
body.dark-mode .report-status-badge.report-status-approved  { background: rgba(16, 185, 129, 0.20); color: #34d399; }
body.dark-mode .report-status-badge.report-status-denied    { background: rgba(248, 113, 113, 0.18); color: #f87171; }
body.dark-mode .report-status-badge.report-status-na        { background: rgba(148, 163, 184, 0.20); color: #94a3b8; }

/* Insurance Status Summary strip */
.report-status-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.report-status-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--report-border, #e2e8f0);
    border-radius: 10px;
    background: var(--report-card-bg, #ffffff);
    font-size: 0.8125rem;
}

.report-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.report-status-dot.dot-submitted { background: #0284c7; }
.report-status-dot.dot-pending   { background: #f59e0b; }
.report-status-dot.dot-approved  { background: #10b981; }
.report-status-dot.dot-denied    { background: #ef4444; }

.report-status-name {
    font-weight: 600;
    color: var(--report-title, #0f172a);
}

body.dark-mode .report-status-name {
    color: #f1f5f9;
}

.report-status-count {
    font-weight: 700;
    color: var(--report-title, #0f172a);
    min-width: 1.75em;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

body.dark-mode .report-status-count {
    color: #f1f5f9;
}

/* Signature */
.signature-section {
    margin-top: 48px;
    page-break-inside: avoid;
}

.signature-block {
    max-width: 360px;
    margin-bottom: 16px;
}

.signature-line {
    height: 48px;
    border-bottom: 1px solid #334155;
    margin-bottom: 6px;
}

.signature-block label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--report-muted, #64748b);
}

body.dark-mode .signature-block label {
    color: #94a3b8;
}

.report-disclaimer {
    font-size: 0.8125rem;
    color: var(--report-muted, #64748b);
    line-height: 1.6;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--report-border, #e2e8f0);
}

body.dark-mode .report-disclaimer {
    color: #94a3b8;
}

/* Footer */
.report-footer {
    margin-top: 40px;
    padding-top: 16px;
    border-top: 1px solid var(--report-border, #e2e8f0);
    text-align: center;
}

.report-footer p {
    font-size: 0.75rem;
    color: var(--report-muted, #94a3b8);
    margin-bottom: 4px;
}

body.dark-mode .report-footer p {
    color: #94a3b8;
}

.report-note {
    font-style: italic;
}

.report-footer .report-warning {
    font-size: 0.8125rem;
    color: var(--danger, #dc2626);
    font-weight: 600;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--danger-subtle, #fef2f2);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

body.dark-mode .report-footer .report-warning {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.report-footer .report-warning i {
    font-size: 1rem;
}

.last-export-time {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--report-muted, #94a3b8);
    margin-left: 4px;
}

body.dark-mode .last-export-time {
    color: #94a3b8;
}

/* Dark mode toggle in report */
body.dark-mode .report-actions {
    --card-bg: #1e293b;
    --border-color: #334155;
    --text-secondary: #cbd5e1;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .report-page {
        padding: 16px;
    }

    .report-sheet {
        padding: 24px;
    }

    .report-header {
        flex-direction: column;
        gap: 12px;
    }

    .report-title h1 {
        text-align: left;
        font-size: 1.25rem;
    }

    .report-year {
        text-align: left;
    }

    .taxpayer-grid {
        grid-template-columns: 1fr;
    }

    .report-summary-grid {
        grid-template-columns: 1fr;
    }

    .report-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Empty state */
.report-empty {
    text-align: center;
    color: var(--gray-400);
    padding: 24px;
}

body.dark-mode .report-empty {
    color: #94a3b8;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    @page {
        margin: 0.6in 0.75in;
        size: auto;
    }

    body {
        background: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .report-actions {
        display: none !important;
    }

    .report-page {
        padding: 0;
    }

    .report-sheet {
        box-shadow: none;
        border: none;
        border-radius: 0;
        max-width: none;
        padding: 0;
    }

    .report-section {
        page-break-inside: avoid;
    }

    .report-table {
        page-break-inside: auto;
    }

    .report-table thead {
        display: table-header-group;
    }

    .report-table tbody tr {
        page-break-inside: avoid;
    }

    .report-table tfoot {
        display: table-footer-group;
    }

    .signature-section {
        page-break-inside: avoid;
    }

    .field-line {
        background: transparent !important;
    }

    .summary-section {
        background: #f0fdfa !important;
    }

    .report-table tbody tr:nth-child(even) {
        background: #f8fafc !important;
    }

    .report-table tfoot td {
        background: #f0fdfa !important;
    }

    .report-table thead th {
        background: #f8fafc !important;
    }
}
