/* Red Alert Widget — Premium Dark */

:root {
    --ra-bg: #121318;
    --ra-surface: #1b1c23;
    --ra-surface-2: #23242d;
    --ra-red: #ff3b30;
    --ra-red-glow: rgba(255,59,48,0.35);
    --ra-orange: #ff6b35;
    --ra-text: #eeeef0;
    --ra-text-dim: #8b8d98;
    --ra-border: rgba(255,255,255,0.06);
    --ra-radius: 16px;
    --ra-font: "Heebo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ==================== WIDGET ==================== */
#red-alert-widget {
    position: fixed; top: 20px; right: 20px; z-index: 9999999;
    width: 380px; max-width: calc(100vw - 32px);
    font-family: var(--ra-font); direction: rtl;
    border-radius: var(--ra-radius); overflow: hidden;
    background: var(--ra-bg);
    border: 1px solid var(--ra-border);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.03) inset;
    opacity: 0; transform: translateY(-20px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(.22,1,.36,1);
}
#red-alert-widget.active {
    opacity: 1; transform: translateY(0) scale(1); pointer-events: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 80px -20px var(--ra-red-glow), 0 0 0 1px rgba(255,255,255,0.03) inset;
}

/* Pulsing top-edge glow when active */
#red-alert-widget.active::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--ra-red), var(--ra-orange), var(--ra-red), transparent);
    background-size: 200% 100%;
    animation: ra-glow-bar 2.5s linear infinite;
    z-index: 1;
}
@keyframes ra-glow-bar {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ===== HEADER ===== */
#red-alert-widget .ra-header {
    padding: 14px 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    user-select: none;
    background: linear-gradient(135deg, var(--ra-surface) 0%, var(--ra-bg) 100%);
    border-bottom: 1px solid var(--ra-border);
    position: relative;
}

#red-alert-widget .ra-header-right { display: flex; align-items: center; gap: 12px; min-width: 0; }

#red-alert-widget .ra-live-dot {
    width: 10px; height: 10px; flex-shrink: 0;
    border-radius: 50%;
    background: var(--ra-red);
    box-shadow: 0 0 12px var(--ra-red-glow), 0 0 4px var(--ra-red);
    animation: ra-pulse 1.5s ease-in-out infinite;
}
@keyframes ra-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.75); opacity: 0.4; }
}

#red-alert-widget .ra-header-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#red-alert-widget .ra-title { color: var(--ra-red); font-size: 16px; font-weight: 800; line-height: 1.2; letter-spacing: -0.2px; }
#red-alert-widget .ra-subtitle { color: var(--ra-text-dim); font-size: 11px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#red-alert-widget .ra-controls { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
#red-alert-widget .ra-btn {
    background: var(--ra-surface-2); border: 1px solid var(--ra-border);
    color: var(--ra-text-dim); width: 30px; height: 30px; border-radius: 8px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    padding: 0; transition: all 0.2s; position: relative;
}
#red-alert-widget .ra-btn:hover { background: rgba(255,255,255,0.08); color: var(--ra-text); border-color: rgba(255,255,255,0.12); }
#red-alert-widget .ra-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
#red-alert-widget .ra-btn.muted { opacity: 0.35; }
#red-alert-widget .ra-btn.ra-minimize-btn svg { transition: transform 0.3s ease; }
#red-alert-widget.minimized .ra-btn.ra-minimize-btn svg { transform: rotate(180deg); }

#red-alert-widget .ra-settings-btn.has-cities::after {
    content: ""; position: absolute; top: 2px; right: 2px;
    width: 6px; height: 6px; border-radius: 50%;
    background: #34d399; border: 1.5px solid var(--ra-bg);
    box-shadow: 0 0 6px rgba(52,211,153,0.5);
}
#red-alert-widget.ra-settings-open .ra-settings-btn {
    background: var(--ra-red); color: #fff; border-color: var(--ra-red);
    box-shadow: 0 0 12px var(--ra-red-glow);
}

