:root {
    --bg-main: #080A10;
    --bg-card: rgba(16, 20, 28, 0.75);
    --bg-card-hover: rgba(22, 27, 38, 0.85);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.12);

    --primary: #81C12C;
    --primary-glow: rgba(129, 193, 44, 0.25);
    --primary-hover: #96DF33;
    --primary-dim: #5A8520;

    --danger: #FF4B4B;
    --danger-glow: rgba(255, 75, 75, 0.15);

    --blue: #3B82F6;
    --blue-glow: rgba(59, 130, 246, 0.2);
    --amber: #F59E0B;
    --amber-glow: rgba(245, 158, 11, 0.15);

    --text-main: #E8ECF1;
    --text-muted: #7B8CA3;
    --terminal-bg: #030305;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

/* ─── Background ─── */
.background-effects {
    position: fixed; inset: 0;
    z-index: -1; pointer-events: none; overflow: hidden;
}
.glow-orb {
    position: absolute; border-radius: 50%;
    filter: blur(120px); opacity: 0.4;
}
.orb-1 { width: 500px; height: 500px; background: var(--primary-glow); top: -150px; left: -100px; }
.orb-2 { width: 350px; height: 350px; background: var(--blue-glow); bottom: -80px; right: -80px; }
.orb-3 { width: 250px; height: 250px; background: rgba(168, 85, 247, 0.08); top: 40%; left: 60%; }

/* ─── Layout ─── */
.container {
    width: 100%; max-width: 960px;
    padding: 36px 20px 80px;
    display: flex; flex-direction: column; gap: 16px;
}

/* ─── Header ─── */
.app-header { text-align: center; margin-bottom: 4px; }
.logo {
    font-size: 32px; font-weight: 800; letter-spacing: -0.5px;
    color: #fff;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.subtitle { color: var(--text-muted); font-size: 14px; margin: 6px 0 20px; }

.tabs { display: flex; justify-content: center; gap: 8px; }
.tab-btn {
    background: transparent; border: none;
    color: var(--text-muted); font-size: 14px;
    font-family: inherit; font-weight: 500;
    padding: 10px 18px; cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.25s;
    display: flex; align-items: center; gap: 7px;
}
.tab-btn:hover { color: #ddd; }
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    text-shadow: 0 0 12px var(--primary-glow);
}

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
    position: relative;
}
.card h2 {
    font-size: 16px; font-weight: 600;
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 9px;
    color: #fff;
}
.ai-section {
    border-color: rgba(129, 193, 44, 0.15);
    background: rgba(129, 193, 44, 0.03);
}

.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px; flex-wrap: wrap; gap: 10px;
}
.section-header h2 { margin-bottom: 0; }
.header-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ─── Inputs ─── */
input, textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--text-main);
    font-family: inherit; font-size: 13px;
    transition: all 0.2s; outline: none;
}
input:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
    background: rgba(0, 0, 0, 0.45);
}
textarea { resize: vertical; min-height: 60px; }

/* ─── Login Status Bar ─── */
.login-status-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 8px;
    font-size: 12px; font-weight: 500;
    margin-bottom: 14px; border: 1px solid;
    transition: all 0.3s;
}
.login-status-bar i { font-size: 14px; flex-shrink: 0; }
.login-status-bar.status-unknown {
    background: rgba(123, 140, 163, 0.06);
    border-color: rgba(123, 140, 163, 0.15);
    color: var(--text-muted);
}
.login-status-bar.status-checking {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.2);
    color: #60A5FA;
}
.login-status-bar.status-all-good {
    background: rgba(129, 193, 44, 0.06);
    border-color: rgba(129, 193, 44, 0.2);
    color: var(--primary);
}
.login-status-bar.status-has-issues {
    background: rgba(245, 158, 11, 0.06);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--amber);
}

/* ─── Account Rows ─── */
.accounts-list { display: flex; flex-direction: column; gap: 10px; }

.account-row {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    border-left: 3px solid #333;
    border-radius: 10px;
    padding: 14px 16px;
    transition: all 0.25s;
}
.account-row:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-light);
}

/* Status-based left border */
.account-row[data-status="logged-in"] { border-left-color: var(--primary); }
.account-row[data-status="logged-out"] { border-left-color: var(--danger); }
.account-row[data-status="checking"],
.account-row[data-status="logging-in"] { border-left-color: var(--blue); }

