/* LeapRate Economic Calendar – v2.3 – Clean UX */

/* ─── THEME OVERRIDES ──────────────────────────────────── */
/* Reporter theme adds ::before/::after pseudo-elements to
   ALL buttons with red backgrounds. Kill ONLY those overlays. */

#lr-ecal-root button {
    position: relative !important;
    overflow: hidden !important;
    z-index: 1 !important;
}

#lr-ecal-root button::before,
#lr-ecal-root button::after,
.lr-ecal-wrapper button::before,
.lr-ecal-wrapper button::after,
.ecal-filter-panel button::before,
.ecal-filter-panel button::after {
    display: none !important;
    content: none !important;
    background: none !important;
    position: static !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
}

/* ─── END THEME OVERRIDES ──────────────────────────────── */

/* ─── Page Wrapper ─────────────────────────────────────── */

.lr-ecal-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 0 60px;
}

/* ─── Hero Section ─────────────────────────────────────── */

.lr-ecal-hero {
    background: linear-gradient(135deg, #191a1e 0%, #2d2e33 100%);
    border-radius: 12px;
    margin: 24px 0 0;
    overflow: hidden;
}

.lr-ecal-hero-inner {
    padding: 32px 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
}

.lr-ecal-hero-text {
    flex: 1;
    min-width: 300px;
}

.lr-ecal-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #22c55e;
    margin: 0 0 12px;
    padding: 4px 12px;
    background: rgba(34,197,94,0.1);
    border-radius: 20px;
}

.lr-ecal-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34,197,94,0.6);
    display: inline-block;
    animation: lr-pulse 2s infinite;
}

