/* FRED Economic Dashboard - Styles */

.fred-economic-dashboard {
    width: 100%;
    max-width: 100%;
    margin: 40px 0;
    background: transparent;
    border-radius: 12px;
    box-shadow: none;
    overflow: hidden;
    font-family: inherit;
}

/* Header */
.fred-dashboard-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: #ffffff !important;
    padding: 40px 30px;
    text-align: center;
    border-radius: 12px 12px 0 0;
}

.fred-dashboard-title {
    font-size: 2.5em;
    margin: 0 0 10px 0;
    font-weight: 700;
    color: #ffffff !important;
}

.fred-dashboard-subtitle {
    font-size: 1.1em;
    margin: 0;
    opacity: 0.9;
    color: #ffffff !important;
}

/* Stats Grid */
.fred-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin: 0;
}

.fred-stat-card {
    padding: 30px 25px;
    text-align: center;
    border-right: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    background: #ffffff;
}

.fred-stat-card:last-child {
    border-right: none;
}

.fred-stat-card:hover {
    background: #f9fafb;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.fred-stat-label {
    font-size: 0.9em;
    color: #7f8c8d;
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.fred-stat-value {
    font-size: 2.8em;
    font-weight: bold;
    color: #1e40af;
    margin: 10px 0;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.fred-stat-date {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-top: 8px;
}

/* Controls */
.fred-controls {
    padding: 25px 30px !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    margin: 20px 0 !important;
    display: flex !important;
    gap: 15px !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
}

.fred-control-group {
    display: flex !important;
    gap: 10px !important;
    align-items: center !important;
    margin: 0 !important;
    height: auto !important;
}

.fred-control-group label {
    font-weight: 600 !important;
    color: #2c3e50 !important;
    font-size: 0.9em !important;
    white-space: nowrap !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: normal !important;
    display: flex !important;
    align-items: center !important;
    height: 44px !important;
}

.fred-control-group input[type="date"] {
    padding: 10px 15px !important;
    border: 2px solid #d1d5db !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
    background: #ffffff !important;
    color: #1f2937 !important;
    height: 44px !important;
    line-height: normal !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
    margin: 0 !important;
}

.fred-control-group input[type="date"]:focus {
    outline: none !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

/* Buttons */
.fred-btn {
    padding: 10px 25px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    height: 44px;
    line-height: 1.5;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fred-btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
}

.fred-btn-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.fred-btn-primary:active {
    transform: translateY(0);
}

.fred-btn-secondary {
    background: #ffffff;
    color: #3b82f6;
    border: 2px solid #3b82f6;
}

.fred-btn-secondary:hover {
    background: #3b82f6;
    color: #ffffff;
}

.fred-preset-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Charts Container */
.fred-charts-container {
    padding: 20px 0;
    background: transparent;
}

.fred-chart-wrapper {
    margin-bottom: 30px;
    background: #ffffff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.fred-chart-wrapper:last-child {
    margin-bottom: 0;
}

.fred-chart-wrapper:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.fred-chart-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.fred-chart-title {
    font-size: 1.5em;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 5px;
}

.fred-chart-info {
    font-size: 0.95em;
    color: #6b7280;
}

.fred-chart-container {
    position: relative;
    height: 400px;
    min-height: 350px;
    cursor: crosshair;
}

.fred-chart-container canvas {
    cursor: crosshair;
}

/* Chart Analysis Box */
.fred-chart-analysis {
    margin-top: 25px;
    padding: 25px 30px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 5px solid #3b82f6;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    transition: all 0.3s ease;
}

.fred-chart-analysis:hover {
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.fred-chart-analysis p {
    margin: 0 0 16px 0;
    line-height: 1.8;
    color: #1e293b;
    font-size: 15px;
}

.fred-chart-analysis p:last-child {
    margin-bottom: 0;
}

.fred-chart-analysis strong {
    color: #1e40af;
    font-weight: 600;
}

.fred-chart-analysis ul {
    margin: 15px 0 5px 0;
    padding-left: 0;
    list-style: none;
}

.fred-chart-analysis ul li {
    margin: 12px 0;
    padding: 12px 15px 12px 45px;
    position: relative;
    line-height: 1.8;
    color: #334155;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.fred-chart-analysis ul li:hover {
    background: rgba(255, 255, 255, 0.9);
    padding-left: 50px;
}

.fred-chart-analysis ul li:before {
    content: "▸";
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #3b82f6;
    font-weight: bold;
    font-size: 20px;
}

.fred-chart-analysis ul li strong {
    color: #1e40af;
    font-weight: 600;
}

/* Loading State */
.fred-loading {
    text-align: center;
    padding: 100px;
    font-size: 1.2em;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border-radius: 8px;
}

.fred-loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid #e5e7eb;
    border-top: 5px solid #3b82f6;
    border-radius: 50%;
    animation: fred-spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes fred-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.fred-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 20px;
    margin: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #fecaca;
}

/* Footer */
.fred-dashboard-footer {
    padding: 20px;
    text-align: center;
    background: #f9fafb;
    color: #6b7280;
    font-size: 0.9em;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 12px 12px;
}

.fred-dashboard-footer a {
    color: #3b82f6;
    text-decoration: none;
}

.fred-dashboard-footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .fred-dashboard-title {
        font-size: 1.8em;
    }
    
    .fred-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .fred-stat-card {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .fred-stat-card:last-child {
        border-bottom: none;
    }
    
    .fred-controls {
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
    }
    
    .fred-control-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .fred-chart-container {
        height: 300px;
        min-height: 250px;
    }
    
    .fred-preset-buttons {
        flex-direction: column;
    }
    
    .fred-btn {
        width: 100%;
    }
    
    .fred-chart-wrapper {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .fred-dashboard-header {
        padding: 30px 20px;
    }
    
    .fred-dashboard-title {
        font-size: 1.5em;
    }
    
    .fred-stat-value {
        font-size: 2.2em;
    }
    
    .fred-charts-container {
        padding: 20px 0;
    }
    
    .fred-chart-wrapper {
        padding: 20px 15px;
    }
    
    .fred-chart-container {
        height: 250px;
        min-height: 200px;
    }
}

/* Compatibility - Đảm bảo không conflict với theme */
.fred-economic-dashboard *,
.fred-economic-dashboard *::before,
.fred-economic-dashboard *::after {
    box-sizing: border-box;
}

/* Entry content wrapper spacing */
.entry-content .fred-economic-dashboard {
    margin-top: 40px;
    margin-bottom: 40px;
}

/* Smooth transitions for all interactive elements */
.fred-stat-card,
.fred-btn,
.fred-chart-wrapper,
.fred-control-group input,
.fred-control-group select {
    transition: all 0.3s ease;
}

/* Chart canvas interaction */
.fred-chart-container canvas:hover {
    cursor: crosshair;
}

/* Additional tooltip styling via Chart.js config */
.chartjs-tooltip {
    opacity: 1;
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    border-radius: 4px;
    pointer-events: none;
    transform: translate(-50%, -100%);
    transition: all 0.2s ease;
    z-index: 1000;
}