/* ============================================
   Gmail Checker - Modern Dark Theme
   ============================================ */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #141b2d;
    --bg-card-header: #0f1520;
    --bg-input: #0c1019;
    --bg-hover: rgba(255, 255, 255, 0.04);

    --border: rgba(255, 255, 255, 0.06);
    --border-focus: rgba(34, 197, 94, 0.4);

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #22c55e;
    --accent-hover: #16a34a;
    --accent-glow: rgba(34, 197, 94, 0.15);

    --live: #22c55e;
    --die: #ef4444;
    --verify: #f59e0b;
    --notexist: #6b7280;
    --error: #dc2626;
    --warning: #f59e0b;

    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================
   Lock Screen
   ============================================ */
.lock-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.lock-screen.active {
    display: flex;
}

.lock-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.lock-bg.has-image + .lock-overlay {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}

.lock-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0a0e17 0%, #1a1040 50%, #0a0e17 100%);
}

.lock-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 56px 48px;
    background: rgba(20, 27, 45, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    margin: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
}

.lock-icon {
    color: var(--text-muted);
    margin-bottom: 24px;
    opacity: 0.6;
}

.lock-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.lock-subtitle {
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.lock-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 24px;
}

.lock-hint a {
    color: var(--accent);
}

.lock-branding {
    margin-top: 32px;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.5;
}

.lock-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lock-error {
    color: var(--die);
    font-size: 0.85rem;
    margin-top: 12px;
    min-height: 20px;
}

/* ============================================
   Login Screen (Admin)
   ============================================ */
.login-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

.login-screen.active {
    display: flex;
}

.login-card {
    text-align: center;
    padding: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    margin: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.login-icon {
    color: var(--accent);
    margin-bottom: 20px;
}

.login-card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 0.9rem;
}

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

.login-error {
    color: var(--die);
    font-size: 0.85rem;
    margin-top: 12px;
    min-height: 20px;
}

/* ============================================
   Admin Panel
   ============================================ */
.admin-panel {
    display: none;
}

.admin-content {
    max-width: 920px;
    margin: 0 auto;
    padding: 24px 24px 80px;
}

/* Background Upload Section */
.bg-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.bg-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.bg-preview {
    width: 100%;
    height: 200px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-input);
    margin-bottom: 12px;
    position: relative;
}

.bg-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 8px;
    font-size: 0.85rem;
}

.bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.bg-actions {
    display: flex;
    gap: 10px;
}

.btn-danger {
    color: var(--die) !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
}

.btn-danger:hover {
    border-color: rgba(239, 68, 68, 0.4) !important;
    background: rgba(239, 68, 68, 0.08) !important;
}

/* ============================================
   Toast
   ============================================ */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: var(--accent); }
.toast.error { border-color: var(--die); }

/* ============================================
   Inputs & Buttons
   ============================================ */
.input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 12px 16px;
    font-family: var(--font);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition);
}

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

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

.btn-icon {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 8px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
    background: var(--bg-hover);
}

.btn-icon-sm {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: all var(--transition);
}

.btn-icon-sm:hover { color: var(--die); background: rgba(239, 68, 68, 0.1); }

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: all var(--transition);
}

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

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 8px 16px;
    font-family: var(--font);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-back:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ============================================
   Header
   ============================================ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon { color: var(--accent); }

.header-left h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}

.status-indicator.checking .status-dot {
    background: var(--warning);
    box-shadow: 0 0 6px var(--warning);
    animation: pulse 1s infinite;
}

.status-indicator.error .status-dot {
    background: var(--die);
    box-shadow: 0 0 6px var(--die);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ============================================
   Views
   ============================================ */
.view {
    display: none;
    max-width: 920px;
    margin: 0 auto;
    padding: 24px 24px 80px;
}

.view.active { display: block; }

/* ============================================
   Alert
   ============================================ */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.alert.hidden { display: none; }

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}

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

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

/* ============================================
   Editor (Email Input)
   ============================================ */
.editor-wrapper {
    display: flex;
    min-height: 250px;
    max-height: 400px;
    overflow: hidden;
}

.line-numbers {
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    min-width: 45px;
    background: var(--bg-card-header);
    border-right: 1px solid var(--border);
    text-align: right;
    user-select: none;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.line-numbers span {
    padding: 0 12px 0 8px;
    display: block;
}

#emailInput {
    flex: 1;
    resize: none;
    background: var(--bg-input);
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 16px;
    line-height: 1.6;
    overflow-y: auto;
    tab-size: 4;
}

#emailInput::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Scrollbar styling */
#emailInput::-webkit-scrollbar { width: 6px; }
#emailInput::-webkit-scrollbar-track { background: transparent; }
#emailInput::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
#emailInput::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ============================================
   Check Actions
   ============================================ */
.check-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.btn-check {
    min-width: 180px;
    padding: 14px 32px;
    font-size: 1rem;
    border-radius: var(--radius);
}