.account-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.account-header-left {
    display: flex; align-items: center; gap: 8px;
}
.account-title {
    font-size: 12px; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.account-actions {
    display: flex; align-items: center; gap: 6px;
}

/* ─── Status Dot ─── */
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    display: inline-block; flex-shrink: 0;
    background: #3a3f4a;
    transition: all 0.3s;
}
.account-row[data-status="checking"] .status-dot,
.account-row[data-status="logging-in"] .status-dot {
    background: var(--blue);
    box-shadow: 0 0 6px var(--blue-glow);
    animation: pulse 1.2s ease-in-out infinite;
}
.account-row[data-status="logged-in"] .status-dot {
    background: var(--primary);
    box-shadow: 0 0 6px var(--primary-glow);
}
.account-row[data-status="logged-out"] .status-dot {
    background: var(--danger);
    box-shadow: 0 0 6px var(--danger-glow);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.6); }
}

/* ─── Status Badge ─── */
.status-badge {
    font-size: 11px; font-weight: 600;
    padding: 3px 8px; border-radius: 4px;
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    letter-spacing: 0.2px;
}
.account-row[data-status="logged-in"] .status-badge {
    background: rgba(129, 193, 44, 0.1);
    color: var(--primary);
}
.account-row[data-status="logged-out"] .status-badge {
    background: rgba(255, 75, 75, 0.1);
    color: var(--danger);
}
.account-row[data-status="checking"] .status-badge {
    background: rgba(59, 130, 246, 0.1);
    color: #60A5FA;
}
.account-row[data-status="logging-in"] .status-badge {
    background: rgba(245, 158, 11, 0.1);
    color: var(--amber);
}

.account-inputs {
    display: grid; grid-template-columns: 1fr 1fr; grid-gap: 8px;
}
.account-inputs .entry-input { grid-column: 1 / -1; }

/* ─── Buttons ─── */
.btn {
    border: none; border-radius: 8px;
    padding: 10px 16px;
    font-family: inherit; font-weight: 600; font-size: 13px;
    cursor: pointer; transition: all 0.25s;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--primary); color: #000;
    box-shadow: 0 2px 12px var(--primary-glow);
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(129, 193, 44, 0.35);
}

.btn-secondary {
    background: rgba(255,255,255,0.04); color: var(--text-muted);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
    background: rgba(255,255,255,0.08); color: var(--text-main);
}

.btn-sm { padding: 8px 12px; font-size: 12px; }

.btn-mini {
    padding: 5px 10px; font-size: 11px; border-radius: 6px;
}
.btn-login-single {
    background: rgba(59, 130, 246, 0.12); color: #60A5FA;
    border: 1px solid rgba(59, 130, 246, 0.2);
}
.btn-login-single:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.25);
}

.btn-remove {
    background: rgba(255, 75, 75, 0.08); color: #FF6B6B;
}
.btn-remove:hover { background: rgba(255, 75, 75, 0.2); }

.btn-stop {
    background: var(--danger); color: #fff;
    box-shadow: 0 2px 12px var(--danger-glow);
    animation: stopPulse 1.5s ease-in-out infinite;
}
.btn-stop:hover:not(:disabled) {
    background: #FF6B6B;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 75, 75, 0.4);
}
@keyframes stopPulse {
    0%, 100% { box-shadow: 0 2px 12px var(--danger-glow); }
    50% { box-shadow: 0 2px 20px rgba(255, 75, 75, 0.4); }
}

.fixed-bottom-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 900;
    display: flex; justify-content: center; gap: 12px;
    padding: 14px 20px;
    background: rgba(8, 10, 16, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(129, 193, 44, 0.15);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}
.btn-large {
    padding: 14px 50px; font-size: 15px;
    letter-spacing: 0.3px; border-radius: 10px;
}

