/**
 * A/R & A/P Aging Analysis - Styles
 * Professional styling for aging reports
 */

/* ============================================================================
   Tab Navigation
   ============================================================================ */

.aging-tabs {
    display: flex;
    gap: 8px;
    padding: 20px 24px 0;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
}

.aging-tabs .tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.aging-tabs .tab-btn:hover {
    color: #0d47a1;
    background: rgba(13, 71, 161, 0.05);
}

.aging-tabs .tab-btn.active {
    color: #0d47a1;
    border-bottom-color: #0d47a1;
    background: #fff;
}

.aging-tabs .tab-btn i {
    font-size: 16px;
}

/* ============================================================================
   Tab Content
   ============================================================================ */

.tab-container {
    padding: 24px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================================================
   Aging Header
   ============================================================================ */

.aging-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e0e0e0;
}

.aging-header h2 {
    font-size: 22px;
    color: #212121;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.aging-header h2 i {
    color: #0d47a1;
}

.aging-actions {
    display: flex;
    gap: 12px;
}

/* ============================================================================
   Filter Section
   ============================================================================ */

.filter-section {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.filter-group input,
.filter-group select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #0d47a1;
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.1);
}

/* ============================================================================
   Summary Cards
   ============================================================================ */

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    border-left: 4px solid #ccc;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.summary-card.current {
    border-left-color: #4caf50;
}

.summary-card.days-30 {
    border-left-color: #ff9800;
}

.summary-card.days-60 {
    border-left-color: #ff5722;
}

.summary-card.days-90 {
    border-left-color: #d32f2f;
}

.summary-card.total {
    border-left-color: #0d47a1;
}

.summary-card .card-icon {
    font-size: 32px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(13, 71, 161, 0.1);
    color: #0d47a1;
}

.summary-card.current .card-icon {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
}

.summary-card.days-30 .card-icon {
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
}

.summary-card.days-60 .card-icon {
    background: rgba(255, 87, 34, 0.1);
    color: #ff5722;
}

.summary-card.days-90 .card-icon {
    background: rgba(211, 47, 47, 0.1);
    color: #d32f2f;
}

.summary-card.total .card-icon {
    background: rgba(13, 71, 161, 0.1);
    color: #0d47a1;
}

.card-content {
    flex: 1;
}

.card-label {
    font-size: 12px;
    color: #757575;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.card-value {
    font-size: 22px;
    font-weight: 700;
    color: #212121;
}

/* ============================================================================
   Chart Section
   ============================================================================ */

