/* ==========================================================================
   POLL Admin Dashboard - Premium Modern Stylesheet
   ========================================================================== */

:root {
    --bg-admin: #080c14;
    --bg-surface: #0f172a;
    --bg-surface-hover: #1e293b;
    --bg-card: rgba(15, 23, 42, 0.85);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.04);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --cyan: #06b6d4;
    --emerald: #10b981;
    --purple: #a855f7;
    --amber: #f59e0b;
    --rose: #f43f5e;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --font-sans: 'Pretendard', 'Inter', -apple-system, sans-serif;
    --font-title: 'Outfit', 'Pretendard', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-admin);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Login Page
   ========================================================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: radial-gradient(circle at top center, rgba(99, 102, 241, 0.15), transparent 70%), var(--bg-admin);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    border-radius: 14px;
    color: #ffffff;
    margin-bottom: 16px;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.login-logo svg {
    width: 28px;
    height: 28px;
}

.login-header h2 {
    font-family: var(--font-title);
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
}

.login-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fda4af;
    font-size: 0.88rem;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.login-error svg {
    width: 18px;
    height: 18px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    transition: all 0.2s;
}

.input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.input-wrap svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.input-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 0.95rem;
}

.btn-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    background: var(--primary);
    color: #ffffff;
    font-size: 0.98rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}

.btn-login:hover {
    background: var(--primary-hover);
}

.login-footer {
    margin-top: 24px;
    text-align: center;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.back-link:hover {
    color: #ffffff;
}

/* ==========================================================================
   Admin Layout
   ========================================================================== */
.admin-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.admin-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    border-radius: var(--radius-md);
    color: #ffffff;
}

.brand-icon svg {
    width: 22px;
    height: 22px;
}

.brand-text h1 {
    font-family: var(--font-title);
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.sub-badge {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--cyan);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn svg {
    width: 16px;
    height: 16px;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-danger {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fda4af;
}

.btn-danger:hover {
    background: rgba(244, 63, 94, 0.25);
}

/* Admin Main */
.admin-main {
    flex: 1;
    padding: 28px 32px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
}

.card-glow-indigo { box-shadow: 0 10px 25px -10px rgba(99, 102, 241, 0.2); }
.card-glow-cyan { box-shadow: 0 10px 25px -10px rgba(6, 182, 212, 0.2); }
.card-glow-emerald { box-shadow: 0 10px 25px -10px rgba(16, 185, 129, 0.2); }
.card-glow-purple { box-shadow: 0 10px 25px -10px rgba(168, 85, 247, 0.2); }

.kpi-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon-wrap.indigo { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.kpi-icon-wrap.cyan { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.kpi-icon-wrap.emerald { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.kpi-icon-wrap.purple { background: rgba(168, 85, 247, 0.15); color: #c084fc; }

.kpi-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.kpi-value-wrap {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.kpi-value {
    font-family: var(--font-title);
    font-size: 2.2rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
}

.kpi-unit {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.kpi-subtext {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 20px;
}

.chart-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
}

.chart-title svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.chart-title h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.chart-body {
    position: relative;
    height: 260px;
    width: 100%;
}

.doughnut-chart-body {
    height: 260px;
}

/* Table Section */
.table-section {
    width: 100%;
}

.table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.table-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-title svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.table-title h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
}

.count-badge {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
}

.table-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
}

.search-box svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 0.88rem;
    width: 180px;
}

.select-filter {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 7px 10px;
    font-size: 0.88rem;
    outline: none;
}

.select-filter option {
    background: var(--bg-surface);
    color: #ffffff;
}

.btn-sample-seed {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sample-seed:hover {
    background: rgba(16, 185, 129, 0.25);
}

.btn-sample-seed svg {
    width: 15px;
    height: 15px;
}

/* Responsive Table */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.data-table th {
    background: rgba(0, 0, 0, 0.25);
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: #cbd5e1;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.badge-nps {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.8rem;
}

.badge-promoter { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-passive { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-detractor { background: rgba(244, 63, 94, 0.15); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.3); }

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tag-item {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    color: #94a3b8;
}

.text-truncate-cell {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.actions-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.btn-action.btn-del:hover {
    background: rgba(244, 63, 94, 0.2);
    color: #fda4af;
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
}

.modal-title svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
}

.btn-close-modal:hover {
    color: #ffffff;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-detail-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 18px;
}

.detail-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.detail-val {
    font-size: 0.95rem;
    color: #ffffff;
    line-height: 1.5;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.btn-modal-close {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: #ffffff;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Responsive */
@media (max-width: 900px) {
    .admin-navbar {
        padding: 14px 18px;
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .nav-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .admin-main {
        padding: 18px 14px;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
}