/* ─── Terminal ─── */
.terminal-window {
    background: var(--terminal-bg);
    border-radius: 10px; padding: 14px;
    height: 220px; overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px; line-height: 1.7;
    border: 1px solid rgba(255,255,255,0.04);
    box-shadow: inset 0 2px 16px rgba(0,0,0,0.5);
}
.terminal-line { margin-bottom: 2px; word-break: break-all; }
.timestamp { color: #444; margin-right: 6px; }
.info { color: #7B8CA3; }
.success { color: var(--primary); font-weight: 600; }
.error { color: var(--danger); font-weight: 600; }
.warning { color: var(--amber); }

/* ─── Dashboard ─── */
.stats-overview { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px; padding: 20px;
    display: flex; align-items: center; gap: 16px;
    backdrop-filter: blur(16px);
}
.stat-box h3 { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; color: #fff; }
.stat-icon { font-size: 36px; opacity: 0.7; }
.success-box { border-bottom: 3px solid var(--primary); }
.success-box .stat-icon { color: var(--primary); }
.error-box { border-bottom: 3px solid var(--danger); }
.error-box .stat-icon { color: var(--danger); }
.total-box { border-bottom: 3px solid var(--blue); }
.total-box .stat-icon { color: var(--blue); }

.table-responsive { overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th, .history-table td {
    padding: 12px; text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.history-table th {
    font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; font-size: 11px;
    letter-spacing: 0.5px; background: rgba(0,0,0,0.2);
}
.history-table td { color: var(--text-muted); }
.history-table td:nth-child(2) { color: var(--text-main); font-weight: 500; }
.history-table td a { color: var(--primary); text-decoration: none; }
.history-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.badge {
    padding: 3px 8px; border-radius: 4px;
    font-size: 11px; font-weight: 600;
}
.badge-success { background: rgba(129, 193, 44, 0.12); color: var(--primary); }
.badge-error { background: rgba(255, 75, 75, 0.12); color: var(--danger); }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ═══════════════════════════════════════════
   ANIMATED BOT OVERLAY
   ═══════════════════════════════════════════ */
.bot-overlay {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    animation: overlayIn 0.4s ease;
}
.overlay-backdrop {
    position: absolute; inset: 0;
    background: rgba(4, 6, 10, 0.85);
    backdrop-filter: blur(12px);
}
.overlay-card {
    position: relative; z-index: 1;
    background: rgba(14, 18, 26, 0.95);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 32px 36px;
    width: 480px; max-width: 95vw;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 60px rgba(129,193,44,0.06);
    animation: cardSlideIn 0.5s cubic-bezier(0.16,1,0.3,1);
}

@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.overlay-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px;
}
.overlay-title {
    font-size: 18px; font-weight: 700; color: #fff;
    display: flex; align-items: center; gap: 8px;
}
.overlay-title i { color: var(--primary); }
.overlay-account-counter {
    font-size: 13px; font-weight: 600;
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    padding: 5px 12px; border-radius: 20px;
    border: 1px solid var(--border-color);
}

/* Progress Ring */
.progress-ring-container {
    position: relative;
    width: 160px; height: 160px;
    margin: 0 auto 20px;
}
.progress-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track {
    fill: none; stroke: rgba(255,255,255,0.04);
    stroke-width: 6;
}
.ring-fill {
    fill: none; stroke: var(--primary);
    stroke-width: 6; stroke-linecap: round;
    stroke-dasharray: 534; stroke-dashoffset: 534;
    transition: stroke-dashoffset 1s ease, stroke 0.3s;
    filter: drop-shadow(0 0 8px var(--primary-glow));
}
.ring-fill.waiting { stroke: var(--amber); filter: drop-shadow(0 0 8px var(--amber-glow)); }
.ring-fill.error { stroke: var(--danger); filter: drop-shadow(0 0 8px var(--danger-glow)); }
.ring-fill.success { stroke: var(--primary); filter: drop-shadow(0 0 12px var(--primary-glow)); }

.ring-content {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.ring-icon {
    font-size: 32px; color: var(--primary);
    animation: ringPulse 2s ease-in-out infinite;
}
.ring-icon.waiting { color: var(--amber); }
.ring-icon.error { color: var(--danger); animation: none; }
.ring-icon.success { color: var(--primary); animation: successPop 0.5s ease; }

.ring-timer {
    font-size: 36px; font-weight: 800;
    color: #fff; letter-spacing: -1px;
    font-variant-numeric: tabular-nums;
}
.ring-label {
    font-size: 11px; font-weight: 500;
    color: var(--text-muted); margin-top: 2px;
    text-transform: uppercase; letter-spacing: 1px;
}

@keyframes ringPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.7; }
}
@keyframes successPop {
    0% { transform: scale(0.5); } 50% { transform: scale(1.3); } 100% { transform: scale(1); }
}

/* Email display */
.overlay-email {
    text-align: center; font-size: 14px; font-weight: 600;
    color: var(--blue); margin-bottom: 24px;
    padding: 6px 0;
    animation: emailFade 0.3s ease;
}
@keyframes emailFade {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Step Track */
.step-track {
    display: flex; align-items: center; justify-content: center;
    gap: 0; margin-bottom: 20px;
}
.step-item {
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; position: relative;
}
.step-item span {
    font-size: 10px; font-weight: 500; color: #444;
    text-transform: uppercase; letter-spacing: 0.3px;
    transition: color 0.3s;
}
.step-dot {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.03);
    border: 2px solid #222;
    font-size: 12px; color: #444;
    transition: all 0.4s cubic-bezier(0.16,1,0.3,1);
}
.step-line {
    width: 24px; height: 2px;
    background: #1a1a1a;
    margin: 0 2px 18px;
    transition: background 0.4s;
}

/* Step states */
.step-item.active .step-dot {
    border-color: var(--primary);
    background: rgba(129,193,44,0.1);
    color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
    animation: stepGlow 1.5s ease-in-out infinite;
}
.step-item.active span { color: var(--primary); }

.step-item.done .step-dot {
    border-color: var(--primary);
    background: var(--primary);
    color: #000;
}
.step-item.done span { color: var(--text-muted); }
.step-item.done + .step-line,
.step-line.done { background: var(--primary); }

.step-item.waiting-step .step-dot {
    border-color: var(--amber);
    background: rgba(245,158,11,0.1);
    color: var(--amber);
    box-shadow: 0 0 12px var(--amber-glow);
    animation: stepGlow 1.5s ease-in-out infinite;
}
.step-item.waiting-step span { color: var(--amber); }

.step-item.error-step .step-dot {
    border-color: var(--danger);
    background: rgba(255,75,75,0.1);
    color: var(--danger);
    box-shadow: 0 0 12px var(--danger-glow);
}
.step-item.error-step span { color: var(--danger); }

@keyframes stepGlow {
    0%, 100% { box-shadow: 0 0 8px transparent; }
    50% { box-shadow: 0 0 16px var(--primary-glow); }
}

/* Status text */
.overlay-status {
    text-align: center; font-size: 13px;
    color: var(--text-muted); margin-bottom: 16px;
    min-height: 20px;
    animation: statusFade 0.3s ease;
}
@keyframes statusFade {
    from { opacity: 0; } to { opacity: 1; }
}

/* Mini Log */
.overlay-log {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 8px;
    padding: 10px 12px;
    height: 100px; overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 11px; line-height: 1.6;
}
.overlay-log .log-line {
    margin-bottom: 1px; word-break: break-all;
    animation: logSlide 0.2s ease;
}
.overlay-log .log-line.success { color: var(--primary); }
.overlay-log .log-line.error { color: var(--danger); }
.overlay-log .log-line.warning { color: var(--amber); }
.overlay-log .log-line.info { color: #556; }

@keyframes logSlide {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Completed state */
.overlay-card.completed {
    border-color: rgba(129,193,44,0.2);
    box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 80px rgba(129,193,44,0.1);
}

/* ═══════════════════════════════════════
   AI MODE — TYPING ANIMATION
   ═══════════════════════════════════════ */

/* Big typing emoji in the ring */
.ai-typing-emoji {
    font-size: 52px;
    animation: emojiWrite 1.2s ease-in-out infinite;
    filter: drop-shadow(0 0 12px rgba(129, 193, 44, 0.3));
    line-height: 1;
}
@keyframes emojiWrite {
    0%, 100% { transform: rotate(-8deg) translateY(0); }
    25% { transform: rotate(4deg) translateY(-3px); }
    50% { transform: rotate(-4deg) translateY(1px); }
    75% { transform: rotate(6deg) translateY(-2px); }
}

/* Thinking dots */
.thinking-dots {
    display: inline-flex; gap: 4px; margin-left: 4px;
}
.thinking-dots span {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--primary); display: inline-block;
    animation: dotBounce 1.4s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.3); }
}

/* Floating words */
.floating-words-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    border-radius: 20px;
}
.floating-word {
    position: absolute;
    font-size: 12px;
    font-weight: 600;
    color: rgba(129, 193, 44, 0.15);
    white-space: nowrap;
    animation: floatUp var(--duration, 3s) ease-out forwards;
    pointer-events: none;
    user-select: none;
}
@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.8) rotate(0deg);
    }
    15% {
        opacity: 1;
    }
    85% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: translateY(-280px) scale(0.5) rotate(var(--rotate, 15deg));
    }
}

/* AI status message rotate animation */
.ai-status-animate {
    animation: statusSwitch 0.4s ease;
}
@keyframes statusSwitch {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Rotating glow on the ring during AI mode */
.ring-ai-glow {
    animation: ringRotateGlow 3s linear infinite;
}
@keyframes ringRotateGlow {
    0% { filter: drop-shadow(0 0 8px var(--primary-glow)) hue-rotate(0deg); }
    50% { filter: drop-shadow(0 0 14px rgba(59, 130, 246, 0.4)) hue-rotate(40deg); }
    100% { filter: drop-shadow(0 0 8px var(--primary-glow)) hue-rotate(0deg); }
}

@media (max-width: 768px) {
    .account-inputs { grid-template-columns: 1fr; }
    .stats-overview { grid-template-columns: 1fr; }
    .section-header { flex-direction: column; align-items: flex-start; }
    .overlay-card { padding: 20px; }
    .progress-ring-container { width: 130px; height: 130px; }
    .ai-typing-emoji { font-size: 40px; }
}