/* ===== BODY ===== */
#red-alert-widget .ra-body {
    max-height: calc(100vh - 140px); overflow-y: auto;
    transition: max-height 0.3s ease;
}
#red-alert-widget.minimized .ra-body { max-height: 0; overflow: hidden; }
#red-alert-widget.ra-settings-open .ra-body { display: none; }
#red-alert-widget .ra-body::-webkit-scrollbar { width: 4px; }
#red-alert-widget .ra-body::-webkit-scrollbar-track { background: transparent; }
#red-alert-widget .ra-body::-webkit-scrollbar-thumb { background: var(--ra-surface-2); border-radius: 4px; }

/* ===== PROMPT CTA ===== */
#red-alert-widget .ra-prompt {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin: 12px 16px; padding: 10px 18px;
    background: linear-gradient(135deg, rgba(255,59,48,0.12) 0%, rgba(255,107,53,0.08) 100%);
    border: 1px solid rgba(255,59,48,0.2);
    border-radius: 10px;
    font-size: 13px; font-weight: 600; color: var(--ra-red);
    cursor: pointer; transition: all 0.2s;
    text-align: center;
}
#red-alert-widget .ra-prompt:hover {
    background: linear-gradient(135deg, rgba(255,59,48,0.2) 0%, rgba(255,107,53,0.14) 100%);
    border-color: rgba(255,59,48,0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255,59,48,0.15);
}
#red-alert-widget .ra-prompt svg {
    width: 16px; height: 16px; flex-shrink: 0;
    fill: none; stroke: currentColor; stroke-width: 2;
}

/* ===== INLINE SETTINGS ===== */
#red-alert-widget .ra-settings {
    display: none; padding: 16px;
    max-height: calc(100vh - 140px); overflow-y: auto;
}
#red-alert-widget.ra-settings-open .ra-settings { display: block; }
#red-alert-widget.ra-settings-open.minimized .ra-settings { display: block; }
#red-alert-widget.ra-settings-open .ra-btn.ra-minimize-btn svg { transform: rotate(180deg); }

#red-alert-widget .ra-sp-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 4px; font-size: 15px; font-weight: 700; color: var(--ra-text);
}
#red-alert-widget .ra-sp-close {
    background: none; border: none; font-size: 22px; color: var(--ra-text-dim);
    cursor: pointer; padding: 0 2px; line-height: 1; transition: color 0.15s;
}
#red-alert-widget .ra-sp-close:hover { color: var(--ra-text); }
#red-alert-widget .ra-sp-desc { font-size: 12px; color: var(--ra-text-dim); margin-bottom: 14px; line-height: 1.6; }

#red-alert-widget .ra-my-cities { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; min-height: 24px; }
#red-alert-widget .ra-my-city {
    background: linear-gradient(135deg, var(--ra-red), var(--ra-orange));
    color: #fff; font-size: 12px; font-weight: 600;
    padding: 5px 10px 5px 12px; border-radius: 20px;
    display: inline-flex; align-items: center; gap: 6px; line-height: 1.2;
    box-shadow: 0 2px 8px rgba(255,59,48,0.25);
}
#red-alert-widget .ra-remove-city { cursor: pointer; font-size: 14px; opacity: 0.7; transition: opacity 0.15s; }
#red-alert-widget .ra-remove-city:hover { opacity: 1; }
#red-alert-widget .ra-no-cities { font-size: 12px; color: var(--ra-text-dim); text-align: center; padding: 6px 0; opacity: 0.6; }

#red-alert-widget .ra-search {
    width: 100%; height: 40px;
    background: var(--ra-surface-2); border: 1px solid var(--ra-border); border-radius: 10px;
    padding: 0 14px; font-size: 14px; font-family: inherit; direction: rtl;
    color: var(--ra-text); outline: none; box-sizing: border-box; transition: border-color 0.2s, box-shadow 0.2s;
}
#red-alert-widget .ra-search::placeholder { color: var(--ra-text-dim); opacity: 0.5; }
#red-alert-widget .ra-search:focus { border-color: var(--ra-red); box-shadow: 0 0 0 3px rgba(255,59,48,0.1); }

