/* ============================================================
   Global Events Calendar – Public Styles  v1.0.0
   ============================================================ */

:root {
    --gec-primary:   #2563eb;
    --gec-radius:    10px;
    --gec-shadow:    0 4px 24px rgba(0,0,0,.10);
    --gec-border:    #e2e8f0;
    --gec-bg:        #ffffff;
    --gec-bg-alt:    #f8fafc;
    --gec-text:      #1e293b;
    --gec-muted:     #64748b;
    --gec-today-bg:  #eff6ff;
    --gec-today-ring:#2563eb;
    --gec-header-bg: #1e293b;
    --gec-header-fg: #ffffff;
    --gec-hover:     #f1f5f9;
    --gec-transition:.2s ease;
    --gec-font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Wrapper ────────────────────────────────────────────────── */
.gec-calendar-wrap {
    font-family: var(--gec-font);
    font-size: 14px;
    color: var(--gec-text);
    background: var(--gec-bg);
    border: 1px solid var(--gec-border);
    border-radius: var(--gec-radius);
    box-shadow: var(--gec-shadow);
    overflow: hidden;
    max-width: 100%;
    position: relative;
}

/* ── Toolbar ────────────────────────────────────────────────── */
.gec-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--gec-header-bg);
    color: var(--gec-header-fg);
    padding: 12px 18px;
}
.gec-toolbar-left  { flex: 0 0 auto; }
.gec-toolbar-center { display: flex; gap: 10px; flex-wrap: wrap; flex: 1 1 auto; align-items: center; }
.gec-toolbar-right { flex: 0 0 auto; }

.gec-clock-wrap { line-height: 1.25; }
.gec-clock { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.gec-date-label { display: block; font-size: 12px; opacity: .75; margin-top: 2px; }

.gec-tz-select,
.gec-country-select {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background var(--gec-transition);
}
.gec-tz-select:hover,
.gec-country-select:hover { background: rgba(255,255,255,.22); }
.gec-tz-select option,
.gec-country-select option { color: var(--gec-text); background: #fff; }

.gec-view-switcher { display: flex; gap: 4px; }
.gec-view-btn {
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 6px;
    background: transparent;
    color: rgba(255,255,255,.8);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--gec-transition);
}
.gec-view-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.gec-view-btn.active { background: var(--gec-primary); border-color: var(--gec-primary); color: #fff; }

/* ── Nav Bar ────────────────────────────────────────────────── */
.gec-nav-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: var(--gec-bg);
    border-bottom: 1px solid var(--gec-border);
}
.gec-period-label { flex: 1; font-size: 18px; font-weight: 700; color: var(--gec-text); text-align: center; margin: 0; }
.gec-nav-btn {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--gec-border);
    border-radius: 8px;
    background: var(--gec-bg);
    color: var(--gec-text);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    transition: all var(--gec-transition);
}
.gec-nav-btn:hover { background: var(--gec-hover); border-color: #cbd5e1; }
.gec-today-btn,
.gec-jump-btn {
    padding: 6px 14px;
    border: 1px solid var(--gec-border);
    border-radius: 8px;
    background: var(--gec-bg);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--gec-transition);
    color: var(--gec-text);
}
.gec-today-btn:hover,
.gec-jump-btn:hover { background: var(--gec-hover); }

/* ── Legend ─────────────────────────────────────────────────── */
.gec-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 18px;
    border-bottom: 1px solid var(--gec-border);
    background: var(--gec-bg-alt);
    font-size: 12px;
    color: var(--gec-muted);
}
.gec-legend-item { display: flex; align-items: center; gap: 5px; }
.gec-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── Loading ─────────────────────────────────────────────────── */
.gec-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 0;
    color: var(--gec-muted);
    font-size: 14px;
}
.gec-spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 3px solid var(--gec-border);
    border-top-color: var(--gec-primary);
    border-radius: 50%;
    animation: gec-spin .7s linear infinite;
}
@keyframes gec-spin { to { transform: rotate(360deg); } }

/* ── Month View ──────────────────────────────────────────────── */
.gec-month-view { padding: 0; }

