/*//templates/css/calendars.css */

/* Top Leaderboard Ad - aligned with content */
.ec-top-ad-wrapper {
    max-width: 1300px;
    margin: 0 auto 15px;
    padding: 0 15px;
}

/* Bottom Ad - aligned with content */
.ec-bottom-ad-wrapper {
    max-width: 1300px;
    margin: 20px auto;
    padding: 0 15px;
}

/* Leaderboard Ads (Desktop only) */
.ec-ad-leaderboard {
    text-align: center;
    padding: 15px 0;
}

.ec-ad-bottom-leaderboard {
    margin-top: 20px;
    border-top: 1px solid #e0e3eb;
}

/* Hide leaderboard on mobile */
@media (max-width: 768px) {
    .ec-ad-leaderboard {
        display: none;
    }
    .ec-top-ad-wrapper {
        margin-top: 60px;
    }
}

/* Two-Column Page Layout: 970px main + sidebar */
.ec-page-layout {
    display: flex;
    gap: 20px;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 15px;
}

.ec-main {
    width: 970px;
    flex-shrink: 0;
}

/* Sidebar - Desktop only */
.ec-sidebar {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ec-sidebar-ad {
    min-height: 250px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Ads - hidden on desktop */
.ec-ad-mobile {
    display: none;
    padding: 15px 0;
    text-align: center;
}

/* Stack sidebar on mobile */
@media (max-width: 1024px) {
    .ec-page-layout {
        flex-direction: column;
    }

    .ec-main {
        width: 100%; /* Make calendar full width on mobile */
    }

    .ec-sidebar {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        gap: 15px;
        padding: 15px 0;
    }

    .ec-ad-mobile {
        display: block;
    }
}

/* Economic Calendar - Investing.com Style */
.ec-wrapper {
    max-width: 100%;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 13px;
    background: #131722;
    border-radius: 4px;
    overflow: hidden;
}

/* Header with tabs */
.ec-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #131722;
    padding: 10px 15px;
    border-bottom: 1px solid #2a2e39;
}

.ec-tabs {
    display: flex;
    gap: 0;
}

.ec-tab {
    padding: 10px 20px;
    color: #787b86;
    text-decoration: none;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s;
}

.ec-tab:hover {
    color: #d1d4dc;
    background: rgba(255,255,255,0.05);
}

.ec-tab.active {
    color: #fff;
    background: #2962ff;
}

.ec-filters-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #363a45;
    color: #d1d4dc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.ec-filters-btn:hover {
    border-color: #2962ff;
    color: #2962ff;
}

.ec-usa-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid #363a45;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.ec-usa-btn:hover {
    border-color: #2962ff;
    background: rgba(41, 98, 255, 0.1);
}

.ec-usa-btn img {
    width: 20px;
    height: 14px;
}

/* Filters panel */
.ec-filters {
    background: #fff;
    padding: 20px;
    border-bottom: 1px solid #e0e3eb;
}

.ec-filter-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.ec-filter-section:last-of-type {
    border-bottom: none;
}

.ec-filter-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.ec-filter-links {
    font-weight: 400;
    font-size: 12px;
}

.ec-filter-links a {
    color: #2962ff;
    text-decoration: none;
    margin-right: 12px;
}

.ec-filter-links a:hover {
    text-decoration: underline;
}

.ec-country-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 40px;
    max-height: 350px;
    overflow-y: auto;
}

.ec-category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 30px;
}

.ec-importance-grid {
    display: flex;
    gap: 30px;
}

.ec-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}

.ec-checkbox input {
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.ec-filter-actions {
    display: flex;
    align-items: center;
    gap: 25px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    margin-top: 5px;
}

.ec-apply-btn {
    padding: 8px 24px;
    background: #2962ff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.ec-apply-btn:hover {
    background: #1e53e4;
}

.ec-reset-link {
    color: #666;
    text-decoration: none;
    font-size: 13px;
}

.ec-reset-link:hover {
    color: #2962ff;
}

/* Time bar */
.ec-time-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: #fff;
    color: #666;
    font-size: 11px;
    border-bottom: 1px solid #e0e3eb;
}

.ec-current-time {
    color: #666;
}

.ec-data-note {
    color: #aaa;
    font-style: italic;
}

.ec-event-count {
    color: #2962ff;
    font-weight: 500;
}

/* Live indicator */
.ec-live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #888;
    font-size: 11px;
}

.ec-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #888;
}

.ec-live-indicator.live .ec-live-dot {
    background: #26a69a;
    box-shadow: 0 0 6px #26a69a;
    animation: pulse 2s infinite;
}

