/* ════════════════════════════════════════════
   Tra cứu Đơn vị Hành chính — admin-units.css
   ════════════════════════════════════════════ */

:root {
    --au-bg:      #0b0f1a;
    --au-surface: rgba(255,255,255,0.04);
    --au-border:  rgba(255,255,255,0.08);
    --au-text:    #f1f5f9;
    --au-text2:   #94a3b8;
    --au-text3:   #64748b;
    --au-accent:  #6366f1;
    --au-accent2: #8b5cf6;
    --au-success: #10b981;
    --au-warning: #f59e0b;
    --au-danger:  #ef4444;
}

/* ── Page ── */
.au-page {
    background: var(--au-bg);
    min-height: 100vh;
    color: var(--au-text);
    font-family: 'Be Vietnam Pro', 'Inter', system-ui, sans-serif;
}

/* ══════════════════════════════════
   HERO + SEARCH
══════════════════════════════════ */
.au-hero {
    background: linear-gradient(160deg, #0d1117 0%, #111827 60%, #0d1117 100%);
    border-bottom: 1px solid var(--au-border);
    padding: 52px 20px 44px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.au-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 70% 60% at 50% -10%, rgba(99,102,241,.14) 0%, transparent 70%);
    pointer-events: none;
}
.au-hero-inner {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
}