.gec-month-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--gec-bg-alt);
    border-bottom: 1px solid var(--gec-border);
}
.gec-month-header-day {
    padding: 10px 0;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--gec-muted);
    letter-spacing: .5px;
    text-transform: uppercase;
}

.gec-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.gec-day-cell {
    min-height: 110px;
    border-right: 1px solid var(--gec-border);
    border-bottom: 1px solid var(--gec-border);
    padding: 6px;
    background: var(--gec-bg);
    transition: background var(--gec-transition);
    position: relative;
    overflow: hidden;
}
.gec-day-cell:nth-child(7n) { border-right: none; }
.gec-day-cell:hover { background: var(--gec-hover); }
.gec-day-cell.other-month { background: var(--gec-bg-alt); }
.gec-day-cell.other-month .gec-day-num { color: #cbd5e1; }
.gec-day-cell.is-today { background: var(--gec-today-bg); }
.gec-day-cell.is-today .gec-day-num {
    background: var(--gec-today-ring);
    color: #fff;
    border-radius: 50%;
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
}

.gec-day-num {
    font-size: 13px;
    font-weight: 600;
    color: var(--gec-text);
    margin-bottom: 4px;
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    cursor: default;
}

.gec-day-events { display: flex; flex-direction: column; gap: 2px; }
.gec-event-pill {
    display: block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: opacity var(--gec-transition);
    line-height: 1.4;
}
.gec-event-pill:hover { opacity: .85; }
.gec-more-events {
    font-size: 11px;
    color: var(--gec-primary);
    cursor: pointer;
    font-weight: 600;
    padding: 1px 4px;
}
.gec-more-events:hover { text-decoration: underline; }

/* ── Week View ───────────────────────────────────────────────── */
.gec-week-view { padding: 0; }
.gec-week-header {
    display: grid;
    background: var(--gec-bg-alt);
    border-bottom: 1px solid var(--gec-border);
}
.gec-week-col-header {
    padding: 10px 8px;
    text-align: center;
    font-size: 13px;
    border-right: 1px solid var(--gec-border);
}
.gec-week-col-header:last-child { border-right: none; }
.gec-week-col-header .wh-day { font-weight: 700; font-size: 12px; color: var(--gec-muted); text-transform: uppercase; }
.gec-week-col-header .wh-date { font-size: 22px; font-weight: 700; color: var(--gec-text); line-height: 1.2; }
.gec-week-col-header.is-today .wh-date {
    background: var(--gec-primary);
    color: #fff;
    border-radius: 50%;
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
}

.gec-week-body {
    display: grid;
    min-height: 200px;
}
.gec-week-day-col {
    border-right: 1px solid var(--gec-border);
    min-height: 200px;
    padding: 6px;
    background: var(--gec-bg);
}
.gec-week-day-col:last-child { border-right: none; }
.gec-week-day-col.is-today { background: var(--gec-today-bg); }

/* ── Day View ────────────────────────────────────────────────── */
.gec-day-view { padding: 18px; }
.gec-day-view-header { font-size: 22px; font-weight: 700; margin-bottom: 16px; color: var(--gec-text); }
.gec-day-events-list { display: flex; flex-direction: column; gap: 10px; }
.gec-day-event-card {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--gec-bg-alt);
    border-left: 4px solid var(--gec-primary);
    cursor: pointer;
    transition: all var(--gec-transition);
}
.gec-day-event-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); transform: translateY(-1px); }
.gec-day-event-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }
.gec-day-event-info { flex: 1; }
.gec-day-event-name { font-weight: 600; font-size: 14px; color: var(--gec-text); }
.gec-day-event-meta { font-size: 12px; color: var(--gec-muted); margin-top: 3px; }
.gec-no-events { color: var(--gec-muted); text-align: center; padding: 32px 0; font-size: 15px; }

