/* Events Calendar – additive styles on top of screener.css */

/* screener.css forces .MainContentArea to overflow:visible so its own page
   can scroll internally; this page relies on the normal flex-scroll region
   (.MainContentArea is a flex:1 / min-height:0 child of #form1), so restore
   scrolling here or the bottom rows end up clipped under the fixed bottom bar. */
.MainContentArea {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.evc-page { gap: 8px; }

/* ── Tabs ── */
.evc-tabs {
    display: flex;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px;
}
.evc-tab {
    flex: 1 1 0;
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 600;
    padding: 9px 10px;
    cursor: pointer;
}
.evc-tab:hover { color: var(--ink-1); }
.evc-tab--active {
    background: var(--accent);
    color: #fff;
}

/* ── Filters ── */
.evc-compact { padding: 10px 14px; }
.evc-filter-row { align-items: center; }
.evc-search-field { flex: 1; min-width: 180px; }

/* ── Table ── */
table.evc-table { table-layout: fixed; width: 100%; }

.evc-col-details { color: var(--ink-2); white-space: normal; word-break: break-word; text-align: left; }

table.evc-table td.evc-col-sym { white-space: normal; }

/* main.css sets a global `td { text-align: right }` with only :first-child reset to left,
   so every non-first column here needs an explicit align or it silently inherits right. */
.evc-col-evt   { text-align: left; }
.evc-col-price { text-align: right; }

/* Date group header row */
table.evc-table tr.evc-date-row td {
    background: #141414;
    color: var(--ink-1);
    font-weight: 700;
    font-size: 12px;
    padding: 8px 10px;
    border-top: 1px solid var(--border);
}
table.evc-table tr.evc-date-row:hover { background: #141414 !important; cursor: default !important; }
.evc-date-day {
    display: inline-block;
    margin-left: 8px;
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-3);
}
.evc-date-count {
    float: right;
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-3);
}

/* Event badges */
.evc-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 3px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.evc-badge-results { background: rgba(62,207,142,.18); color: var(--green); }
.evc-badge-dividend { background: rgba(181,123,238,.18); color: var(--purple); }
.evc-badge-bonus    { background: rgba(79,156,249,.15); color: var(--accent); }
.evc-badge-split    { background: rgba(245,166,35,.14); color: var(--yellow); }
.evc-badge-rights   { background: rgba(245,166,35,.14); color: var(--yellow); }
.evc-badge-buyback  { background: rgba(246,102,102,.14); color: var(--red); }
.evc-badge-meeting  { background: rgba(160,160,160,.15); color: var(--ink-2); }
.evc-badge-other    { background: rgba(160,160,160,.15); color: var(--ink-2); }

.evc-symbol { color: var(--accent); text-decoration: none; font-weight: 600; }
.evc-symbol:hover { text-decoration: underline; }
.evc-name { display: block; font-size: 10px; color: var(--ink-3); font-weight: 400; margin-top: 1px; }

/* ── Holiday table ── */
table.evc-holiday-table .evc-col-hdate { font-weight: 600; color: var(--ink-1); white-space: nowrap; text-align: left; }
table.evc-holiday-table .evc-col-hday  { color: var(--ink-2); text-align: left; }
table.evc-holiday-table .evc-col-hdesc { text-align: left; }

/* ── Economic Calendar table ── */
table.evc-eco-table .evc-col-edate    { font-weight: 600; color: var(--ink-1); white-space: nowrap; text-align: left; }
table.evc-eco-table .evc-col-ecountry { color: var(--ink-2); text-align: left; }
table.evc-eco-table .evc-col-eevt     { text-align: left; }
table.evc-eco-table .evc-col-eimpact  { text-align: center; }
table.evc-eco-table .evc-col-enum     { text-align: right; color: var(--ink-2); }
table.evc-eco-table .evc-col-emore    { text-align: center; }

table.evc-eco-table td.evc-col-eevt { white-space: normal; }

.evc-view-details {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.evc-view-details:hover { text-decoration: underline; }

/* ── Event detail modal ── */
.evc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}
.evc-modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 18px 20px;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.evc-modal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.evc-modal-flag { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.evc-modal-title { flex: 1; font-size: 17px; font-weight: 700; color: var(--ink-1); }
.evc-modal-close {
    background: none;
    border: none;
    color: var(--ink-2);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
}
.evc-modal-close:hover { color: var(--ink-1); }
.evc-modal-meta { font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
.evc-modal-impact-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 14px;
}
.evc-modal-impact-label { color: var(--ink-2); font-weight: 600; margin-right: 2px; }
.evc-modal-tag {
    background: rgba(200,200,200,.16);
    color: var(--ink-1);
    border-radius: 3px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
}
.evc-modal-pills {
    display: flex;
    background: rgba(160,160,160,.08);
    border-radius: 6px;
    padding: 12px 0;
    margin-bottom: 14px;
}
.evc-modal-pill { flex: 1; text-align: center; border-right: 1px solid var(--border); }
.evc-modal-pill:last-child { border-right: none; }
.evc-modal-pill-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-2);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 4px;
}
.evc-modal-pill-val { display: block; font-size: 15px; font-weight: 700; color: var(--ink-1); }
.evc-modal-desc { font-size: 13.5px; line-height: 1.6; color: var(--ink-1); }

.evc-impact {
    display: inline-flex;
    align-items: center;
    border-radius: 3px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}
.evc-impact-high   { background: rgba(246,102,102,.15); color: var(--red); }
.evc-impact-medium { background: rgba(245,166,35,.14);  color: var(--yellow); }
.evc-impact-low    { background: rgba(79,156,249,.15);  color: var(--accent); }

/* ── Responsive: stack each row into a labeled card below ~720px ──
   Fixed percentage columns (24/16/15/45%) collapse into unreadable, overlapping
   text on phone widths, so the table itself is dropped in favor of one card per
   row, with each cell's column name shown via its data-label attribute. */
@media (max-width: 720px) {
    table.evc-table,
    table.evc-holiday-table {
        display: block;
        table-layout: auto;
        width: 100%;
    }

    table.evc-table thead,
    table.evc-holiday-table thead {
        display: none;
    }

    table.evc-table tbody,
    table.evc-table tr,
    table.evc-holiday-table tbody,
    table.evc-holiday-table tr {
        display: block;
        width: 100%;
    }

    table.evc-table tbody tr:not(.evc-date-row),
    table.evc-holiday-table tbody tr {
        background: var(--surface);
        border: 1px solid #3a3a3a;
        border-radius: 8px;
        margin: 0 0 14px;
        overflow: hidden;
        box-shadow: 0 2px 6px rgba(0,0,0,.35);
    }

    table.evc-table td,
    table.evc-holiday-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 10px;
        width: 100% !important;
        padding: 7px 10px;
        border-top: 1px solid var(--border);
        white-space: normal;
        word-break: break-word;
    }
    table.evc-table tr > td:first-child,
    table.evc-holiday-table tr > td:first-child {
        border-top: none;
        background: rgba(255,255,255,.04);
        border-bottom: 1px solid #3a3a3a;
    }

    table.evc-table td[data-label]::before,
    table.evc-holiday-table td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--ink-3);
    }

    table.evc-table td.evc-col-sym,
    table.evc-table td.evc-col-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    /* Date group divider stays a plain full-width bar, not a card */
    table.evc-table tr.evc-date-row {
        margin-bottom: 4px;
    }
    table.evc-table tr.evc-date-row td {
        display: block;
        border-top: none;
    }
}