.au-hero h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    margin: 0 0 10px;
    background: linear-gradient(135deg, #e2e8f0 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}
.au-hero p {
    color: var(--au-text2);
    font-size: .95rem;
    margin: 0 0 28px;
    line-height: 1.6;
}

/* Search bar */
.au-hero-search {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    margin-bottom: 16px;
    transition: border-color .2s, box-shadow .2s;
}
.au-hero-search:focus-within {
    border-color: rgba(99,102,241,.6);
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.au-hs-icon {
    position: absolute;
    left: 18px;
    color: var(--au-text3);
    pointer-events: none;
    flex-shrink: 0;
}
.au-hs-input {
    width: 100%;
    padding: 16px 52px;
    background: none;
    border: none;
    outline: none;
    color: var(--au-text);
    font-size: 1rem;
    font-family: inherit;
}
.au-hs-input::placeholder { color: var(--au-text3); }
.au-hs-clear {
    position: absolute;
    right: 14px;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: none;
    cursor: pointer;
    color: var(--au-text2);
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.au-hs-clear:hover { background: rgba(255,255,255,0.18); }

/* Filter pills */
.au-hero-pills {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.au-pill {
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid var(--au-border);
    background: none;
    color: var(--au-text3);
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .18s;
    font-family: inherit;
}
.au-pill:hover { border-color: rgba(99,102,241,.4); color: #818cf8; }
.au-pill.active { background: rgba(99,102,241,.15); border-color: rgba(99,102,241,.5); color: #a5b4fc; }

/* ══════════════════════════════════
   MAIN
══════════════════════════════════ */
.au-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px 64px;
}

/* Import notice */
.au-notice-import {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(245,158,11,.07);
    border: 1px solid rgba(245,158,11,.25);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    color: var(--au-text2);
    font-size: .88rem;
}
.au-notice-import strong { color: var(--au-warning); }
.au-notice-import span { flex: 1; min-width: 200px; }
.au-btn-import {
    background: rgba(245,158,11,.15);
    border: 1px solid rgba(245,158,11,.35);
    color: var(--au-warning);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: .83rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: background .2s;
}
.au-btn-import:hover { background: rgba(245,158,11,.25); }
.au-btn-import:disabled { opacity: .55; cursor: not-allowed; }
.au-import-log {
    background: #0d1117;
    border: 1px solid var(--au-border);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 24px;
    font-family: monospace;
    font-size: .8rem;
    color: var(--au-text2);
    max-height: 160px;
    overflow-y: auto;
}
.au-log-line { padding: 2px 0; }
.au-log-error { color: #fca5a5; }

/* ══════════════════════════════════
   PROVINCE GRID
══════════════════════════════════ */
.au-section-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 20px;
}
.au-section-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--au-text);
    margin: 0;
}
.au-section-sub {
    font-size: .8rem;
    color: var(--au-text3);
}

.au-province-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 8px;
}

/* Province button */
.au-prov-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 14px 14px 12px;
    background: var(--au-surface);
    border: 1px solid var(--au-border);
    border-radius: 12px;
    color: var(--au-text);
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background .18s, border-color .18s, transform .15s, box-shadow .18s;
    will-change: transform;
    width: 100%;
}
.au-prov-btn:hover {
    background: rgba(99,102,241,.12);
    border-color: rgba(99,102,241,.45);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(99,102,241,.15);
    color: #c7d2fe;
}
.au-prov-btn:active { transform: translateY(-1px); }

/* Thành phố trực thuộc TW → màu vàng nhạt */
.au-prov-city { border-color: rgba(251,191,36,.2); }
.au-prov-city:hover {
    background: rgba(251,191,36,.1);
    border-color: rgba(251,191,36,.5);
    box-shadow: 0 8px 24px rgba(251,191,36,.12);
}
.au-prov-city .au-prov-name { color: #fde68a; }
.au-prov-city .au-prov-type { color: #f59e0b; border-color: rgba(251,191,36,.2); }

.au-prov-active {
    background: rgba(99,102,241,.2) !important;
    border-color: rgba(99,102,241,.6) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(99,102,241,.2) !important;
}
.au-prov-city.au-prov-active {
    background: rgba(251,191,36,.15) !important;
    border-color: rgba(251,191,36,.6) !important;
    box-shadow: 0 6px 20px rgba(251,191,36,.15) !important;
}

.au-prov-top { display: flex; align-items: center; gap: 8px; }
.au-prov-icon { font-size: 1.1rem; flex-shrink: 0; }
.au-prov-name {
    font-size: .95rem;
    font-weight: 700;
    color: var(--au-text);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.au-prov-type {
    font-size: .65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--au-text3);
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    padding: 1px 7px;
    border-radius: 20px;
    white-space: nowrap;
}

/* Skeleton buttons */
.au-skeleton-btn {
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(255,255,255,.03) 25%, rgba(255,255,255,.07) 50%, rgba(255,255,255,.03) 75%);
    background-size: 200% 100%;
    animation: au-shimmer 1.5s infinite;
}
@keyframes au-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ══════════════════════════════════
   WARD PANEL
══════════════════════════════════ */
.au-ward-panel {
    animation: au-fade-in .2s ease;
}
@keyframes au-fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.au-ward-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.au-ward-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid var(--au-border);
    background: var(--au-surface);
    color: var(--au-text2);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s;
    font-family: inherit;
    white-space: nowrap;
}
.au-ward-back:hover { border-color: rgba(99,102,241,.4); color: #a5b4fc; }

.au-ward-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}
#au-ward-province-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--au-text);
}
.au-ward-count {
    font-size: .78rem;
    color: var(--au-text3);
    background: rgba(255,255,255,.05);
    border: 1px solid var(--au-border);
    padding: 2px 10px;
    border-radius: 20px;
}
.au-ward-search-input {
    padding: 8px 14px;
    background: var(--au-surface);
    border: 1px solid var(--au-border);
    border-radius: 9px;
    color: var(--au-text);
    font-size: .85rem;
    font-family: inherit;
    outline: none;
    width: 220px;
    transition: border-color .2s;
}
.au-ward-search-input:focus { border-color: rgba(99,102,241,.5); }
.au-ward-search-input::placeholder { color: var(--au-text3); }

