/* ===== Economic Calendar Page Styles ===== */

/* Filter Bar */
.ec-filter-wrapper {
    background: var(--theme-color, #0a4578);
    border-radius: 5px;
    padding: 1.5rem 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.ec-filter-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.ec-filter-wrapper .form-label {
    color: #fff;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ec-filter-wrapper .form-control,
.ec-filter-wrapper .form-select {
    border: none;
    border-radius: 5px;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.ec-filter-wrapper .form-control:focus,
.ec-filter-wrapper .form-select:focus {
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    outline: none;
}

.ec-filter-wrapper .btn-filter {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 5px;
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ec-filter-wrapper .btn-filter:hover {
    background: rgba(255,255,255,0.35);
}

.ec-filter-wrapper .btn-reset {
    background: transparent;
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 5px;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ec-filter-wrapper .btn-reset:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.6);
}

/* Calendar Table */
.ec-table-wrapper {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.06);
    overflow: hidden;
}

.theme-dark .ec-table-wrapper {
    background: #1e2a3a;
}

.ec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.ec-table thead {
    background: var(--theme-color, #0a4578);
    color: #fff;
}

.ec-table thead th {
    padding: 0.8rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.ec-table tbody tr {
    border-bottom: 1px solid #eef2f7;
    transition: background 0.15s ease;
}

.theme-dark .ec-table tbody tr {
    border-bottom-color: #2d3e50;
}

.ec-table tbody tr:hover {
    background: #f8fafc;
}

.theme-dark .ec-table tbody tr:hover {
    background: #253445;
}

.ec-table td {
    padding: 0.7rem 1rem;
    vertical-align: middle;
}

.theme-dark .ec-table td {
    color: #c8d6e5;
}

/* Date separator row */
.ec-date-row {
    background: #f1f5f9 !important;
}

.theme-dark .ec-date-row {
    background: #1a2536 !important;
}

.ec-date-row td {
    padding: 0.6rem 1rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--theme-color, #0a4578);
}

.theme-dark .ec-date-row td {
    color: #6cb4ee;
}

/* Time */
.ec-time {
    font-weight: 600;
    color: #475569;
    font-size: 0.85rem;
    white-space: nowrap;
}

.theme-dark .ec-time {
    color: #94a3b8;
}

/* Currency badge */
.ec-currency {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.ec-currency .ec-flag {
    width: 22px;
    height: 16px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Event name */
.ec-event-name {
    font-weight: 500;
    color: #1e293b;
}

.theme-dark .ec-event-name {
    color: #e2e8f0;
}

/* Impact indicators */
.ec-impact {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.ec-impact-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e2e8f0;
}

.ec-impact-high .ec-impact-dot {
    background: #ef4444;
}

.ec-impact-medium .ec-impact-dot:nth-child(-n+2) {
    background: #f59e0b;
}

.ec-impact-low .ec-impact-dot:first-child {
    background: #22c55e;
}

/* Values */
.ec-value {
    font-weight: 600;
    font-size: 0.85rem;
}

.ec-actual-better {
    color: #16a34a;
}

.ec-actual-worse {
    color: #dc2626;
}

.ec-actual-neutral {
    color: #475569;
}

.theme-dark .ec-actual-neutral {
    color: #94a3b8;
}

.ec-forecast,
.ec-previous {
    color: #64748b;
}

.theme-dark .ec-forecast,
.theme-dark .ec-previous {
    color: #94a3b8;
}

/* Loading */
.ec-loading {
    text-align: center;
    padding: 3rem;
    color: #64748b;
}

.ec-loading i {
    font-size: 2rem;
    animation: ec-spin 1s linear infinite;
    display: block;
    margin-bottom: 1rem;
    color: var(--theme-color, #0a4578);
}

@keyframes ec-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* No results */
.ec-no-results {
    text-align: center;
    padding: 3rem;
    color: #94a3b8;
}

.ec-no-results i {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

/* Error */
.ec-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 1.5rem;
    color: #dc2626;
    text-align: center;
    margin-bottom: 1.5rem;
}

.theme-dark .ec-error {
    background: #3b1a1a;
    border-color: #5a2020;
}

/* Legend */
.ec-legend {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    flex-wrap: wrap;
    border-top: 1px solid #eef2f7;
    font-size: 0.8rem;
    color: #64748b;
}

.theme-dark .ec-legend {
    border-top-color: #2d3e50;
    color: #94a3b8;
}

.ec-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Week navigation */
.ec-week-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ec-week-nav .btn-week {
    background: var(--theme-color, #0a4578);
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.ec-week-nav .btn-week:hover {
    opacity: 0.85;
}

.ec-week-label {
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
    min-width: 220px;
    text-align: center;
}

.theme-dark .ec-week-label {
    color: #e2e8f0;
}

/* Responsive */
@media (max-width: 768px) {
    .ec-filter-wrapper {
        padding: 1rem;
    }

    .ec-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ec-table {
        min-width: 700px;
    }

    .ec-table thead th,
    .ec-table td {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
    }

    .ec-week-nav {
        flex-wrap: wrap;
    }

    .ec-legend {
        gap: 1rem;
    }
}

/* ===== Event Detail Panel ===== */

/* Clickable event name */
a.ec-event-toggle {
    color: #1e293b;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    cursor: pointer;
    transition: color 0.15s ease;
}

a.ec-event-toggle:hover {
    color: var(--theme-color, #0a4578);
    text-decoration: underline;
}

.theme-dark a.ec-event-toggle {
    color: #e2e8f0;
}

.theme-dark a.ec-event-toggle:hover {
    color: #6cb4ee;
}

.ec-toggle-icon {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
    color: var(--theme-color, #0a4578);
    flex-shrink: 0;
}

.ec-row-active {
    background: #edf4fc !important;
}

.theme-dark .ec-row-active {
    background: #1a2d44 !important;
}

/* Detail row */
.ec-detail-row > td {
    padding: 0 !important;
    border-bottom: none !important;
}

.ec-detail-panel {
    background: linear-gradient(135deg, #f0f4f8 0%, #e8eef5 100%);
    border-top: 2px solid var(--theme-color, #0a4578);
    border-bottom: 2px solid var(--theme-color, #0a4578);
    padding: 1rem 1.5rem 1.5rem;
}

.theme-dark .ec-detail-panel {
    background: linear-gradient(135deg, #131f2e 0%, #182638 100%);
}

/* Two-column grid */
.ec-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 991px) {
    .ec-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Section headers */
.ec-detail-header {
    background: var(--theme-color, #0a4578);
    color: #fff;
    padding: 0.55rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ec-detail-header i {
    margin-right: 0.4rem;
    font-size: 1rem;
}

[dir="rtl"] .ec-detail-header i {
    margin-right: 0;
    margin-left: 0.4rem;
}

/* --- Specs Panel (FF-style) --- */
.ec-specs-body {
    background: #fff;
    border: 1px solid #dde4ed;
    border-top: none;
    border-radius: 0 0 6px 6px;
    overflow: hidden;
}

.theme-dark .ec-specs-body {
    background: #1e2a3a;
    border-color: #2d3e50;
}

.ec-spec-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #eef2f7;
}

.theme-dark .ec-spec-row {
    border-bottom-color: #2d3e50;
}

.ec-spec-row:last-child {
    border-bottom: none;
}

.ec-spec-label {
    flex: 0 0 140px;
    padding: 0.6rem 0.9rem;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--theme-color, #0a4578);
    background: #f6f8fb;
    display: flex;
    align-items: center;
}

[dir="rtl"] .ec-spec-label {
    text-align: right;
}

.theme-dark .ec-spec-label {
    color: #6cb4ee;
    background: #1a2536;
}

.ec-spec-value {
    flex: 1;
    padding: 0.6rem 0.9rem;
    font-size: 0.85rem;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1.5;
}

.theme-dark .ec-spec-value {
    color: #cbd5e1;
}

.ec-spec-value strong {
    font-size: 0.95rem;
}

.ec-spec-placeholder {
    color: #94a3b8;
}

.theme-dark .ec-spec-placeholder {
    color: #475569;
}

.ec-spec-highlight {
    font-weight: 600;
    color: var(--theme-color, #0a4578);
}

.theme-dark .ec-spec-highlight {
    color: #6cb4ee;
}

/* Impact badge */
.ec-impact-badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.ec-impact-badge.ec-impact-high {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.ec-impact-badge.ec-impact-medium {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fcd34d;
}

.ec-impact-badge.ec-impact-low {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #86efac;
}

.theme-dark .ec-impact-badge.ec-impact-high {
    background: #3b1a1a;
    border-color: #5a2020;
}

.theme-dark .ec-impact-badge.ec-impact-medium {
    background: #3b2e1a;
    border-color: #5a4420;
}

.theme-dark .ec-impact-badge.ec-impact-low {
    background: #1a3b24;
    border-color: #205a30;
}

/* --- History Panel --- */
.ec-detail-history {
    display: flex;
    flex-direction: column;
}

.ec-history-content {
    background: #fff;
    border: 1px solid #dde4ed;
    border-top: none;
    border-radius: 0 0 0 0;
    overflow: hidden;
    flex: 1;
    max-height: 280px;
    overflow-y: auto;
}

.theme-dark .ec-history-content {
    background: #1e2a3a;
    border-color: #2d3e50;
}

/* History Footer (More + Graph) */
.ec-history-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f6f8fb;
    border: 1px solid #dde4ed;
    border-top: none;
    padding: 0.4rem 0.8rem;
    border-radius: 0 0 6px 6px;
}

.theme-dark .ec-history-footer {
    background: #1a2536;
    border-color: #2d3e50;
}

.ec-more-link {
    color: var(--theme-color, #0a4578);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    transition: opacity 0.2s ease;
}

.ec-more-link:hover {
    opacity: 0.7;
    text-decoration: none;
    color: var(--theme-color, #0a4578);
}

.theme-dark .ec-more-link {
    color: #6cb4ee;
}

.ec-graph-link {
    color: var(--theme-color, #0a4578);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: opacity 0.2s ease;
}

.ec-graph-link:hover {
    opacity: 0.7;
    text-decoration: none;
    color: var(--theme-color, #0a4578);
}

.theme-dark .ec-graph-link {
    color: #6cb4ee;
}

/* Graph container */
.ec-graph-container {
    background: #fff;
    border: 1px solid #dde4ed;
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 1rem;
    min-height: 260px;
}

.theme-dark .ec-graph-container {
    background: #1e2a3a;
    border-color: #2d3e50;
}

.ec-graph-container canvas {
    width: 100% !important;
}

.ec-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.ec-history-table thead {
    background: #f1f5f9;
    position: sticky;
    top: 0;
    z-index: 1;
}

.theme-dark .ec-history-table thead {
    background: #1a2536;
}

.ec-history-table th {
    padding: 0.55rem 0.8rem;
    font-weight: 600;
    color: #475569;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: left;
}

[dir="rtl"] .ec-history-table th {
    text-align: right;
}

.theme-dark .ec-history-table th {
    color: #94a3b8;
}

.ec-history-table td {
    padding: 0.5rem 0.8rem;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 500;
}

.theme-dark .ec-history-table td {
    color: #c8d6e5;
    border-bottom-color: #2d3e50;
}

.ec-history-table tbody tr:hover {
    background: #f0f7ff;
}

.theme-dark .ec-history-table tbody tr:hover {
    background: #1a2d44;
}

.ec-history-table tbody tr:first-child {
    background: #edf4fc;
}

.theme-dark .ec-history-table tbody tr:first-child {
    background: #162a40;
}

/* Loading small */
.ec-loading-small {
    text-align: center;
    padding: 2.5rem;
    color: #94a3b8;
}

.ec-loading-small i {
    font-size: 1.5rem;
    animation: ec-spin 1s linear infinite;
}

/* No history message */
.ec-no-history {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
    font-size: 0.85rem;
    margin: 0;
}
