/* ===== Admin Page Common Styles ===== */
/* Shared across all admin pages — loaded once via ui_head */

.top-nav {
    padding: 16px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.content-area {
    padding: 16px 20px 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.content-area-wide {
    padding: 16px 20px 40px 20px;
    max-width: 1540px;
    margin: 0 auto;
}

.content-area-narrow {
    padding: 32px;
    max-width: 1000px;
    margin: 0 auto;
}

.content-area-tight {
    padding: 32px;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== Info Row (Settings) ===== */
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid var(--border-main);
    font-size: 13px;
}

.info-row:last-child {
    border-bottom: none;
}

/* ===== Stat Grid ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
}

/* ===== Dashboard Grid ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Candidates Page ===== */
.pos-card {
    margin-bottom: 16px;
}

.cand-item {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.03);
    border: 1px solid var(--border-main);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: default;
    transition: all 0.2s ease;
    position: relative;
}

.cand-item.dragging {
    opacity: 0.4;
    transform: scale(0.97);
    border-color: var(--accent);
}

.cand-item.drag-over {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.cand-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.drag-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4px 0 0;
    cursor: grab;
    opacity: 0.35;
    transition: opacity 0.2s;
}

.drag-handle:hover {
    opacity: 0.8;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle svg {
    pointer-events: none;
}

.drag-dots {
    display: grid;
    grid-template-columns: repeat(3, 5px);
    gap: 2px;
}

.drag-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
}

.cand-item.copied {
    animation: copyPulse 0.5s ease;
}

@keyframes copyPulse {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.4); }
}

.cand-item.pasted {
    animation: pastePulse 0.5s ease;
}

@keyframes pastePulse {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4); }
}

.drop-zone {
    min-height: 40px;
    border: 2px dashed transparent;
    border-radius: 10px;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.drop-zone.active {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.05);
    min-height: 50px;
}

/* ===== Context Menu ===== */
.ctx-menu {
    position: fixed;
    z-index: 2000;
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 6px;
    min-width: 180px;
    animation: fadeInUp 0.15s ease;
}

.ctx-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-main);
    transition: background 0.15s;
}

.ctx-menu-item:hover {
    background: rgba(99, 102, 241, 0.1);
}

.ctx-menu-item i,
.ctx-menu-item svg {
    width: 16px;
    height: 16px;
}

.ctx-sep {
    height: 1px;
    background: var(--border-main);
    margin: 4px 8px;
}

/* ===== Paste Target Modal ===== */
.paste-target-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1500;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.paste-target-modal.active {
    display: flex;
}

.paste-modal-content {
    background: var(--bg-card);
    padding: 28px;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-main);
    animation: slideUp 0.3s ease;
}

.paste-pos-item {
    padding: 12px 16px;
    border: 1px solid var(--border-main);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 14px;
}

.paste-pos-item:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
}

/* ===== Elections Page ===== */
.ip-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

/* ===== Results Page ===== */
.result-item {
    margin-bottom: 20px;
}

.progress-bar-wrap {
    height: 10px;
    background: var(--border-main);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    height: 100%;
    transition: width 1s ease;
}

.refresh-spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== Leaderboard Page ===== */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    border-radius: 20px;
    color: var(--success);
    font-size: 11px;
    font-weight: 800;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

.rank-card {
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-main);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.rank-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
}

.rank-gold   { background: rgba(245, 158, 11, 0.1); color: #f59e0b; border: 1px solid #f59e0b; }
.rank-silver { background: rgba(148, 163, 184, 0.1); color: #94a3b8; border: 1px solid #94a3b8; }
.rank-bronze { background: rgba(180, 83, 9, 0.1); color: #b45309; border: 1px solid #b45309; }
.rank-default { background: var(--bg-page); color: var(--text-muted); border: 1px solid var(--border-main); }

.progress-mini {
    height: 6px;
    background: var(--border-main);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-mini-fill {
    height: 100%;
    transition: width 0.8s ease;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    padding: 32px;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    border: 1px solid var(--border-main);
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== Print Styles ===== */
@media print {
    .admin-sidebar, .top-nav, .theme-toggle, .no-print {
        display: none !important;
    }
    .admin-main { margin-left: 0 !important; }
    .content-area { padding: 0; }
    .ui-card { border: 1px solid #ddd !important; box-shadow: none !important; }
}