.au-ward-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}
.au-ward-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    background: var(--au-surface);
    border: 1px solid var(--au-border);
    border-radius: 10px;
    transition: background .15s, border-color .15s;
}
.au-ward-item:hover {
    background: rgba(99,102,241,.07);
    border-color: rgba(99,102,241,.25);
}
.au-ward-icon { font-size: .95rem; flex-shrink: 0; }
.au-ward-name { flex: 1; font-size: .85rem; color: var(--au-text); }
.au-ward-type {
    font-size: .7rem;
    color: var(--au-text3);
    background: rgba(255,255,255,.05);
    padding: 1px 7px;
    border-radius: 10px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ══════════════════════════════════
   SEARCH RESULTS
══════════════════════════════════ */
.au-results { animation: au-fade-in .18s ease; }
.au-results-header {
    color: var(--au-text3);
    font-size: .85rem;
    margin-bottom: 16px;
}
.au-results-header strong { color: var(--au-text2); }

.au-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

/* Result card */
.au-result-card {
    background: var(--au-surface);
    border: 1px solid var(--au-border);
    border-radius: 14px;
    padding: 16px;
    transition: border-color .18s, transform .15s;
}
.au-result-card:hover { border-color: rgba(99,102,241,.3); transform: translateY(-1px); }

.au-card-merged {
    border-color: rgba(245,158,11,.2);
    background: rgba(245,158,11,.03);
}
.au-card-merged:hover { border-color: rgba(245,158,11,.45); }

.au-card-row { display: flex; align-items: center; gap: 12px; }
.au-card-icon { font-size: 1.5rem; flex-shrink: 0; }
.au-icon-old { opacity: .7; }
.au-card-name { font-size: .95rem; font-weight: 700; color: var(--au-text); margin-bottom: 4px; }
.au-card-name mark { background: rgba(99,102,241,.3); color: #c7d2fe; border-radius: 3px; padding: 0 2px; }
.au-name-new { color: #34d399 !important; }
.au-card-sub { display: flex; align-items: center; gap: 6px; }
.au-card-type { font-size: .75rem; font-weight: 600; color: #818cf8; }
.au-card-parent { font-size: .75rem; color: var(--au-text3); }
.au-dot { color: var(--au-text3); font-size: .7rem; }

.au-tag-old {
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
    background: rgba(245,158,11,.12);
    border: 1px solid rgba(245,158,11,.3);
    color: #f59e0b;
    padding: 1px 8px;
    border-radius: 20px;
}
.au-tag-new {
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
    background: rgba(16,185,129,.12);
    border: 1px solid rgba(16,185,129,.3);
    color: #10b981;
    padding: 1px 8px;
    border-radius: 20px;
}

.au-card-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    color: #f59e0b;
    font-size: .75rem;
    font-weight: 600;
    border-top: 1px dashed rgba(245,158,11,.18);
    border-bottom: 1px dashed rgba(245,158,11,.18);
    margin: 8px 0;
}

/* Empty / searching / error */
.au-empty-state { text-align: center; padding: 48px 20px; color: var(--au-text3); }
.au-empty-state p { margin: 14px 0 6px; font-size: .95rem; }
.au-empty-state small { font-size: .8rem; }
.au-empty-state strong { color: var(--au-text2); }
.au-searching { display: flex; align-items: center; gap: 10px; padding: 20px; color: var(--au-text3); font-size: .88rem; }
.au-spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.1); border-top-color: var(--au-accent); border-radius: 50%; animation: au-spin .6s linear infinite; flex-shrink: 0; }
@keyframes au-spin { to { transform: rotate(360deg); } }
.au-error { color: #fca5a5; padding: 12px; font-size: .88rem; }
.au-empty-browse { padding: 20px; color: var(--au-text3); font-size: .85rem; text-align: center; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .au-province-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 640px) {
    /* Main container — extra bottom padding so FABs don't cover content */
    .au-main {
        padding: 24px 16px 140px;
    }

    /* Hero compact */
    .au-hero {
        padding: 36px 16px 32px;
    }

    /* 2-column province grid — cards are wider, more readable, touch-friendly */
    .au-province-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    /* Province card: slightly smaller padding on mobile */
    .au-prov-btn {
        padding: 12px 12px 10px;
        border-radius: 10px;
    }
    .au-prov-name {
        font-size: .88rem;
    }
    .au-prov-type {
        font-size: .68rem;
        padding: 2px 6px;
    }

    /* Section header: stack label + sub-text vertically */
    .au-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        margin-bottom: 14px;
    }
    .au-section-sub {
        font-size: .75rem;
    }

    /* Results + ward grids: single column */
    .au-results-grid { grid-template-columns: 1fr; }
    .au-ward-grid   { grid-template-columns: 1fr; }

    /* Ward header controls */
    .au-ward-header       { flex-wrap: wrap; gap: 10px; }
    .au-ward-search-input { width: 100%; }
    .au-ward-title        { width: 100%; order: -1; }

    /* Filter pills: allow wrapping on small screens */
    .au-hero-pills {
        flex-wrap: wrap;
        gap: 6px;
    }
    .au-pill {
        font-size: .78rem;
        padding: 5px 12px;
    }
}
