/*
 * Mobile shared styles - קולות נודדים
 */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: #1e1e2a;
    --bg-hover: #252535;
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b0;
    --text-muted: #606075;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --border: #2a2a3a;
    --border-light: #35354a;
    --shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    --radius: 10px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Heebo', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

/* ---- Top Bar ---- */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 500;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
}

.home-link {
    text-decoration: none;
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s;
}
.home-link:active { background: var(--bg-hover); }

.top-bar .title {
    flex: 1;
    min-width: 0;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: linear-gradient(135deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.election-pills {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
    mask-image: linear-gradient(to left, transparent, black 12px, black calc(100% - 12px), transparent);
    -webkit-mask-image: linear-gradient(to left, transparent, black 12px, black calc(100% - 12px), transparent);
}
.election-pills::-webkit-scrollbar { display: none; }

.election-pill {
    padding: 4px 8px;
    border-radius: 14px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    min-height: 26px;
    flex-shrink: 0;
    transition: all 0.15s;
}

.election-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ---- Bottom Tabs (scrollable pill bar) ---- */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 6px;
    padding: 6px 10px calc(6px + var(--safe-bottom));
    height: calc(48px + var(--safe-bottom));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-bar a {
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    white-space: nowrap;
    flex-shrink: 0;
    scroll-snap-align: start;
    transition: all 0.15s;
}

.tab-bar a.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.tab-bar a:active:not(.active) {
    background: var(--bg-hover);
}

.tab-bar a .tab-icon {
    font-size: 0.85rem;
    line-height: 1;
}

/* ---- Main Content Area ---- */
.main-area {
    position: fixed;
    top: 44px;
    left: 0;
    right: 0;
    bottom: calc(48px + var(--safe-bottom));
    overflow: hidden;
}

/* ---- Bottom Sheet ---- */
.sheet-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 600;
}

.sheet-backdrop.visible { display: block; }

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 700;
    background: var(--bg-secondary);
    border-radius: 16px 16px 0 0;
    padding: 8px 16px calc(16px + var(--safe-bottom));
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.bottom-sheet.visible { transform: translateY(0); }

.sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 0 auto 12px;
}

/* ---- Floating Action Button ---- */
.fab {
    position: fixed;
    z-index: 400;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    cursor: pointer;
}

.fab:active { transform: scale(0.92); }

/* ---- Common Components ---- */
.search-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}

.search-input:focus { border-color: var(--accent); }

.search-input::placeholder { color: var(--text-muted); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 0.8rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.chip .remove {
    cursor: pointer;
    opacity: 0.6;
    font-size: 1rem;
    line-height: 1;
}

.party-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.party-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.party-name {
    flex: 1;
    font-size: 0.85rem;
}

.party-pct {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.party-bar {
    width: 50px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.party-bar-fill {
    height: 100%;
    border-radius: 3px;
}

/* Stat grid */
.stat-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 8px;
    font-size: 0.8rem;
    margin: 8px 0;
}

.stat-grid .label { color: var(--text-muted); }
.stat-grid .value { color: var(--text-secondary); font-weight: 500; }

/* Loading spinner */
.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 15, 0.8);
    z-index: 300;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Search results dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 10;
}

.search-results.visible { display: block; }

.search-result-item {
    padding: 10px 12px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.search-result-item:active { background: var(--bg-hover); }

.search-result-item .detail {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ---- About / Info Bottom Sheet ---- */
.about-sheet h3 {
    font-size: 1rem;
    margin: 16px 0 8px;
    color: var(--text-primary);
}

.about-sheet h3:first-child { margin-top: 0; }

.about-sheet p {
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0 0 8px;
}

.about-sheet a {
    color: var(--accent);
    text-decoration: none;
}

.about-sheet a:hover { text-decoration: underline; }

.about-sheet .bmc-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #FFDD00;
    color: #000;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    margin-top: 8px;
}

.about-sheet .bmc-inline img {
    width: 20px;
    height: 20px;
}

.about-sheet .discussions-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    text-decoration: none;
    margin-top: 6px;
}

.about-sheet .discussions-link:hover {
    background: var(--bg-hover);
    text-decoration: none;
}

/* ---- Floating BMC Banner ---- */
.bmc-float {
    position: fixed;
    bottom: calc(48px + var(--safe-bottom) + 6px);
    left: 50%;
    transform: translateX(-50%);
    width: fit-content;
    max-width: calc(100% - 20px);
    z-index: 490;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #FFDD00;
    color: #000;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    text-decoration: none;
    animation: bmc-slide-up 0.3s ease-out;
}
.bmc-float img { width: 18px; height: 18px; flex-shrink: 0; }
.bmc-float-text { flex: 1; min-width: 0; }
.bmc-float-close {
    background: none;
    border: none;
    color: #000;
    font-size: 1.1rem;
    line-height: 1;
    padding: 4px;
    cursor: pointer;
    opacity: 0.6;
    flex-shrink: 0;
}
.bmc-float-close:active { opacity: 1; }

@keyframes bmc-slide-up {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ---- Info toggle button (shared) ---- */
.info-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s;
}
.info-toggle:active { border-color: var(--accent); }