.btn-check.loading {
    pointer-events: none;
}

.timer {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.timer-sep {
    color: var(--text-muted);
    padding: 0 2px;
}

/* ============================================
   Progress
   ============================================ */
.progress-wrapper {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.progress-wrapper.hidden { display: none; }

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-card);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #34d399);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 100px;
    text-align: right;
}

/* ============================================
   Badges
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}

.badge:hover { filter: brightness(1.2); }

.badge-count {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent);
    font-weight: 600;
    min-width: 24px;
    text-align: center;
    cursor: default;
}

.badge-total { background: rgba(148, 163, 184, 0.1); color: var(--text-secondary); border: 1px solid rgba(148, 163, 184, 0.15); }
.badge-live { background: rgba(34, 197, 94, 0.1); color: var(--live); border: 1px solid rgba(34, 197, 94, 0.15); }
.badge-die { background: rgba(239, 68, 68, 0.1); color: var(--die); border: 1px solid rgba(239, 68, 68, 0.15); }
.badge-verify { background: rgba(245, 158, 11, 0.1); color: var(--verify); border: 1px solid rgba(245, 158, 11, 0.15); }
.badge-notexist { background: rgba(107, 114, 128, 0.1); color: var(--notexist); border: 1px solid rgba(107, 114, 128, 0.15); }
.badge-error { background: rgba(220, 38, 38, 0.1); color: var(--error); border: 1px solid rgba(220, 38, 38, 0.15); }

.result-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ============================================
   Results
   ============================================ */
.results-body {
    min-height: 200px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state svg { margin-bottom: 16px; opacity: 0.3; }
.empty-title { font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-sub { font-size: 0.85rem; }

.results-table.hidden { display: none; }

.results-table-header {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background: var(--bg-card-header);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.col-index { width: 50px; }
.col-email { flex: 1; }
.col-status { width: 120px; text-align: right; }

.results-list {
    max-height: 450px;
    overflow-y: auto;
}

.results-list::-webkit-scrollbar { width: 6px; }
.results-list::-webkit-scrollbar-track { background: transparent; }
.results-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.result-row {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    animation: fadeIn 0.2s ease;
}

.result-row:last-child { border-bottom: none; }
.result-row:hover { background: var(--bg-hover); }

.result-row .col-index {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

.result-row .col-email {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.result-row .col-status {
    text-align: right;
}

.status-pill {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-pill.live { background: rgba(34, 197, 94, 0.15); color: var(--live); }
.status-pill.die { background: rgba(239, 68, 68, 0.15); color: var(--die); }
.status-pill.verify_phone { background: rgba(245, 158, 11, 0.15); color: var(--verify); }
.status-pill.not_exist { background: rgba(107, 114, 128, 0.15); color: var(--notexist); }
.status-pill.error { background: rgba(220, 38, 38, 0.15); color: var(--error); }

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

/* ============================================
   Admin View
   ============================================ */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.admin-badge {
    padding: 4px 12px;
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 26px;
    cursor: pointer;
    transition: all var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition);
}

.toggle input:checked + .toggle-slider {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: #fff;
}

/* Settings Rows */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
}

.setting-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.setting-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-label {
    font-weight: 500;
    color: var(--text-primary);
}

.status-tag {
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.status-tag.unlocked {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent);
}

.status-tag.locked {
    background: rgba(239, 68, 68, 0.15);
    color: var(--die);
}

/* API Key Display */
.api-key-display {
    margin-bottom: 16px;
}

.api-key-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.api-key-index {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 20px;
}

.api-key-value {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.api-key-value.has-key {
    color: var(--text-primary);
}

.api-key-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.api-key-input-row .input { flex: 1; }

/* ============================================
   Spinner
   ============================================ */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
    .header {
        padding: 12px 16px;
    }

    .header-left h1 {
        font-size: 1rem;
    }

    .view {
        padding: 16px 12px 60px;
    }

    .card-header {
        padding: 12px 16px;
    }

    .result-badges {
        gap: 4px;
    }

    .badge {
        padding: 3px 8px;
        font-size: 0.72rem;
    }

    .check-actions {
        flex-direction: column;
        gap: 12px;
    }

    .btn-check {
        width: 100%;
    }

    .results-table-header,
    .result-row {
        padding: 8px 12px;
    }

    .col-index { width: 35px; }
    .col-status { width: 90px; }

    .result-row .col-email {
        font-size: 0.78rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .api-key-input-row {
        flex-direction: column;
    }

    .setting-row {
        flex-wrap: wrap;
    }

    .setting-row .input {
        flex: 1;
        min-width: 0;
    }
}

/* ============================================
   Utility
   ============================================ */
.hidden { display: none !important; }

/* Selection */
::selection {
    background: rgba(34, 197, 94, 0.3);
    color: var(--text-primary);
}
