/* ── WordTune® Live Stream – Global Stylesheet ── */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

/* ── CSS Variables ── */
:root {
    --bg:           #0a0b0f;
    --bg-card:      #111318;
    --bg-elevated:  #181b22;
    --border:       rgba(255,255,255,0.07);
    --border-glow:  rgba(100,180,255,0.25);

    --accent:       #3b82f6;
    --accent-2:     #06b6d4;
    --accent-hot:   #f97316;
    --success:      #22c55e;
    --danger:       #ef4444;
    --warning:      #f59e0b;

    --text-1:       #f1f5f9;
    --text-2:       #94a3b8;
    --text-3:       #475569;

    --radius:       14px;
    --radius-sm:    8px;
    --radius-pill:  999px;

    --shadow-card:  0 0 0 1px var(--border), 0 20px 60px rgba(0,0,0,0.5);
    --shadow-glow:  0 0 40px rgba(59,130,246,0.15);

    --font-display: 'Syne', sans-serif;
    --font-body:    'DM Sans', sans-serif;

    --transition:   0.2s cubic-bezier(0.4,0,0.2,1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text-1);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ── Ambient background grid ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(59,130,246,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59,130,246,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    top: -30vh;
    right: -20vw;
    width: 70vw;
    height: 70vw;
    background: radial-gradient(circle, rgba(59,130,246,0.06) 0%, transparent 65%);
    pointer-events: none;
    z-index: 0;
}

/* ── Layout ── */
.app-shell {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 60px;
}

/* ── Wordmark / Header ── */
.wordmark {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 48px;
}

.wordmark-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wordmark-logo .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 16px var(--accent);
    animation: pulseGlow 2.5s ease-in-out infinite;
}

.wordmark-logo .name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-1);
}

.wordmark-logo .name sup {
    font-size: 0.55em;
    color: var(--text-2);
    vertical-align: super;
    font-weight: 400;
}

.wordmark-logo .badge {
    font-family: var(--font-display);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.2);
    padding: 3px 8px;
    border-radius: var(--radius-pill);
}

/* ── Hero Header ── */
.page-hero {
    text-align: center;
    margin-bottom: 48px;
}

.page-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    background: linear-gradient(135deg, var(--text-1) 0%, var(--text-2) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 14px;
}

.page-hero p {
    font-size: 1.05rem;
    color: var(--text-2);
    font-weight: 300;
    letter-spacing: 0.01em;
}

/* ── Status Bar (agent) ── */
.status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
    width: fit-content;
    margin: 0 auto 32px;
}

.status-bar.available { border-color: rgba(34,197,94,0.3); }
.status-bar.offline   { border-color: rgba(239,68,68,0.3); }
.status-bar.in-call   { border-color: rgba(59,130,246,0.3); }

.status-pip {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-bar.available .status-pip { background: var(--success); animation: pulseGlow 2s infinite; }
.status-bar.offline   .status-pip { background: var(--danger); }
.status-bar.in-call   .status-pip { background: var(--accent); animation: pulseGlow 2s infinite; }

/* ── Stat Cards ── */
.queue-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
    text-align: center;
    transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-2px);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2.6rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-1);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
}

/* ── Views ── */
.view { display: none; }
.view.active { display: block; }

/* ── Card ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px 40px;
    text-align: center;
    box-shadow: var(--shadow-card);
}

.card h2 {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    color: var(--text-1);
}

.card p {
    color: var(--text-2);
    font-size: 0.95rem;
    font-weight: 300;
    margin-bottom: 32px;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 28px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background var(--transition);
}
.btn:hover::after { background: rgba(255,255,255,0.06); }
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 0 0 rgba(59,130,246,0.4);
}
.btn-primary:hover { box-shadow: 0 0 24px rgba(59,130,246,0.4); }

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-2);
    border: 1px solid var(--border);
}
.btn-secondary:hover { color: var(--text-1); border-color: var(--border-glow); }

.btn-danger {
    background: rgba(239,68,68,0.15);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

/* ── Queue Position ── */
.queue-info { padding: 20px 0; }

.position-ring {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(var(--accent) 0deg, var(--bg-elevated) 0deg);
    display: grid;
    place-items: center;
    margin: 0 auto 20px;
    position: relative;
    box-shadow: 0 0 0 3px var(--bg-card), 0 0 0 4px var(--border);
}

.position-ring::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: var(--bg-card);
}

.position-number {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--accent);
    position: relative;
    z-index: 1;
}

.queue-meta {
    font-size: 0.9rem;
    color: var(--text-2);
    margin-bottom: 6px;
}

.queue-meta strong { color: var(--text-1); font-weight: 500; }

.progress-bar {
    width: 100%;
    max-width: 300px;
    height: 4px;
    background: var(--bg-elevated);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin: 20px auto 28px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    width: 0%;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
    border-radius: var(--radius-pill);
}

/* ── Video call layout ── */
.video-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.video-wrapper {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    border: 1px solid var(--border);
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-label {
    position: absolute;
    bottom: 12px;
    left: 12px;
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    color: var(--text-2);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
}

.agent-status, .customer-status {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    color: var(--success);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(34,197,94,0.2);
}

/* ── Call Controls ── */
.call-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 20px 0;
}

.control-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 1.3rem;
    display: grid;
    place-items: center;
    position: relative;
}

.control-btn:hover { transform: scale(1.1); border-color: var(--border-glow); }
.control-btn:active { transform: scale(0.95); }

.control-btn.active {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.4);
}

.control-btn.end-call {
    width: 64px;
    height: 64px;
    background: var(--danger);
    border-color: transparent;
    box-shadow: 0 0 20px rgba(239,68,68,0.3);
}
.control-btn.end-call:hover {
    background: #dc2626;
    box-shadow: 0 0 32px rgba(239,68,68,0.5);
}

/* ── Toast notifications ── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-size: 0.85rem;
    color: var(--text-1);
    max-width: 320px;
    animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1) forwards;
    box-shadow: var(--shadow-card);
}

.toast.success { border-color: rgba(34,197,94,0.3); }
.toast.error   { border-color: rgba(239,68,68,0.3); }
.toast.info    { border-color: rgba(59,130,246,0.3); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
    50%       { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

/* ── Offline / error notice ── */
.notice {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}
.notice.info { background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.2); color: var(--accent); }
.notice.warn { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2); color: var(--warning); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .app-shell { padding: 20px 16px 40px; }
    .video-container { grid-template-columns: 1fr; }
    .queue-stats { grid-template-columns: 1fr 1fr; }
    .page-hero h1 { font-size: 1.9rem; }
    .card { padding: 32px 20px; }
}

@media (max-width: 480px) {
    .queue-stats { grid-template-columns: 1fr; }
    .wordmark { flex-direction: column; align-items: flex-start; gap: 12px; }
}