.ec-live-indicator.live .ec-live-text {
    color: #26a69a;
    font-weight: 500;
}

.ec-live-indicator.error .ec-live-dot {
    background: #ef5350;
}

.ec-live-indicator.error .ec-live-text {
    color: #ef5350;
}

.ec-live-indicator.reconnecting .ec-live-dot {
    background: #f5a623;
    animation: blink 1s infinite;
}

.ec-live-indicator.reconnecting .ec-live-text {
    color: #f5a623;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Table */
.ec-table-wrap {
    background: #fff !important;
    overflow-x: auto;
}

.ec-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.ec-table th {
    padding: 10px 12px;
    text-align: left;
    background: #f8f9fa;
    color: #555;
    font-weight: 600;
    font-size: 11px;
    border-bottom: 1px solid #e0e3eb;
}

.ec-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    color: #333;
    background: #fff;
    font-size: 12px;
}

.ec-table .col-time { width: 50px; color: #666; }
.ec-table .col-cur { width: 100px; }
.ec-table .col-imp { width: 60px; }
.ec-table .col-actual,
.ec-table .col-forecast,
.ec-table .col-previous { width: 80px; text-align: right; color: #333; }

.ec-table th.col-actual,
.ec-table th.col-forecast,
.ec-table th.col-previous { text-align: right; }

/* Date row */
.ec-date-row {
    background: #f0f7ff !important;
}

.ec-date-row td {
    font-weight: 500;
    color: #1976d2;
    padding: 8px 15px;
    background: #f0f7ff !important;
    font-size: 12px;
}

/* Event rows */
.ec-event-row {
    background: #fff;
}

.ec-event-row:hover {
    background: #fafafa;
}

.ec-event-row:hover td {
    background: #fafafa;
}

.ec-event-row .col-cur {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ec-ccode {
    font-size: 10px;
    color: #999;
    margin-right: 2px;
}

/* Flags - using flag-icons library */
.fi {
    margin-right: 6px;
    font-size: 1em;
}

/* Unit suffix */
.unit {
    font-size: 10px;
    margin-left: 2px;
}

.col-actual .unit {
    color: inherit;
}

.col-forecast .unit,
.col-previous .unit {
    color: #888;
}

/* Tooltip */
.event-name {
    position: relative;
    cursor: help;
}

.event-name[data-tooltip]:not([data-tooltip=""]):hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 5px;
    background: #1e222d;
    color: #fff;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
    max-width: 300px;
    width: max-content;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    white-space: normal;
}

.event-name[data-tooltip]:not([data-tooltip=""]):hover::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 100%;
    border: 6px solid transparent;
    border-bottom-color: #1e222d;
    z-index: 1001;
}

/* Importance stars */
.importance-stars {
    display: inline-flex;
    gap: 0;
}

.importance-stars .star {
    font-size: 11px;
}

.importance-stars .star.filled { color: #f5a623; }
.importance-stars .star.empty { color: #ccc; }
.importance-stars.high .star.filled { color: #ff5252; }
.importance-stars.medium .star.filled { color: #f5a623; }
.importance-stars.low .star.filled { color: #bbb; }

/* Actual values */
.actual-better {
    color: #26a69a !important;
    font-weight: 600;
}

.actual-worse {
    color: #ef5350 !important;
    font-weight: 600;
}

/* Empty/Error states */
.ec-empty, .ec-error {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.ec-error {
    color: #ef5350;
    background: #ffebee;
}

/* Responsive */
@media (max-width: 768px) {
    .ec-page-layout {
        padding: 0 10px; /* Reduce side padding on mobile */
    }

    .ec-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    .ec-tabs {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }

    .ec-tab {
        padding: 8px 12px;
        font-size: 12px;
    }

    .ec-filters-btn {
        width: 100%;
        justify-content: center;
    }

    .ec-country-grid {
        grid-template-columns: 1fr;
    }

    .ec-category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ec-table th,
    .ec-table td {
        padding: 8px 6px; /* Reduce cell padding on mobile */
        font-size: 11px;
    }

    .ec-table .col-forecast,
    .ec-table .col-previous {
        display: none;
    }

    .ec-time-bar {
        flex-direction: column;
        text-align: center;
        gap: 5px;
        padding: 8px 10px;
    }

    /* Make table scroll horizontally if needed */
    .ec-table-wrap {
        margin: 0 -10px; /* Extend to screen edges */
        width: calc(100% + 20px);
    }
}
