/* CSS Style for HAMEC Transactional Financial Dashboard */
/* Color Palette & Tokens */
:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #131929;
    --bg-card: rgba(22, 30, 53, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --color-teal: #0d9488;
    --color-teal-glow: rgba(13, 148, 136, 0.15);
    --color-emerald: #059669;
    --color-emerald-glow: rgba(5, 150, 105, 0.15);
    --color-blue: #2563eb;
    --color-blue-glow: rgba(37, 99, 235, 0.15);
    --color-orange: #ea580c;
    --color-orange-glow: rgba(234, 88, 12, 0.15);
    --color-red: #dc2626;
    --color-red-glow: rgba(220, 38, 38, 0.1);
    
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --blur-glass: 12px;
}

/* Print CSS Adjustment */
@media print {
    .sidebar, .top-header, .filter-toolbar, .btn-print, .pagination-container, .ledger-filters {
        display: none !important;
    }
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    .table-card {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        width: 100% !important;
    }
    .pnl-table {
        color: #000 !important;
    }
    .pnl-table tr.total-row {
        background: #f3f4f6 !important;
    }
}

/* Reset & Basics */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Layout */
.sidebar {
    width: 260px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.brand-icon {
    font-size: 24px;
    color: var(--color-teal);
    text-shadow: 0 0 10px rgba(13, 148, 136, 0.5);
}

.brand-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.brand-text span {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    border-left: 3px solid var(--color-teal);
    background: rgba(13, 148, 136, 0.1);
}

.sidebar-footer {
    margin-top: auto;
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.6;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 16px;
}

/* Main Content Area */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 32px;
    max-width: 1400px;
}

/* Header & Filter Toolbar */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 20px;
}

.page-title h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-title p {
    font-size: 13px;
    color: var(--text-secondary);
}

.filter-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.filter-group select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    cursor: pointer;
    min-width: 120px;
}

.btn-refresh {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    height: 38px;
    display: flex;
    align-items: center;
}

.btn-refresh:hover {
    background: rgba(13, 148, 136, 0.2);
    color: #fff;
    border-color: var(--color-teal);
}

/* KPI Cards Layout */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.kpi-card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--blur-glass));
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-main);
    transition: transform 0.3s, box-shadow 0.3s;
}

.kpi-card:hover {
    transform: translateY(-4px);
}

.kpi-card.glow-teal:hover { box-shadow: 0 8px 30px var(--color-teal-glow); border-color: rgba(13, 148, 136, 0.3); }
.kpi-card.glow-emerald:hover { box-shadow: 0 8px 30px var(--color-emerald-glow); border-color: rgba(5, 150, 105, 0.3); }
.kpi-card.glow-blue:hover { box-shadow: 0 8px 30px var(--color-blue-glow); border-color: rgba(37, 99, 235, 0.3); }
.kpi-card.glow-orange:hover { box-shadow: 0 8px 30px var(--color-orange-glow); border-color: rgba(234, 88, 12, 0.3); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.card-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.icon-teal { background: rgba(13, 148, 136, 0.15); color: #2dd4bf; }
.icon-emerald { background: rgba(5, 150, 105, 0.15); color: #34d399; }
.icon-blue { background: rgba(37, 99, 235, 0.15); color: #60a5fa; }
.icon-orange { background: rgba(234, 88, 12, 0.15); color: #fb923c; }

.card-value {
    font-size: 24px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    margin-bottom: 4px;
}

.card-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

/* Tabs Panes Setup */
.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Charts Section */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

@media (max-width: 900px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--blur-glass));
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-main);
}

.chart-header {
    margin-bottom: 20px;
}

.chart-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-container.small-chart {
    height: 250px;
}

/* Tables Layout & Cards */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.table-card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--blur-glass));
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-main);
}

.table-card.full-width {
    grid-column: 1 / -1;
}

.table-card h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.table-card p.subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.table-container {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

th, td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--text-secondary);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.1);
}

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

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.txt-right { text-align: right; }
.txt-center { text-align: center; }

/* Ledger Auditing Controls */
.ledger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.ledger-filters {
    display: flex;
    gap: 12px;
    align-items: center;
}

.input-search {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    width: 300px;
    outline: none;
    font-family: inherit;
}

.input-search:focus {
    border-color: var(--color-teal);
}

.ledger-filters select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
}

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.pagination-info {
    font-size: 12px;
    color: var(--text-muted);
}

.pagination-buttons {
    display: flex;
    gap: 8px;
}

.btn-pagination {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-pagination:hover:not(:disabled) {
    background: rgba(13, 148, 136, 0.2);
    border-color: var(--color-teal);
}

.btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* P&L Layout Sheet Styles */
.pnl-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-print {
    background: var(--color-teal);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-print:hover {
    background: #0f766e;
}

.pnl-table th {
    font-size: 14px;
    padding: 14px 20px;
}

.pnl-table td {
    padding: 14px 20px;
    font-size: 13px;
}

/* Indentations for categories in P&L sheet */
.pnl-table tr.depth-1 td.indent {
    padding-left: 40px;
    color: var(--text-secondary);
}

.pnl-table tr.total-row {
    font-weight: 700;
    background: rgba(255, 255, 255, 0.03);
}

.pnl-table tr.total-row td {
    color: #fff;
    border-top: 1.5px solid var(--border-color);
    border-bottom: 2px double var(--border-color);
}

.pnl-table tr.net-income-row {
    font-weight: 800;
    background: rgba(13, 148, 136, 0.15);
}

.pnl-table tr.net-income-row td {
    color: #2dd4bf;
    font-size: 15px;
    border-top: 2px solid var(--color-teal);
    border-bottom: 2px solid var(--color-teal);
}

/* Positive vs Negative colors in ledger / sheet */
.pos-value {
    color: #34d399;
    font-weight: 600;
}

.neg-value {
    color: #f87171;
    font-weight: 600;
}

.neutral-value {
    color: var(--text-muted);
}

/* Debts & Vouchers Badges */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.badge-paid {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-unpaid {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-partial {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.text-red {
    color: #f87171 !important;
}

.text-green {
    color: #34d399 !important;
}