@keyframes lr-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.lr-ecal-hero-title {
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 10px;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.lr-ecal-hero-desc {
    font-size: 14px;
    color: #9ca3af;
    line-height: 1.6;
    margin: 0;
    max-width: 540px;
}

.lr-ecal-hero-stats {
    display: flex;
    gap: 24px;
}

.lr-ecal-stat {
    text-align: center;
    padding: 12px 20px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    min-width: 90px;
}

.lr-ecal-stat-num {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: #f08420;
    line-height: 1.2;
}

.lr-ecal-stat-label {
    display: block;
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Calendar Card ────────────────────────────────────── */

.lr-ecal-card {
    margin-top: 20px;
    border: 1px solid var(--lr-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
    background: var(--lr-bg);
}

/* ─── Guide Wrapper ────────────────────────────────────── */

.lr-ecal-guide-wrapper {
    margin-top: 48px;
    border-top: 1px solid var(--lr-border);
    padding-top: 8px;
}

/* ─── Responsive hero ──────────────────────────────────── */

@media (max-width: 768px) {
    .lr-ecal-hero-inner {
        padding: 24px 20px;
        flex-direction: column;
        align-items: flex-start;
    }
    .lr-ecal-hero-title { font-size: 22px; }
    .lr-ecal-hero-stats { gap: 12px; }
    .lr-ecal-stat { padding: 10px 14px; min-width: 70px; }
    .lr-ecal-stat-num { font-size: 16px; }
    .lr-ecal-wrapper { padding: 0 12px 40px; }
    .lr-ecal-card { border-radius: 8px; }
    .lr-ecal-hero { border-radius: 8px; margin-top: 16px; }
}

:root {
    --lr-orange: #f08420;
    --lr-orange-bg: #fff7ed;
    --lr-orange-border: #fed7aa;
    --lr-orange-dark: #c2410c;
    --lr-dark: #191a1e;
    --lr-text: #1f2937;
    --lr-text-secondary: #4b5563;
    --lr-muted: #9ca3af;
    --lr-light: #d1d5db;
    --lr-border: #e5e7eb;
    --lr-border-light: #f3f4f6;
    --lr-bg: #ffffff;
    --lr-bg-alt: #f9fafb;
    --lr-green: #16a34a;
    --lr-green-bg: #f0fdf4;
    --lr-red: #dc2626;
    --lr-red-bg: #fef2f2;
    --lr-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── Container ────────────────────────────────────────── */

#lr-ecal-root {
    font-family: var(--lr-font);
    background: var(--lr-bg);
    color: var(--lr-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ─── Toolbar ──────────────────────────────────────────── */

.ecal-toolbar {
    background: var(--lr-bg);
    border-bottom: 3px solid var(--lr-orange);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border-radius: 0; /* Inside card, no own radius */
}

/* ─── Date Picker ──────────────────────────────────────── */

.ecal-date-picker {
    display: flex;
    align-items: center;
    border: 1px solid var(--lr-border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--lr-bg);
}

.ecal-date-picker button {
    padding: 8px 12px !important;
    background: #ffffff !important;
    border: none !important;
    color: #4b5563 !important;
    font-size: 13px !important;
    font-family: var(--lr-font) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
}

.ecal-date-picker button:hover {
    background: var(--lr-bg-alt) !important;
}

.ecal-date-picker .ecal-date-label {
    padding: 8px 16px;
    border-left: 1px solid var(--lr-border);
    border-right: 1px solid var(--lr-border);
    color: var(--lr-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

/* ─── Today Button ─────────────────────────────────────── */

.ecal-today-btn {
    padding: 8px 14px !important;
    background: #ffffff !important;
    border: 1px solid var(--lr-orange) !important;
    border-radius: 6px !important;
    color: var(--lr-orange) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    font-family: var(--lr-font) !important;
    display: inline-flex !important;
    align-items: center !important;
    cursor: pointer !important;
}

.ecal-today-btn:hover {
    background: var(--lr-orange-bg) !important;
}

/* ─── Timezone Picker ──────────────────────────────────── */

.ecal-tz-wrap {
    position: relative;
}

.ecal-tz-btn {
    padding: 8px 14px !important;
    background: #ffffff !important;
    border: 1px solid var(--lr-border) !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    color: var(--lr-text) !important;
    font-family: var(--lr-font) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    cursor: pointer !important;
}

.ecal-tz-btn:hover {
    border-color: var(--lr-muted);
}

.ecal-tz-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    z-index: 200;
    background: var(--lr-bg);
    border: 1px solid var(--lr-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    overflow: hidden;
    min-width: 200px;
}

.ecal-tz-dropdown button {
    display: block !important;
    width: 100% !important;
    padding: 9px 14px !important;
    border: none !important;
    text-align: left !important;
    background: #ffffff !important;
    color: var(--lr-text) !important;
    font-size: 13px !important;
    font-family: var(--lr-font) !important;
    border-bottom: 1px solid var(--lr-border-light) !important;
    cursor: pointer !important;
}

.ecal-tz-dropdown button:hover {
    background: var(--lr-bg-alt);
}

.ecal-tz-dropdown button.active {
    background: var(--lr-orange-bg);
    color: var(--lr-orange-dark);
    font-weight: 600;
}

/* ─── Filter Toggle Button ─────────────────────────────── */

.ecal-filter-btn {
    padding: 8px 18px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    font-family: var(--lr-font) !important;
    border: 2px solid var(--lr-dark) !important;
    background: var(--lr-dark) !important;
    color: #ffffff !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    cursor: pointer !important;
}

.ecal-filter-btn:hover {
    background: #2d2e33;
}

.ecal-filter-btn.active {
    background: var(--lr-orange);
    border-color: var(--lr-orange);
}

.ecal-filter-badge {
    background: #fff;
    color: var(--lr-dark);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
}

/* ─── Filter Panel ─────────────────────────────────────── */

.ecal-filter-panel {
    background: var(--lr-bg-alt);
    border-bottom: 1px solid var(--lr-border);
    padding: 20px 24px 16px;
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}

.ecal-filter-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--lr-muted);
    margin-bottom: 10px;
}

.ecal-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Chips: pill-shaped toggle buttons */
.ecal-chip {
    padding: 6px 14px !important;
    font-size: 12px !important;
    border-radius: 20px !important;
    font-family: var(--lr-font) !important;
    border: 1px solid var(--lr-border) !important;
    background: #ffffff !important;
    color: var(--lr-text-secondary) !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    line-height: 1.4 !important;
    cursor: pointer !important;
    margin: 2px !important;
    transition: all 0.15s !important;
    position: relative !important;
    z-index: 1 !important;
}

.ecal-chip:hover {
    border-color: var(--lr-muted) !important;
    background: var(--lr-bg-alt) !important;
}

.ecal-chip.active {
    border-color: var(--lr-orange) !important;
    background: var(--lr-orange-bg) !important;
    color: var(--lr-orange-dark) !important;
    font-weight: 600 !important;
}

/* ─── Column Headers ───────────────────────────────────── */

.ecal-col-header {
    display: grid;
    grid-template-columns: 80px minmax(68px,auto) 1fr 52px 72px 56px 80px 72px 30px;
    padding: 10px 24px;
    border-bottom: 2px solid var(--lr-border);
    font-size: 11px;
    font-weight: 600;
    color: var(--lr-muted);
    background: var(--lr-bg-alt);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* ─── Date Header ──────────────────────────────────────── */

.ecal-date-header {
    padding: 12px 24px;
    background: var(--lr-bg-alt);
    border-bottom: 1px solid var(--lr-border);
    border-top: 1px solid var(--lr-border);
    font-weight: 800;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--lr-text);
    text-align: center;
}

/* ─── Event Row ────────────────────────────────────────── */

.ecal-row {
    display: grid;
    grid-template-columns: 80px minmax(68px,auto) 1fr 52px 72px 56px 80px 72px 30px;
    padding: 11px 24px;
    border-bottom: 1px solid var(--lr-border-light);
    align-items: center;
    cursor: pointer;
    background: var(--lr-bg);
    transition: background 0.1s;
}

.ecal-row:hover {
    background: var(--lr-bg-alt);
}

.ecal-row.expanded {
    background: var(--lr-orange-bg);
    border-bottom: none;
}

/* ─── Time ─────────────────────────────────────────────── */

.ecal-time {
    font-size: 13px;
    color: var(--lr-text-secondary);
}

.ecal-time.countdown {
    font-weight: 700;
    color: var(--lr-orange);
}

/* ─── Flag + Currency ──────────────────────────────────── */

.ecal-ccy {
    font-size: 12px;
    font-weight: 600;
    color: var(--lr-text);
    white-space: nowrap;
}

/* ─── Event Name ───────────────────────────────────────── */

.ecal-event {
    font-size: 13px;
    color: var(--lr-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 8px;
}

.ecal-event.high {
    font-weight: 700;
}

.ecal-event .ecal-period {
    color: var(--lr-muted);
    font-weight: 400;
}

/* ─── Impact Blocks ────────────────────────────────────── */

.ecal-impact {
    display: flex;
    gap: 2px;
    justify-content: center;
}

.ecal-impact-block {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    background: var(--lr-border);
}

.ecal-impact.high .ecal-impact-block {
    background: var(--lr-red);
}

.ecal-impact.medium .ecal-impact-block:nth-child(1),
.ecal-impact.medium .ecal-impact-block:nth-child(2) {
    background: var(--lr-orange);
}

.ecal-impact.low .ecal-impact-block:nth-child(1) {
    background: #facc15;
}

/* ─── Data Cells ───────────────────────────────────────── */

.ecal-cell {
    text-align: right;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: var(--lr-light);
}

.ecal-cell.actual {
    font-weight: 700;
}

.ecal-cell.actual.better {
    color: var(--lr-green);
}

.ecal-cell.actual.worse {
    color: var(--lr-red);
}

.ecal-cell.actual.has-value {
    color: var(--lr-text);
}

.ecal-cell.dev.positive {
    color: var(--lr-green);
}

.ecal-cell.dev.negative {
    color: var(--lr-red);
}

.ecal-cell.consensus {
    color: var(--lr-text-secondary);
}

.ecal-cell.previous {
    color: var(--lr-text-secondary);
    font-weight: 500;
}

/* ─── Locked Label ─────────────────────────────────────── */

.ecal-locked {
    font-size: 11px;
    color: var(--lr-muted);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.ecal-locked-icon {
    font-size: 10px;
}

/* ─── Bell ─────────────────────────────────────────────── */

.ecal-bell {
    text-align: center;
    font-size: 14px;
    color: var(--lr-light);
    cursor: pointer;
    transition: color 0.15s;
}

.ecal-bell:hover {
    color: var(--lr-orange);
}

/* ─── Expanded Detail ──────────────────────────────────── */

.ecal-detail {
    padding: 20px 24px 24px;
    background: var(--lr-bg-alt);
    border-bottom: 2px solid var(--lr-border);
    border-left: 3px solid var(--lr-orange);
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

.ecal-detail-desc {
    flex: 2;
    min-width: 280px;
    font-size: 13px;
    color: var(--lr-text-secondary);
    line-height: 1.7;
}

.ecal-detail-meta {
    flex: 1;
    min-width: 200px;
}

.ecal-detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    font-size: 13px;
}

.ecal-detail-label {
    font-weight: 700;
    color: var(--lr-text);
}

.ecal-detail-value {
    color: var(--lr-text-secondary);
}

.ecal-detail-source {
    color: var(--lr-orange);
    font-weight: 600;
}

.ecal-detail-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.ecal-detail-actions button,
.ecal-detail-actions .ecal-action-btn {
    padding: 6px 14px !important;
    border-radius: 6px !important;
    border: 1px solid var(--lr-border) !important;
    background: #ffffff !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    font-family: var(--lr-font) !important;
    color: var(--lr-text-secondary) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
}

.ecal-detail-actions button:hover,
.ecal-detail-actions .ecal-action-btn:hover {
    border-color: var(--lr-orange) !important;
    color: var(--lr-orange) !important;
    background: var(--lr-orange-bg) !important;
}

.ecal-detail-actions button svg,
.ecal-detail-actions .ecal-action-btn svg {
    flex-shrink: 0;
}

.ecal-detail-actions button:hover {
    border-color: var(--lr-orange);
    background: var(--lr-orange-bg);
}

/* ─── Empty State ──────────────────────────────────────── */

.ecal-empty {
    padding: 60px 24px;
    text-align: center;
    color: var(--lr-muted);
    font-size: 14px;
}

.ecal-reset-btn {
    padding: 8px 20px !important;
    background: #ffffff !important;
    border: 1px solid var(--lr-orange) !important;
    border-radius: 6px !important;
    color: var(--lr-orange) !important;
    font-size: 12px !important;
    font-family: var(--lr-font) !important;
    font-weight: 600 !important;
    margin-top: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    cursor: pointer !important;
}

.ecal-reset-btn:hover {
    background: var(--lr-orange-bg);
}

/* ─── Utility ──────────────────────────────────────────── */

.text-right { text-align: right; }
.text-center { text-align: center; }

/* ─── Guide Content ────────────────────────────────────── */

.lr-ecal-guide {
    max-width: 820px;
    margin: 0 auto;
    padding: 40px 0 20px;
    color: #4b5563;
    font-size: 15px;
    line-height: 1.75;
}

.lr-ecal-guide h2 {
    font-size: 22px;
    font-weight: 700;
    color: #191a1e;
    margin: 40px 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f08420;
    display: inline-block;
}

.lr-ecal-guide h2:first-child {
    margin-top: 0;
}

.lr-ecal-guide h3 {
    font-size: 17px;
    font-weight: 600;
    color: #1f2937;
    margin: 28px 0 8px;
}

.lr-ecal-guide p {
    margin: 0 0 16px;
}

.lr-ecal-guide strong {
    color: #1f2937;
    font-weight: 600;
}

/* ─── Responsive ───────────────────────────────────────── */

@media (max-width: 768px) {
    .ecal-col-header, .ecal-row {
        grid-template-columns: 60px 52px 1fr 40px 60px 50px 64px 58px 24px;
        padding-left: 12px;
        padding-right: 12px;
    }
    .ecal-toolbar { padding: 8px 12px; gap: 8px; }
    .ecal-date-header { padding: 8px 12px; }
    .ecal-event { font-size: 12px; }
    .ecal-cell { font-size: 12px; }
    .ecal-filter-panel { padding: 14px 12px; gap: 16px; }
    .lr-ecal-hero-inner { padding: 24px 20px; flex-direction: column; align-items: flex-start; }
    .lr-ecal-hero-title { font-size: 22px; }
    .lr-ecal-hero-stats { gap: 12px; }
    .lr-ecal-stat { padding: 10px 14px; min-width: 70px; }
    .lr-ecal-stat-num { font-size: 16px; }
    .lr-ecal-wrapper { padding: 0 12px 40px; }
    .lr-ecal-card { border-radius: 8px; }
    .lr-ecal-hero { border-radius: 8px; margin-top: 16px; }
}

@media (max-width: 480px) {
    .ecal-col-header, .ecal-row {
        grid-template-columns: 50px 44px 1fr 36px 52px 52px 24px;
    }
    .ecal-col-header > span:nth-child(6),
    .ecal-col-header > span:nth-child(7),
    .ecal-row > span:nth-child(6),
    .ecal-row > span:nth-child(7) {
        display: none;
    }
    .ecal-date-picker .ecal-date-label { font-size: 11px; padding: 6px 10px; }
}