#red-alert-widget .ra-search-results { margin-top: 6px; border-radius: 10px; overflow: hidden; max-height: 220px; overflow-y: auto; }
#red-alert-widget .ra-search-results:empty { display: none; }
#red-alert-widget .ra-search-results:not(:empty) { border: 1px solid var(--ra-border); background: var(--ra-surface); }
#red-alert-widget .ra-search-item {
    display: block; width: 100%; padding: 10px 14px; font-size: 13px; cursor: pointer;
    color: var(--ra-text-dim); background: transparent; border: none; text-align: right;
    font-family: inherit; transition: all 0.15s; border-bottom: 1px solid var(--ra-border); outline: none;
}
#red-alert-widget .ra-search-item:last-child { border-bottom: none; }
#red-alert-widget .ra-search-item:hover { background: rgba(255,59,48,0.08); color: var(--ra-text); }
#red-alert-widget .ra-search-more { padding: 8px 14px; font-size: 11px; color: var(--ra-text-dim); text-align: center; }

/* ===== SECTIONS ===== */
#red-alert-widget .ra-section { padding: 12px 16px; }
#red-alert-widget .ra-section + .ra-section { border-top: 1px solid var(--ra-border); }

#red-alert-widget .ra-section-label {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--ra-text-dim);
    margin-bottom: 10px;
}
#red-alert-widget .ra-section-mine .ra-section-label { color: var(--ra-red); }

/* ===== CHIPS ===== */
#red-alert-widget .ra-chip {
    display: inline-block; padding: 6px 14px; margin: 0 5px 7px 0;
    border-radius: 20px; font-size: 13px; font-weight: 500; line-height: 1.3;
    background: var(--ra-surface-2); color: var(--ra-text-dim);
    border: 1px solid var(--ra-border);
    transition: all 0.2s;
}
#red-alert-widget .ra-chip-mine {
    background: linear-gradient(135deg, rgba(255,59,48,0.15) 0%, rgba(255,107,53,0.1) 100%);
    color: #ff8a80; border-color: rgba(255,59,48,0.25);
    font-weight: 700;
    box-shadow: 0 0 16px rgba(255,59,48,0.1);
    animation: ra-pop 0.4s cubic-bezier(.22,1,.36,1);
}
@keyframes ra-pop {
    0% { transform: scale(0.8); opacity: 0; }
    60% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== SHOW ALL ===== */
#red-alert-widget .ra-show-all {
    display: inline-flex; align-items: center;
    padding: 6px 16px; margin: 0 5px 7px 0;
    border-radius: 20px; font-size: 12px; font-weight: 600;
    background: transparent; color: var(--ra-red);
    border: 1px dashed rgba(255,59,48,0.3);
    cursor: pointer; font-family: inherit; transition: all 0.2s;
}
#red-alert-widget .ra-show-all:hover {
    background: rgba(255,59,48,0.08); border-color: var(--ra-red);
    box-shadow: 0 0 12px rgba(255,59,48,0.1);
}

/* ===== FOOTER ===== */
#red-alert-widget .ra-footer {
    padding: 10px 16px;
    font-size: 11px; color: var(--ra-text-dim); line-height: 1.5;
    border-top: 1px solid var(--ra-border);
    background: rgba(255,255,255,0.01);
}

/* ==================== QUIET MODE ==================== */
#red-alert-widget.ra-quiet {
    width: 320px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
#red-alert-widget.ra-quiet::before { display: none; }
#red-alert-widget.ra-quiet .ra-header { padding: 10px 14px; }
#red-alert-widget.ra-quiet .ra-live-dot { width: 7px; height: 7px; background: var(--ra-text-dim); box-shadow: none; animation: none; opacity: 0.4; }
#red-alert-widget.ra-quiet .ra-title { font-size: 14px; color: var(--ra-text-dim); }
#red-alert-widget.ra-quiet .ra-subtitle { font-size: 10px; }
#red-alert-widget.ra-quiet .ra-section { padding: 10px 14px; }
#red-alert-widget.ra-quiet .ra-chip { font-size: 12px; padding: 4px 10px; }
#red-alert-widget.ra-quiet .ra-btn { width: 26px; height: 26px; }
#red-alert-widget.ra-quiet .ra-btn svg { width: 12px; height: 12px; }
#red-alert-widget.ra-quiet .ra-footer { padding: 8px 14px; font-size: 10px; }

/* ==================== MOBILE ==================== */
@media (max-width: 480px) {
    #red-alert-widget { width: calc(100vw - 20px); right: 10px; top: 10px; border-radius: 14px; }
    #red-alert-widget .ra-body { max-height: 45vh; }
    #red-alert-widget.ra-quiet { width: calc(100vw - 20px); }
}