/* ── Upcoming Widget ─────────────────────────────────────────── */
.gec-upcoming-widget { font-family: var(--gec-font); }
.gec-upcoming-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; color: var(--gec-text); }
.gec-upcoming-list { display: flex; flex-direction: column; gap: 10px; }
.gec-upcoming-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    background: var(--gec-bg);
    border: 1px solid var(--gec-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--gec-transition);
}
.gec-upcoming-item:hover { background: var(--gec-hover); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.gec-upcoming-date-badge {
    flex-shrink: 0;
    width: 44px;
    text-align: center;
    background: var(--gec-primary);
    color: #fff;
    border-radius: 8px;
    padding: 4px 2px;
    line-height: 1.2;
}
.gec-upcoming-date-badge .ub-day { font-size: 20px; font-weight: 800; }
.gec-upcoming-date-badge .ub-mon { font-size: 10px; font-weight: 600; text-transform: uppercase; opacity: .9; }
.gec-upcoming-info { flex: 1; min-width: 0; }
.gec-upcoming-name { font-weight: 600; font-size: 13px; color: var(--gec-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gec-upcoming-type { font-size: 11px; color: var(--gec-muted); margin-top: 2px; }

/* ── Modal ───────────────────────────────────────────────────── */
.gec-modal { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; }
.gec-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); }
.gec-modal-box {
    position: relative;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    max-width: 480px;
    width: calc(100% - 32px);
    max-height: 85vh;
    overflow-y: auto;
    animation: gec-modal-in .2s ease;
}
@keyframes gec-modal-in {
    from { opacity: 0; transform: scale(.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1)  translateY(0); }
}
.gec-modal-close {
    position: absolute; top: 12px; right: 14px;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: #f1f5f9; border-radius: 50%;
    font-size: 18px; cursor: pointer; color: var(--gec-muted);
    transition: background var(--gec-transition);
}
.gec-modal-close:hover { background: #e2e8f0; color: var(--gec-text); }
.gec-modal-content { padding: 24px 26px 26px; }
.gec-modal-content .gec-modal-banner {
    height: 6px; border-radius: 4px; margin-bottom: 18px;
}
.gec-modal-content h3 { font-size: 20px; font-weight: 700; margin: 0 0 8px; color: var(--gec-text); }
.gec-modal-content .gec-modal-date { font-size: 13px; color: var(--gec-muted); margin-bottom: 14px; }
.gec-modal-content .gec-modal-badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; color: #fff; margin-bottom: 14px;
}
.gec-modal-content .gec-modal-desc {
    font-size: 14px; line-height: 1.6; color: #475569; margin-bottom: 16px;
}
.gec-modal-content .gec-modal-meta {
    font-size: 12px; color: var(--gec-muted); display: flex; flex-direction: column; gap: 5px;
}
.gec-modal-content .gec-modal-meta span { display: flex; align-items: center; gap: 6px; }
.gec-modal-content .gec-modal-link {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 16px; padding: 9px 18px;
    background: var(--gec-primary); color: #fff;
    border-radius: 8px; font-size: 13px; font-weight: 600;
    text-decoration: none; transition: opacity var(--gec-transition);
}
.gec-modal-content .gec-modal-link:hover { opacity: .88; }

/* ── Day popup (multiple events) ─────────────────────────────── */
.gec-day-popup {
    position: absolute;
    z-index: 9999;
    background: #fff;
    border: 1px solid var(--gec-border);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,.14);
    padding: 14px;
    min-width: 220px;
    max-width: 280px;
    animation: gec-modal-in .15s ease;
}
.gec-day-popup-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--gec-text); border-bottom: 1px solid var(--gec-border); padding-bottom: 6px; }
.gec-day-popup-list { display: flex; flex-direction: column; gap: 5px; }
.gec-day-popup-close {
    position: absolute; top: 8px; right: 8px;
    background: #f1f5f9; border: none; border-radius: 50%;
    width: 22px; height: 22px; font-size: 14px;
    cursor: pointer; color: var(--gec-muted);
}

/* ── Jump popup ──────────────────────────────────────────────── */
.gec-jump-popup {
    position: absolute;
    top: 100px;
    right: 18px;
    z-index: 9998;
    background: #fff;
    border: 1px solid var(--gec-border);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    padding: 12px 14px;
    display: flex;
    gap: 8px;
    align-items: center;
    animation: gec-modal-in .15s ease;
}
.gec-jump-input { border: 1px solid var(--gec-border); border-radius: 6px; padding: 6px 8px; font-size: 13px; }
.gec-jump-go {
    padding: 6px 14px; background: var(--gec-primary); color: #fff;
    border: none; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .gec-toolbar { flex-direction: column; align-items: flex-start; gap: 10px; }
    .gec-toolbar-center { flex-direction: column; align-items: flex-start; }
    .gec-day-cell { min-height: 70px; }
    .gec-clock { font-size: 18px; }
    .gec-period-label { font-size: 15px; }
    .gec-event-pill { font-size: 10px; padding: 1px 4px; }
    .gec-legend { gap: 8px; font-size: 11px; }
}

