/* Kimutatások (Reports) Premium Page Styles */

/* --- Layout & Grid System --- */

/* Dashboard Grid for Modules/KPIs (3 columns) */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* Charts Grid (2 columns) */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Full Width Container */
.full-width {
    grid-column: 1 / -1;
}

/* --- Card Components --- */

/* Standard Card */
.report-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    border: none;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.report-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.report-card-link {
    width: 100%;
    border: none;
    text-align: left;
    cursor: pointer;
}

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

/* --- Headers & Typography --- */

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 24px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-title {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title h3 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Icons --- */

/* Wrapper for KPI icons */
.card-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* Icon Variations */
.icon-success {
    background: rgba(73, 171, 124, 0.1);
    color: #49ab7c;
}

.icon-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.icon-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.icon-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.icon-purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

/* Large Number (KPI) */
.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: #111827;
    margin-top: 10px;
    margin-bottom: 0;
}

/* --- Date Range Picker & Tabs --- */

.date-filter-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
    background: transparent;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
}

.period-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.period-preset-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.period-preset-btn:hover {
    border-color: #49ab7c;
    color: #1f2937;
}

.period-preset-btn.active {
    background: #49ab7c;
    color: #fff;
    border-color: #49ab7c;
}

.date-input-group {
    display: none;
    align-items: center;
    gap: 12px;
}

.date-input-group.visible {
    display: flex;
    flex-wrap: wrap;
}

.date-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.form-control-date {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    font-family: inherit;
    color: #374151;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: white;
}

.form-control-date:focus {
    border-color: #49ab7c;
    box-shadow: none;
}

.btn-filter {
    background: #49ab7c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.btn-filter:hover {
    background: #3d9168;
}

/* Tabs */
.custom-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 30px;
    padding: 4px;
    background: #f3f4f6;
    border-radius: 8px;
    width: fit-content;
}

.tab-button {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-button i {
    font-size: 14px;
    color: #6b7280;
}

.tab-button:hover {
    color: #111827;
    background: rgba(255, 255, 255, 0.5);
}

.tab-button.active {
    background: white;
    color: #49ab7c;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.tab-button.active i {
    color: #49ab7c;
}

/* Utilities */
.text-success {
    color: #49ab7c;
}

.text-danger {
    color: #ef4444;
}

/* Tab Content Visibility */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Loading Overlay (Custom for specific div) --- */
.chart-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 16px;
    display: none;
    /* hidden by default */
}

.chart-loading-overlay.active {
    display: flex;
}

/* --- Responsive Helpers --- */
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

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

    .date-filter-container {
        gap: 10px;
    }

    .date-input-group.visible {
        flex-direction: column;
        align-items: stretch;
    }
}

/* --- Cashflow Planner (Lista + Tervezo) --- */
.cashflow-report-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    --cf-border: #dbe2ea;
    --cf-muted: #64748b;
    --cf-surface: #ffffff;
    --cf-surface-soft: #f8fafc;
    --cf-critical-bg: #fef2f2;
    --cf-critical-fg: #991b1b;
    --cf-warning-bg: #fff7ed;
    --cf-warning-fg: #9a3412;
    --cf-healthy-bg: #f0fdf4;
    --cf-healthy-fg: #166534;
    --cf-balanced-bg: #eff6ff;
    --cf-balanced-fg: #1d4ed8;
    padding: 1rem !important;
    overflow: hidden;
}

.cashflow-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.cashflow-section-header .section-title {
    margin: 0;
    min-width: 0;
}

.cashflow-view-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cashflow-match-btn {
    margin-right: 16px;
}

.cashflow-list-kpis {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.85rem;
    margin: 0;
}

.cashflow-list-kpis .report-card {
    border: 1px solid #e5e7eb;
    box-shadow: none;
    border-radius: 10px;
    padding: 16px 18px;
}

.cashflow-list-kpis .report-card .kpi-value {
    font-size: 2rem;
}

.cashflow-list-kpis .card-icon-wrapper {
    opacity: 0.75;
}

.cashflow-loading-text {
    margin-top: 16px;
    font-weight: 500;
    color: #4a5568;
}

.cashflow-comparison-container {
    min-height: 260px;
}

.cashflow-report-section #cashflowListView .customer-table-container {
    margin: 0;
}

.cf-compare-root {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cf-compare-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--cf-border);
    border-radius: 10px;
    background: var(--cf-surface-soft);
    color: #0f172a;
    font-size: 0.92rem;
}

.cf-planner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cf-compare-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cf-compare-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}

.cf-risk-pill:focus-visible,
.cf-click-row:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

.cf-table-wrap {
    border: 1px solid var(--cf-border);
    border-radius: 10px;
    background: #fff;
    overflow: auto;
}

.cf-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 920px;
}

.cf-table th,
.cf-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f7;
    font-size: 0.88rem;
    color: #1f2937;
    vertical-align: middle;
}