.chart-section {
    background: #fff;
    padding: 24px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.chart-section h3 {
    font-size: 16px;
    font-weight: 700;
    color: #212121;
    margin-bottom: 20px;
}

.chart-section canvas {
    max-height: 300px;
}

/* ============================================================================
   Table Section
   ============================================================================ */

.table-section {
    background: #fff;
    padding: 24px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-section h3 {
    font-size: 16px;
    font-weight: 700;
    color: #212121;
    margin-bottom: 16px;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.aging-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.aging-table thead {
    background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%);
    color: #fff;
}

.aging-table th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.aging-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

.aging-table tbody tr:hover {
    background: #f8f9fa;
}

.aging-table tbody tr.overdue-moderate {
    background: #fff3e0;
}

.aging-table tbody tr.overdue-warning {
    background: #ffebee;
}

.aging-table tbody tr.overdue-critical {
    background: #fce4ec;
}

.aging-table td {
    padding: 12px;
    color: #424242;
}

.aging-table .days-cell {
    font-weight: 600;
    color: #0d47a1;
}

.aging-table .amount-cell {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.aging-table .no-data {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    color: #0d47a1;
    font-size: 14px;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.btn-icon:hover {
    background: rgba(13, 71, 161, 0.1);
    color: #0a3d91;
}

/* ============================================================================
   Summary Dashboard
   ============================================================================ */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.summary-large-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.summary-large-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.summary-large-card .card-header {
    padding: 20px;
    background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%);
    color: #fff;
}

.summary-large-card.ar-card .card-header {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
}

.summary-large-card.ap-card .card-header {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.summary-large-card.net-card .card-header {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
}

.summary-large-card .card-header h3 {
    font-size: 16px;
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-large-card .card-body {
    padding: 24px;
}

.large-amount {
    font-size: 36px;
    font-weight: 700;
    color: #212121;
    margin-bottom: 20px;
}

.card-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 13px;
    color: #757575;
    font-weight: 600;
}

.detail-value {
    font-size: 14px;
    font-weight: 700;
    color: #212121;
}

.detail-value.overdue {
    color: #d32f2f;
}

/* ============================================================================
   Charts Grid
   ============================================================================ */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: #fff;
    padding: 24px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chart-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: #212121;
    margin-bottom: 20px;
}

.chart-card canvas {
    max-height: 300px;
}

/* ============================================================================
   Metrics Section
   ============================================================================ */

.metrics-section {
    background: #fff;
    padding: 24px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.metrics-section h3 {
    font-size: 18px;
    font-weight: 700;
    color: #212121;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.metric-card:hover {
    border-color: #0d47a1;
    background: #fff;
}

.metric-icon {
    font-size: 28px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(13, 71, 161, 0.1);
    color: #0d47a1;
}

.metric-content {
    flex: 1;
}

.metric-label {
    font-size: 12px;
    color: #757575;
    font-weight: 600;
    margin-bottom: 6px;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #212121;
    margin-bottom: 4px;
}

.metric-trend {
    font-size: 11px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
}

.metric-trend.good {
    color: #4caf50;
}

.metric-trend.bad {
    color: #f44336;
}

/* ============================================================================
   Top Lists
   ============================================================================ */

.top-lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.top-list-card {
    background: #fff;
    padding: 24px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.top-list-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: #212121;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #0d47a1;
    transition: all 0.2s ease;
}

.top-list-item:hover {
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.top-list-item .rank {
    font-size: 20px;
    font-weight: 700;
    color: #0d47a1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 71, 161, 0.1);
    border-radius: 50%;
}

.top-list-item .name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #424242;
}

.top-list-item .amount {
    font-size: 15px;
    font-weight: 700;
    color: #212121;
    font-family: 'Courier New', monospace;
}

.top-list .no-data {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

/* ============================================================================
   Modal
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #fff;
    margin: 5% auto;
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 2px solid #e0e0e0;
    background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%);
    color: #fff;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    font-size: 18px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 28px;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.modal-body .form-group input,
.modal-body .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.modal-body .form-group input:focus,
.modal-body .form-group textarea:focus {
    outline: none;
    border-color: #0d47a1;
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.1);
}

.modal-body .form-group input[readonly] {
    background: #f5f5f5;
    color: #666;
}

.modal-body .form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* ============================================================================
   Toast Notifications
   ============================================================================ */

.toast {
    position: fixed;
    bottom: -100px;
    right: 24px;
    background: #323232;
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 3000;
    transition: all 0.3s ease;
    min-width: 300px;
}

.toast.show {
    bottom: 24px;
}

.toast-success {
    background: #4caf50;
}

.toast-error {
    background: #f44336;
}

.toast-info {
    background: #2196f3;
}

.toast i {
    font-size: 20px;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .aging-tabs {
        overflow-x: auto;
        padding: 16px 16px 0;
    }
    
    .aging-tabs .tab-btn {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    .tab-container {
        padding: 16px;
    }
    
    .aging-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .aging-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .aging-actions .btn {
        width: 100%;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .top-lists-grid {
        grid-template-columns: 1fr;
    }
    
    .table-wrapper {
        overflow-x: auto;
    }
    
    .aging-table {
        font-size: 12px;
    }
    
    .aging-table th,
    .aging-table td {
        padding: 8px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

@media (max-width: 480px) {
    .card-value {
        font-size: 18px;
    }
    
    .large-amount {
        font-size: 28px;
    }
    
    .metric-value {
        font-size: 20px;
    }
}