@media (max-width: 480px) {
    .gec-day-cell { min-height: 52px; padding: 3px; }
    .gec-day-num { font-size: 11px; width: 20px; height: 20px; }
    .gec-month-header-day { font-size: 10px; padding: 6px 0; }
    .gec-nav-bar { padding: 8px 10px; }
    .gec-period-label { font-size: 14px; }
    .gec-event-pill { display: none; }
    .gec-day-cell.has-events::after {
        content: '';
        display: block;
        width: 5px; height: 5px;
        background: var(--gec-primary);
        border-radius: 50%;
        margin: 2px auto 0;
    }
}

/* ── Enhanced Toolbar (matches screenshot) ───────────────────── */
.gec-toolbar {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

/* ── Three-dot menu placeholder ──────────────────────────────── */
.gec-calendar-wrap::before {
    content: '• • •';
    position: absolute;
    top: 14px;
    right: 16px;
    color: rgba(255,255,255,.4);
    font-size: 14px;
    letter-spacing: 3px;
    pointer-events: none;
    z-index: 1;
}

/* ── Month grid: weekend columns subtle tint ─────────────────── */
.gec-day-cell:nth-child(7n+1),
.gec-day-cell:nth-child(7n) {
    background: #fafbff;
}
.gec-day-cell.is-today {
    background: var(--gec-today-bg) !important;
}

/* ── Smooth view transitions ─────────────────────────────────── */
.gec-view {
    animation: gec-fade-in .25s ease;
}
@keyframes gec-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Event pill hover elevation ──────────────────────────────── */
.gec-event-pill {
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
    transition: transform .15s ease, opacity .15s ease, box-shadow .15s ease;
}
.gec-event-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,.2);
    opacity: 1 !important;
}

/* ── Week view: time-slot feel ───────────────────────────────── */
.gec-week-day-col {
    border-top: 3px solid transparent;
    transition: border-color .2s;
}
.gec-week-day-col.is-today {
    border-top-color: var(--gec-primary);
}

/* ── Day view card hover ─────────────────────────────────────── */
.gec-day-event-card:hover {
    background: #fff;
    transform: translateX(4px);
}

/* ── Scrollable month on small screens ───────────────────────── */
@media (max-width: 640px) {
    .gec-body {
        overflow-x: auto;
    }
    .gec-month-view,
    .gec-week-view {
        min-width: 420px;
    }
}

/* ── Print styles ────────────────────────────────────────────── */
@media print {
    .gec-toolbar, .gec-nav-bar .gec-nav-btn,
    .gec-nav-bar .gec-today-btn, .gec-nav-bar .gec-jump-btn,
    .gec-view-switcher { display: none !important; }
    .gec-calendar-wrap { box-shadow: none; border: 1px solid #ccc; }
}

/* ── Dark mode support ───────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    .gec-calendar-wrap {
        --gec-bg:       #1e293b;
        --gec-bg-alt:   #0f172a;
        --gec-text:     #e2e8f0;
        --gec-muted:    #94a3b8;
        --gec-border:   #334155;
        --gec-hover:    #273347;
        --gec-today-bg: #1e3a5f;
        background: var(--gec-bg);
        color: var(--gec-text);
    }
    .gec-day-cell { background: var(--gec-bg); }
    .gec-day-cell:nth-child(7n+1),
    .gec-day-cell:nth-child(7n) { background: #19273a; }
    .gec-modal-box { background: #1e293b; }
    .gec-modal-content h3 { color: #e2e8f0; }
    .gec-modal-content .gec-modal-desc { color: #94a3b8; }
    .gec-jump-popup, .gec-day-popup { background: #1e293b; border-color: #334155; }
}
