/* ═══════════════════════════════════════════
   AI Agent WhatsApp Monitor - Stylesheet
   ═══════════════════════════════════════════ */

/* ─── Design Tokens ─────────────────────── */
:root {
    --bg-color: #0b0f19;
    --card-bg: rgba(17, 24, 39, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.4);
    --accent-cyan: #06b6d4;
    --accent-cyan-glow: rgba(6, 182, 212, 0.4);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);
    --danger: #ef4444;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
}

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

/* ─── Body ───────────────────────────────── */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

/* ─── Ambient Glow Spheres ───────────────── */
.glow-sphere {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    opacity: 0.45;
    pointer-events: none;
    animation: drift 15s ease-in-out infinite alternate;
}

.glow-sphere-1 {
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    top: -10%;
    left: -10%;
}

.glow-sphere-2 {
    background: radial-gradient(circle, var(--accent-cyan) 0%, transparent 70%);
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 30px) scale(1.1); }
}

/* ─── Root Container ─────────────────────── */
#root {
    width: 90%;
    max-width: 520px;
    z-index: 10;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ─── Glassmorphic Card ──────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px 32px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* ─── Header ─────────────────────────────── */
.header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 40%, #a5b4fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* ─── Status Badge ───────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: relative;
}

/* Status: Disconnected */
.status-disconnected {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.05);
}
.status-disconnected .status-dot {
    background-color: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}

/* Status: Connecting */
.status-connecting {
    color: var(--accent-cyan);
    border-color: rgba(6, 182, 212, 0.2);
    background: rgba(6, 182, 212, 0.05);
}
.status-connecting .status-dot {
    background-color: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan);
    animation: pulse 1.5s infinite alternate;
}

/* Status: QR Waiting */
.status-qr {
    color: var(--primary);
    border-color: rgba(79, 70, 229, 0.2);
    background: rgba(79, 70, 229, 0.05);
}
.status-qr .status-dot {
    background-color: var(--primary);
    box-shadow: 0 0 10px var(--primary);
    animation: pulse 1.5s infinite alternate;
}

/* Status: Connected */
.status-connected {
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.05);
}
.status-connected .status-dot {
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: pulse 1.5s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    100% { transform: scale(1.2); opacity: 1; }
}

/* ─── Display Area ───────────────────────── */
.display-area {
    width: 100%;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

/* ─── QR Code Wrapper ────────────────────── */
.qr-wrapper {
    background: #ffffff;
    padding: 16px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    display: inline-block;
    animation: scale-up 0.5s ease;
}

.qr-wrapper img {
    display: block;
    width: 240px;
    height: 240px;
    border-radius: 8px;
}

@keyframes scale-up {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ─── Spinner ────────────────────────────── */
.spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(255, 255, 255, 0.05);
    border-top: 4px solid var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    margin-bottom: 20px;
}

.spinner.danger {
    border-top-color: var(--danger);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ─── Success Checkmark ──────────────────── */
.success-checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
    animation: bounce-in 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-checkmark svg {
    width: 40px;
    height: 40px;
    stroke: var(--success);
    stroke-width: 3.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: draw-check 0.8s 0.2s ease forwards;
}

@keyframes bounce-in {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); opacity: 0.8; }
    70% { transform: scale(0.9); opacity: 0.9; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes draw-check {
    to { stroke-dashoffset: 0; }
}

/* ─── State Text ─────────────────────────── */
.state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #fff;
}

.state-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 320px;
}

/* ─── Scan Guide Steps ───────────────────── */
.steps {
    text-align: left;
    margin-top: 24px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 16px 20px;
    width: 100%;
}

.steps-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.steps ol {
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.steps li {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.4;
}

.steps li span {
    font-weight: 600;
    color: #fff;
}

/* ─── Footer ─────────────────────────────── */
.footer {
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.2);
    margin-top: 10px;
    z-index: 10;
}

/* ─── Responsive ─────────────────────────── */
@media (max-width: 480px) {
    .card {
        padding: 30px 20px;
    }
    .header h1 {
        font-size: 1.8rem;
    }
}
