/* ===== FlyWord Shared Styles ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ---------- Dark theme (original) ---------- */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --bg: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-input: rgba(51, 65, 85, 0.6);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.15);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gradient-bg: linear-gradient(-45deg, #0f172a, #1e1b4b, #172554, #0c4a6e);
    --overlay-gradient: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
    --qr-label-color: #4b5563;
    --submitted-word-bg: rgba(99, 102, 241, 0.2);
    --submitted-word-border: rgba(99, 102, 241, 0.3);
    --submitted-word-color: var(--primary-light);
    --waiting-color: rgba(255, 255, 255, 0.3);
    --question-screen-color: rgba(255, 255, 255, 0.9);
    --stats-color: rgba(255, 255, 255, 0.6);
    --cloud-colors: #818cf8, #a78bfa, #c084fc, #f472b6, #fb923c, #34d399, #38bdf8, #fbbf24;
    --notification-shadow: rgba(99, 102, 241, 0.8);
}

/* ---------- Light theme ---------- */
[data-theme="light"] {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    --bg: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-input: rgba(241, 245, 249, 0.9);
    --text: #1e293b;
    --text-muted: #64748b;
    --border: rgba(148, 163, 184, 0.25);
    --gradient-bg: linear-gradient(-45deg, #e0e7ff, #ede9fe, #dbeafe, #e0f2fe);
    --overlay-gradient: linear-gradient(to top, rgba(255, 255, 255, 0.85), transparent);
    --qr-label-color: #374151;
    --submitted-word-bg: rgba(79, 70, 229, 0.1);
    --submitted-word-border: rgba(79, 70, 229, 0.25);
    --submitted-word-color: #4f46e5;
    --waiting-color: rgba(100, 116, 139, 0.4);
    --question-screen-color: #1e293b;
    --stats-color: #475569;
    --cloud-colors: #4f46e5, #7c3aed, #9333ea, #db2777, #ea580c, #059669, #0284c7, #d97706;
    --notification-shadow: rgba(79, 70, 229, 0.6);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background 0.4s ease, color 0.4s ease;
}

/* Glass Card */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    transition: background 0.4s ease, border-color 0.4s ease;
}

/* Animated gradient background */
.gradient-bg {
    background: var(--gradient-bg);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(71, 85, 105, 0.6);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 0.5rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Inputs */
.input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, background 0.4s, color 0.4s;
}

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

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

/* ===== Theme Toggle ===== */
.theme-toggle {
    position: fixed;
    top: 1.2rem;
    right: 1.5rem;
    z-index: 200;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    line-height: 1;
}

.theme-toggle:hover {
    transform: scale(1.15) rotate(15deg);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Default state: show sun, hide moon (matches data-theme="light") */
.theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg);
}

.theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(-90deg);
}

/* Dark mode: show moon, hide sun */
[data-theme="dark"] .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="dark"] .theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg);
}

/* ===== Input group fix for submit page ===== */
.input-group {
    display: flex;
    gap: 0;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-input);
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.input-group .input {
    border: none;
    border-radius: 0;
    background: transparent;
    flex: 1;
}

.input-group .input:focus {
    border-color: transparent;
    box-shadow: none;
}

.input-group .btn {
    border-radius: 0;
    flex-shrink: 0;
    padding: 0 1.5rem;
    font-size: 1.1rem;
}

/* Password display */
.password-display {
    font-family: 'Courier New', monospace;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.5em;
    color: var(--primary-light);
    text-align: center;
    padding: 1.5rem;
    background: rgba(99, 102, 241, 0.1);
    border: 2px dashed var(--primary);
    border-radius: 1rem;
    user-select: all;
}

/* Stats badge */
.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.85rem;
}

/* QR Container */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    background: white;
    border-radius: 1rem;
    width: fit-content;
    margin: 0 auto;
}

.qr-container canvas {
    border-radius: 0.5rem;
}

/* Floating word animation for screen */
@keyframes wordFlyIn {
    from {
        opacity: 0;
        transform: scale(0.3) translateY(30px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.word-fly-in {
    animation: wordFlyIn 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

/* Screen overlay info bar */
.screen-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem 2rem;
    background: var(--overlay-gradient);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 50;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 500;
    z-index: 1000;
    animation: toastIn 0.3s ease;
}

.toast-success {
    background: rgba(34, 197, 94, 0.9);
    color: white;
}

.toast-error {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-1rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse animation */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .password-display {
        font-size: 1.8rem;
        letter-spacing: 0.3em;
    }

    .theme-toggle {
        top: 0.8rem;
        right: 0.8rem;
        width: 2.2rem;
        height: 2.2rem;
        font-size: 1rem;
    }
}