.cf-table thead th {
    background: #f8fafc;
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.cf-table tbody tr:last-child td {
    border-bottom: none;
}

.cf-table .text-right {
    text-align: right;
}

.cf-table .is-negative {
    color: #b91c1c;
    font-weight: 700;
}

.cf-table .is-positive {
    color: #0f766e;
    font-weight: 700;
}

.cf-click-row {
    cursor: pointer;
}

.cf-click-row:hover td {
    background: #f8fafc;
}

.cf-click-row.is-active td {
    background: #eef2ff;
}

.cf-click-row.status-critical td:first-child {
    box-shadow: inset 3px 0 0 #dc2626;
}

.cf-click-row.status-warning td:first-child {
    box-shadow: inset 3px 0 0 #f59e0b;
}

.cf-click-row.status-healthy td:first-child {
    box-shadow: inset 3px 0 0 #22c55e;
}

.cf-click-row.status-balanced td:first-child {
    box-shadow: inset 3px 0 0 #cbd5e1;
}

.cf-link-cell {
    color: #2563eb;
    text-decoration: none;
}

.cf-link-cell:hover {
    text-decoration: underline;
}

.cf-risk-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cf-risk-pill {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.84rem;
    color: #334155;
}

.cf-risk-pill.interactive {
    cursor: pointer;
}

.cf-risk-pill strong {
    color: #0f172a;
}

.cf-risk-pill.is-active {
    border-color: #0f172a;
    background: #fff;
}

.cf-compare-details-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.cf-compare-detail-card {
    border: 1px solid var(--cf-border);
    border-radius: 10px;
    background: var(--cf-surface);
    padding: 12px;
}

.cf-compare-detail-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 10px;
}

.cf-empty {
    border: 1px dashed var(--cf-border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: var(--cf-muted);
}

.cf-fixed-cost-title {
    font-weight: 700;
    color: #0f172a;
}

.cf-fixed-cost-meta {
    margin-top: 3px;
    color: #64748b;
    font-size: 0.78rem;
}

.cf-fixed-cost-modal {
    max-width: 980px;
    padding: 0;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
}

.cf-fixed-cost-edit-modal {
    max-width: 620px;
    padding: 0;
}

.cf-fixed-cost-modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid #e2e8f0;
}

.cf-fixed-cost-modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
    color: #0f172a;
}

.cf-fixed-cost-modal-body {
    padding: 16px 22px 22px;
    overflow: auto;
}

.cf-fixed-cost-search-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cf-fixed-cost-search-row .form-control {
    flex: 1;
}

.cf-fixed-cost-suggestions {
    margin-bottom: 14px;
}

.cf-fixed-cost-suggestions-title {
    margin-bottom: 8px;
    color: #0f172a;
    font-size: 0.9rem;
    font-weight: 800;
}

.cf-fixed-cost-suggestion-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.cf-fixed-cost-suggestion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    background: #eef2ff;
    color: #1e1b4b;
    text-align: left;
    cursor: pointer;
}

.cf-fixed-cost-suggestion:hover {
    border-color: #6366f1;
    background: #e0e7ff;
}

.cf-fixed-cost-suggestion strong,
.cf-fixed-cost-suggestion small {
    display: block;
}

.cf-fixed-cost-suggestion small {
    margin-top: 3px;
    color: #4f46e5;
    font-size: 0.76rem;
}

.cf-fixed-cost-suggestion em {
    color: #111827;
    font-style: normal;
    font-weight: 800;
    white-space: nowrap;
}

.cf-fixed-cost-month-input {
    max-width: 180px;
}

.cf-fixed-cost-month-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.88rem;
}

.cf-fixed-cost-month-summary strong {
    color: #0f172a;
}

.cf-fixed-cost-transaction-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.cf-fixed-cost-transaction {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}

.cf-fixed-cost-transaction-side {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.cf-fixed-cost-amount {
    font-weight: 800;
    color: #0f172a;
}

.cf-row-actions {
    white-space: nowrap;
}

.cf-marketing-forecast {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cf-marketing-forecast-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e3a8a;
}

.cf-marketing-forecast-total strong {
    color: #0f172a;
    white-space: nowrap;
}

.cf-marketing-provider-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cf-marketing-provider-list div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #334155;
    font-size: 0.84rem;
}

.cf-fixed-cost-edit-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 18px 22px 22px;
}

.cf-fixed-cost-edit-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #334155;
    font-size: 0.86rem;
    font-weight: 700;
}

.cf-fixed-cost-edit-form label:first-child {
    grid-column: 1 / -1;
}

.cf-fixed-cost-edit-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

@media (max-width: 1400px) {
    .cashflow-list-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .cf-compare-details-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .cashflow-section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .cashflow-view-switcher {
        width: 100%;
        flex-wrap: wrap;
    }

    .cashflow-match-btn {
        margin-right: 0;
    }

    .cashflow-list-kpis,
    .cf-compare-details-grid {
        grid-template-columns: 1fr;
    }

    .cf-table {
        min-width: 560px;
    }

    .cf-compare-filter-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .cf-fixed-cost-search-row,
    .cf-fixed-cost-transaction,
    .cf-fixed-cost-transaction-side {
        align-items: stretch;
        flex-direction: column;
    }

    .cf-fixed-cost-transaction-side {
        white-space: normal;
    }

    .cf-fixed-cost-month-input {
        max-width: none;
    }

    .cf-fixed-cost-suggestion-grid {
        grid-template-columns: 1fr;
    }

    .cf-fixed-cost-edit-form {
        grid-template-columns: 1fr;
    }
}
