/* ═══════════════════════════════════════════════════════════════════
   VOTERS SEARCH — Premium Dark-Mode RTL CSS
   ═══════════════════════════════════════════════════════════════════ */
/* ── Custom Properties ─────────────────────────────────────────────── */
:root {
    --bg-base: #0d1117;
    --bg-surface: #161b22;
    --bg-surface2: #1c2333;
    --bg-elevated: #21262d;
    --bg-hover: #292f3d;
    --accent: #3fb950;
    --accent-dim: #238636;
    --accent-glow: rgba(63, 185, 80, 0.25);
    --blue: #58a6ff;
    --blue-dim: #1f6feb;
    --blue-glow: rgba(88, 166, 255, 0.20);
    --gold: #e3b341;
    --gold-dim: rgba(227, 179, 65, 0.15);
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    --border: #30363d;
    --border-focus: #58a6ff;
    --red: #f85149;
    --red-dim: rgba(248, 81, 73, 0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --transition: 0.2s ease;
    --font: 'Cairo', 'Tahoma', sans-serif;
}

/* ── Reset & Base ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--text-primary);
    direction: rtl;
    min-height: 100vh;
    line-height: 1.6;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(63, 185, 80, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(88, 166, 255, 0.06) 0%, transparent 60%);
}

/* ── Header ─────────────────────────────────────────────────────────── */
.site-header {
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-surface2) 100%);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-icon {
    font-size: 2rem;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent) 0%, var(--blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.site-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.1rem;
}

/* ── Main content ───────────────────────────────────────────────────── */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ── Search Card ─────────────────────────────────────────────────────── */
.search-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
    transition: box-shadow var(--transition);
}

.search-card:focus-within {
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-focus);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-icon {
    font-size: 1.25rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

/* ── Yamli global button ────────────────────────────────────────────── */
.yamli-global-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.8rem;
    padding: 0.4rem 0.9rem;
    transition: all var(--transition);
}

.yamli-global-btn.yamli-active {
    background: var(--gold-dim);
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 10px var(--gold-dim);
}

.yamli-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--transition);
}

.yamli-global-btn.yamli-active .yamli-dot {
    background: var(--gold);
    box-shadow: 0 0 6px var(--gold);
}

/* ── Form Grids ─────────────────────────────────────────────────────── */
.form-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1100px) {
    .form-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {

    .form-grid-4,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* ── Field Group ────────────────────────────────────────────────────── */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

/* ── Input Wrapper ─────────────────────────────────────────────────── */
.input-wrapper {
    position: relative;
    display: flex;
}

.input-wrapper .field-input {
    flex: 1;
    padding-left: 2.5rem;
}

/* ── Inputs & Selects ───────────────────────────────────────────────── */
.field-input,
.field-select {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    padding: 0.6rem 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    outline: none;
    appearance: none;
}

.field-input::placeholder {
    color: var(--text-muted);
}

.field-input:hover,
.field-select:hover {
    border-color: var(--text-muted);
    background: var(--bg-hover);
}

.field-input:focus,
.field-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--blue-glow);
    background: var(--bg-hover);
}

.field-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    padding-left: 2rem;
}

.field-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.field-input.yamli-on {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold-dim);
    background: rgba(227, 179, 65, 0.04);
}

/* ── Yamli Per-Field Toggle ─────────────────────────────────────────── */
.yamli-toggle-btn {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.yamli-toggle-btn.active {
    background: var(--gold-dim);
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 8px rgba(227, 179, 65, 0.3);
}

/* ── Actions Row ────────────────────────────────────────────────────── */
.form-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}

/* ── Gender Pills ───────────────────────────────────────────────────── */
.gender-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.radio-pills {
    display: flex;
    gap: 0.5rem;
}

.radio-pill {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.35rem 0.9rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all var(--transition);
    user-select: none;
}

.radio-pill input[type="radio"] {
    display: none;
}

.radio-pill:has(input:checked) {
    background: var(--blue-glow);
    border-color: var(--blue);
    color: var(--blue);
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.action-btns {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.65rem 1.5rem;
    transition: all var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-dim) 0%, var(--accent) 100%);
    color: #0d1117;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    border-color: var(--red);
    color: var(--red);
}

/* ── Results Section ────────────────────────────────────────────────── */
.results-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--bg-surface2);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.results-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.results-count {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
}

.results-page {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ── Table ──────────────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.results-table thead th {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 0.75rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.results-table tbody tr {
    border-bottom: 1px solid rgba(48, 54, 61, 0.6);
    transition: background var(--transition);
}

.results-table tbody tr:hover {
    background: var(--bg-hover);
}

.results-table tbody tr:last-child {
    border-bottom: none;
}

.results-table tbody td {
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    vertical-align: middle;
    text-align: right;
}

.results-table tbody td:first-child {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-male {
    background: var(--blue-glow);
    color: var(--blue);
}

.badge-female {
    background: var(--red-dim);
    color: var(--red);
}

/* ── Pagination ─────────────────────────────────────────────────────── */
.results-footer {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-surface2);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    padding: 0 0.5rem;
}

.page-btn:hover:not(.active):not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--blue);
    color: var(--blue);
}

.page-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: #0d1117;
    font-weight: 700;
}

.page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ── Empty / Info States ────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.empty-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.info-message {
    text-align: center;
    padding: 1.5rem;
    color: var(--gold);
    background: var(--gold-dim);
    border-top: 1px solid rgba(227, 179, 65, 0.2);
    font-size: 0.9rem;
}

/* ── Loading spinner ────────────────────────────────────────────────── */
.loading-spinner {
    position: absolute;
    left: 0.5rem;
    bottom: 0.6rem;
    font-size: 0.9rem;
}

/* ── Footer ─────────────────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* ── Scrollbar ──────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ── Row animation ──────────────────────────────────────────────────── */
@keyframes rowFadeIn {
    from {
        opacity: 0;
        background: rgba(63, 185, 80, 0.08);
    }

    to {
        opacity: 1;
        background: transparent;
    }
}

.results-table tbody tr.new-row {
    animation: rowFadeIn 0.4s ease forwards;
}