/*
* ===================================================================
* Filename: settlement.css
* Description: Complete stylesheet for the Razorpay Settlements dashboard.
* ===================================================================
*/


/* === MAIN LAYOUT & HEADER === */
.main-content {
    padding: 20px;
    gap: 0px;
}

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

.header-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.main-title {
    margin: 0;
    font-size: 24px;
    color: var(--text-primary);
}

.date-time-container {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* (Other header styles like user profile, icons etc. go here) */


/* === GENERAL CARD STYLES === */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}


/* ======================================= */
/* === SUMMARY CARDS STYLES === */
/* ======================================= */
.summary-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* Special gradient for the income card */
.summary-card--income {
    background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%);
    color: #fff;
    border: none;
}

.summary-card--income .card-title,
.summary-card--income .card-growth span,
.summary-card--income .card-footer {
    color: rgba(255, 255, 255, 0.85);
}

.summary-card--income .card-icon {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.summary-card--income .growth-positive {
    color: #fff;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--active-bg);
    font-size: 18px;
    color: var(--text-primary);
    flex-shrink: 0;
}

.card-growth {
    text-align: right;
    font-size: 14px;
    font-weight: 600;
}

.card-growth span {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 2px;
}

.growth-positive {
    color: var(--accent-green);
}

.growth-negative {
    color: var(--accent-red);
}

.growth-neutral {
    color: var(--text-secondary);
}

.card-body {
    margin-top: auto;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    word-wrap: break-word;
}

.card-title {
    margin: 4px 0 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ======================================= */
/* === CHART & ANALYSIS SECTION === */
/* ======================================= */
.chart-section {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    grid-column: 1 / -1;
    /* Default for mobile */
}

@media (min-width: 1200px) {
    .monthly-settlement-card {
        grid-column: span 3;
    }

    .razorpay-analysis-card {
        grid-column: span 3;
    }

    .pending-settlements-card {
        grid-column: span 6;
    }
}

.chart-card h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: var(--text-primary);
    text-align: center;
}

.chart-container {
    height: 220px;
    /* Adjusted height for doughnut */
    position: relative;
    margin-bottom: 15px;
}


/* === NEW: Custom Chart Legend Styles === */
.chart-legend {
    margin-top: auto;
    /* Pushes the legend to the bottom */
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
}

.legend-item::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--legend-color, #ccc);
    /* Uses custom property set in JS */
    flex-shrink: 0;
}

.legend-item strong {
    color: var(--text-primary);
    font-weight: 500;
}

.legend-item span {
    color: var(--text-secondary);
    font-weight: 600;
    margin-left: auto;
}


/* === Full Width Chart Section === */
.full-width-chart-section {
    margin-top: 30px;
}

.chart-card-full-width {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.chart-card-full-width h3 {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 25px;
}

/* --- Pending Settlements Table Styles --- */
.chart-card-large {
    min-height: 420px;
}

.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.chart-card-header h3 {
    margin: 0;
    font-size: 18px;
    text-align: left;
    /* Override center alignment for this header */
}

.chart-card-header .btn-view-all {
    text-decoration: none;
    color: var(--accent-blue);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}

.table-wrapper-compact {
    overflow: auto;
    height: 100%;
}

.settlement-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.settlement-table .station-name-col {
    width: 60%;
}

.settlement-table th,
.settlement-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.settlement-table thead th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 12px;
    position: sticky;
    top: 0;
    background-color: var(--card-bg);
}


/* ======================================= */
/* === ALL FILTER CONTROLS STYLES === */
/* ======================================= */
.table-section-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.table-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn,
.control-select,
.date-input {
    background-color: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.control-btn {
    padding: 8px 16px;
}

.control-btn:hover,
.control-select:hover,
.date-input:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.control-btn.active {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
    pointer-events: none;
}

.filter-divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
    margin: 0 8px;
}

.date-separator {
    color: var(--text-secondary);
    font-weight: 600;
}

.filter-group-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
}

.control-btn.apply-btn {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

.control-btn.apply-btn:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.control-btn.clear-btn {
    background-color: transparent;
    text-decoration: none;
}

.control-btn.clear-btn:hover {
    background-color: var(--active-bg);
}

.table-controls-right .btn-download {
    background-color: var(--accent-green);
    border-color: var(--accent-green);
    color: #fff;
}

.table-controls-right .btn-download:hover {
    background-color: #157347;
    border-color: #146c43;
}


/* === TABLE STYLES === */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table thead th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 12px;
}

.data-table tbody tr:hover {
    background-color: var(--active-bg);
}

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

.text-center {
    text-align: center !important;
}

/* Styles for action buttons inside the table */
.action-btn {
    background-color: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}

.action-btn:hover {
    background-color: #0b5ed7;
}

/* Styles for manual amount status tags */
.manual-status-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.status-badge {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-confirmed {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--accent-green);
}

.status-mismatch {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--accent-red);
}

.status-pending {
    background-color: rgba(108, 117, 125, 0.1);
    color: var(--text-secondary);
}


/* === PAGINATION === */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}


/* === RESPONSIVE STYLES === */
@media (max-width: 1200px) {
    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .table-filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-divider {
        display: none;
    }

    .filter-group,
    .filter-group-actions {
        width: 100%;
        justify-content: center;
    }

    .filter-group>* {
        flex-grow: 1;
    }

    .filter-group-actions {
        margin-left: 0;
    }
}