/* ===== shared.css — Common styles for Topan app pages ===== */

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    height: 100%; width: 100%;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    background: #000;
    color: #f0f0f0;
}

/* App container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding-top: env(safe-area-inset-top, 0px);
}

/* Top bar — 2-line layout */
.top-bar {
    background: linear-gradient(180deg, #111 0%, #0a0a0a 100%);
    border-bottom: 1px solid rgba(147,51,234,0.08);
    box-shadow: 0 1px 8px rgba(147,51,234,0.05);
    padding: 0;
    flex-shrink: 0;
}
.top-bar-line1 {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 4px;
}
.top-bar-line1 .logo { width: 28px; height: 28px; border-radius: 6px; }
.top-bar-line1 .brand { font-size: 16px; font-weight: 800; color: #fff; letter-spacing: 1px; text-shadow: 0 0 12px rgba(147,51,234,0.3); }
.top-bar-line1 .section { font-size: 14px; color: #9ca3af; font-weight: 600; }
.top-bar-line2 {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 12px 8px;
    flex-wrap: wrap;
}

/* User pill */
.user-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px 3px 3px;
    background: rgba(147,51,234,0.1); border: 1px solid rgba(147,51,234,0.25);
    border-radius: 9999px; font-size: 12px; color: #c084fc; font-weight: 600;
    max-width: 160px;
}
.user-pill > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-avatar {
    width: 24px; height: 24px; border-radius: 50%;
    background: linear-gradient(135deg,#9333ea,#7c3aed);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 11px; font-weight: 700;
    box-shadow: 0 0 8px rgba(147,51,234,0.3);
}
.user-pill-admin {
    display: inline-flex; align-items: center; gap: 3px;
    margin-left: 4px; padding: 1px 5px;
    background: rgba(147,51,234,0.2); border: 1px solid rgba(147,51,234,0.4);
    border-radius: 4px; font-size: 8px; font-weight: 800;
    color: #a855f7; letter-spacing: 0.5px; text-transform: uppercase;
}
.user-pill-admin svg { width: 9px; height: 9px; fill: #a855f7; }
.logout-btn {
    background: none; border: none; color: #555; cursor: pointer;
    padding: 6px; min-width: 36px; min-height: 36px;
    display: flex; align-items: center; justify-content: center;
}
.logout-btn:hover { color: #ef4444; }

/* Login button (karaoke / quiz) */
.login-btn {
    font-size: 12px; color: #c084fc; background: none; border: 1px solid rgba(147,51,234,0.3);
    border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 600;
}
.login-btn:hover { background: rgba(147,51,234,0.1); }

/* Auth card */
.auth-card {
    width: 100%; max-width: 380px;
    background: rgba(17,17,17,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(147,51,234,0.12);
    border-radius: 16px;
    overflow: hidden;
}
.auth-tabs { display: flex; border-bottom: 1px solid #222; }
.auth-tab {
    flex: 1; padding: 12px; text-align: center; font-weight: 600;
    font-size: 13px; color: #666; cursor: pointer;
    border: none; background: none; border-bottom: 2px solid transparent;
}
.auth-tab.active { color: #c084fc; border-bottom-color: #a855f7; }
.auth-form { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.auth-form.hidden { display: none; }
.auth-input {
    width: 100%; background: #1a1a1a; border: 1px solid #2a2a2a;
    color: #fff; border-radius: 10px; padding: 11px 14px; font-size: 14px;
    outline: none; font-family: 'Inter', sans-serif;
}
.auth-input:focus { border-color: #7c3aed; }
.auth-input::placeholder { color: #555; }
.auth-submit {
    width: 100%; padding: 12px; border: none; border-radius: 10px;
    font-weight: 700; font-size: 14px; cursor: pointer;
    background: linear-gradient(135deg,#9333ea,#7c3aed); color: #fff;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(147,51,234,0.2);
}
.auth-submit:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(147,51,234,0.3);
}
.auth-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-error { color: #f87171; font-size: 12px; text-align: center; min-height: 18px; }

/* Captcha */
.captcha-row { display: flex; align-items: center; gap: 8px; }
.captcha-svg-wrap {
    flex: 1; min-width: 0; border-radius: 8px; overflow: hidden;
    border: 1px solid #2a2a2a; line-height: 0; min-height: 50px;
}
.captcha-svg-wrap svg { display: block; width: 100%; height: auto; min-height: 50px; }
.captcha-input {
    width: 65px; background: #1a1a1a; border: 1px solid #2a2a2a;
    color: #fff; border-radius: 10px; padding: 10px 12px; font-size: 15px;
    font-weight: 700; text-align: center; outline: none;
}
.captcha-input:focus { border-color: #7c3aed; }
.captcha-input::placeholder { color: #555; font-weight: 400; font-size: 12px; }
.captcha-refresh {
    flex-shrink: 0; background: none; border: 1px solid #2a2a2a;
    color: #888; border-radius: 8px; width: 40px; height: 40px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.captcha-refresh:hover { color: #c084fc; border-color: #7c3aed; }
.hp-field { position: absolute; left: -9999px; top: -9999px; opacity: 0; height: 0; width: 0; overflow: hidden; }

/* Newsletter checkbox */
.auth-newsletter-row { display: flex; align-items: flex-start; gap: 8px; }
.auth-newsletter-row input[type="checkbox"] { margin-top: 3px; accent-color: #7c3aed; }
.auth-newsletter-row label { font-size: 11px; color: #888; line-height: 1.4; }

/* Language toggle */
.lang-toggle {
    display: inline-flex; align-items: center; gap: 2px;
    background: rgba(255,255,255,0.1); border-radius: 6px;
    padding: 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
}
.lang-toggle button {
    padding: 3px 7px; border-radius: 4px; color: #999;
    background: transparent; border: none; cursor: pointer;
    transition: all 0.2s; font-weight: 600; font-size: 11px;
    line-height: 1; min-height: 24px; min-width: 24px;
}
.lang-toggle button.active { background: #fff; color: #000; }
.lang-toggle button:hover:not(.active) { color: #fff; }

/* Sound mute toggle */
.mute-toggle {
    background: none; border: 1px solid #2a2a2a; color: #888;
    border-radius: 8px; width: 32px; height: 32px; min-width: 32px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    padding: 0; transition: all 0.2s;
}
.mute-toggle:hover { border-color: #7c3aed; color: #c084fc; }
.mute-toggle.muted { color: #ef4444; border-color: rgba(239,68,68,0.3); }

/* Loading spinner overlay */
.loading-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: #000;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 12px;
    transition: opacity 0.3s;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loading-spinner {
    width: 36px; height: 36px; border: 3px solid #1a1a1a;
    border-top-color: #a855f7; border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay span { font-size: 12px; color: #555; font-weight: 500; }

/* Password visibility toggle */
.password-wrap { position: relative; }
.password-wrap .auth-input { padding-right: 42px; }
.pw-toggle {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: #555; cursor: pointer;
    padding: 4px; display: flex; align-items: center; justify-content: center;
}
.pw-toggle:hover { color: #c084fc; }

/* Toast notification */
.app-toast {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
    background: #1a1a1a; border: 1px solid rgba(248,113,113,0.3);
    color: #f87171; padding: 10px 20px; border-radius: 10px;
    font-size: 12px; font-weight: 600; z-index: 300;
    opacity: 0; transition: opacity 0.3s; pointer-events: none;
    max-width: calc(100vw - 40px); text-align: center;
}
.app-toast.visible { opacity: 1; animation: slideUp 0.3s ease; }
@keyframes slideUp {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Common keyframe */
@keyframes pulse-dot { 0%,100%{opacity:1;} 50%{opacity:0.3;} }

/* Smooth transitions for interactive elements */
.auth-tab { transition: all 0.2s ease; }
.auth-input { transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.auth-input:focus { border-color: #7c3aed; box-shadow: 0 0 0 2px rgba(124,58,237,0.15); }
.logout-btn { transition: all 0.2s ease; }
.logout-btn:active { transform: scale(0.95); }
.lang-toggle button { transition: all 0.15s ease; }
.lang-toggle button:active { transform: scale(0.93); }

/* Touch target minimum sizes (shared) */
.auth-tab { min-height: 44px; }
.auth-submit { min-height: 44px; }
.logout-btn { min-width: 44px; min-height: 44px; }
.login-btn { min-height: 44px; }

/* Back button */
.back-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 8px; min-width: 44px; min-height: 44px;
    background: rgba(147,51,234,0.1); border: 1px solid rgba(147,51,234,0.25);
    color: #c084fc; text-decoration: none; font-size: 18px; line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.back-btn:hover, .back-btn:focus { background: rgba(147,51,234,0.25); color: #fff; outline: none; }

/* Features nav menu (cross-page navigation) */
.features-nav {
    position: relative;
    margin-left: auto;
}
.features-nav-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 8px; min-width: 44px; min-height: 44px;
    background: rgba(147,51,234,0.1); border: 1px solid rgba(147,51,234,0.25);
    color: #c084fc; cursor: pointer;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}
.features-nav-btn:hover, .features-nav-btn:focus,
.features-nav.open .features-nav-btn { background: rgba(147,51,234,0.25); color: #fff; outline: none; }
.features-nav-btn svg { width: 20px; height: 20px; }
.features-nav-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: rgba(17, 17, 17, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(192, 132, 252, 0.25);
    border-radius: 12px;
    padding: 6px;
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.features-nav.open .features-nav-menu {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.features-nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    color: #d1d5db; text-decoration: none;
    font-size: 13px; font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.features-nav-item:hover { background: rgba(192, 132, 252, 0.12); color: #fff; }
.features-nav-item.current { background: rgba(192, 132, 252, 0.15); color: #c084fc; cursor: default; pointer-events: none; }
.features-nav-item svg { width: 16px; height: 16px; flex-shrink: 0; color: #c084fc; }
