/**
 * HOA Proposal Dashboard Styles
 * Neutral theme with clean design
 */

/* Dashboard Wrapper */
.hoa-dashboard-wrapper {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Dashboard Header */
.hoa-dashboard-header {
    background: #f8f9fa;
    color: #2c3e50;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.dashboard-title {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: #2c3e50;
}

/* Filters */
.dashboard-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: 500;
    font-size: 14px;
    color: #2c3e50;
}

.filter-select,
#date-from,
#date-to {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #ffffff;
    color: #495057;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:hover,
#date-from:hover,
#date-to:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.filter-select option {
    background: #ffffff;
    color: #495057;
}

.btn-apply-filters {
    padding: 8px 20px;
    background: #a4d65e;
    color: #333;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn-apply-filters:hover {
    background: #8fc245;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Summary Metrics Cards */
.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.metric-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.metric-icon {
    max-width: 4rem;
    max-height: 4rem;
    height: auto;
    width: auto;
}

.metric-content {
    flex: 1;
}

.metric-value {
    font-size: 36px;
    font-weight: 700;
    color: #0066cc;
    line-height: 1;
    margin-bottom: 8px;
}

.metric-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Charts Section */
.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chart-container h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.chart-container canvas {
    max-height: 350px;
}

/* Data Table */
.dashboard-table-wrapper {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.dashboard-table-wrapper h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

/* Stage Badges */
.stage-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.stage-pending {
    background: #f0f0f0;
    color: #666;
}

.stage-opened {
    background: #d1ebf5;
    color: #217496;
}

.stage-follow_up_1_sent,
.stage-follow_up_2_sent,
.stage-follow_up_3_sent,
.stage-follow_up_4_sent {
    background: #fff3cd;
    color: #856404;
}

.stage-clicked {
    background: #d1ecf1;
    color: #0c5460;
}

.stage-incomplete_form {
    background: #f8d7da;
    color: #721c24;
}

.stage-completed {
    background: #d4edda;
    color: #155724;
}

.stage-archived {
    background: #e2e3e5;
    color: #383d41;
}

/* DataTables Customization */
.dataTables_wrapper {
    font-size: 14px;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 0 8px;
}

.dataTables_wrapper .dataTables_filter input {
    width: 250px;
}

table.dataTable thead th {
    background: #f8f9fa;
    color: #333;
    font-weight: 600;
    padding: 12px 8px;
    border-bottom: 2px solid #0066cc;
}

table.dataTable tbody td {
    padding: 12px 8px;
    vertical-align: middle;
}

table.dataTable tbody tr:hover {
    background: #f8f9fa;
}

table.dataTable tbody td a {
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
}

table.dataTable tbody td a:hover {
    text-decoration: underline;
}

/* Loading State */
.dashboard-loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.dashboard-loading::before {
    content: "⏳";
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
}

/* Error State */
.hoa-dashboard-error {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    margin: 20px 0;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
    
    .dashboard-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-select,
    #date-from,
    #date-to,
    .btn-apply-filters {
        width: 100%;
    }
    
    .dashboard-metrics {
        grid-template-columns: 1fr;
    }
    
    .metric-card {
        padding: 20px;
    }
    
    .metric-value {
        font-size: 28px;
    }
    
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
    }
}

/* Extra small screens (375px and below) */
@media (max-width: 375px) {
    .dashboard-charts {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .chart-container {
        padding: 15px;
    }

    .chart-container canvas {
        max-height: 250px;
    }

    .dashboard-table-wrapper {
        padding: 15px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dashboard-table-wrapper table {
        min-width: 600px; /* Ensure table doesn't shrink too much */
    }

    .dashboard-metrics {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .metric-card {
        padding: 15px;
    }

    .metric-value {
        font-size: 20px;
    }

    .metric-title {
        font-size: 12px;
    }

    .dashboard-filters {
        gap: 10px;
    }

    .hoa-dashboard-header {
        padding: 20px;
    }

    .dashboard-title {
        font-size: 24px;
    }

    .filter-group label {
        font-size: 13px;
    }
}

/* Print Styles */
@media print {
    .dashboard-filters,
    .dataTables_filter,
    .dataTables_length,
    .dataTables_info,
    .dataTables_paginate {
        display: none !important;
    }
    
    .hoa-dashboard-wrapper {
        margin: 0;
        padding: 0;
    }
    
    .metric-card,
    .chart-container,
    .dashboard-table-wrapper {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}

