/* =========================================================================
 * auth.css — 인증 화면 공용 스타일 (login / signup / first_run 공유)
 * login.html 의 다크 글래스모피즘 디자인 토큰을 추출한 단일 출처.
 * ========================================================================= */

:root {
    --primary-400: #22d3ee;
    --primary-500: #06b6d4;
    --primary-600: #0891b2;
    --success-main: #10b981;
    --success-light: #34d399;
    --danger-main: #ef4444;
    --danger-light: #f87171;
    --bg-base: #0a0e14;
    --bg-surface: #111827;
    --bg-elevated: #1f2937;
    --bg-card: rgba(17, 24, 39, 0.8);
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;            /* 필드 많은 폼의 상하 여백 + 스크롤 확보 */
    -webkit-font-smoothing: antialiased;
    position: relative;
    overflow-x: hidden;            /* orb 가로 넘침 차단, 세로는 스크롤 허용 */
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(34, 211, 238, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(16, 185, 129, 0.08), transparent),
        radial-gradient(ellipse 50% 30% at 0% 50%, rgba(59, 130, 246, 0.06), transparent),
        linear-gradient(180deg, var(--bg-base) 0%, #0f172a 100%);
    z-index: -2;
}

/* Grid Pattern */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: -1;
    opacity: 0.5;
}

/* Floating Orbs */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: rgba(34, 211, 238, 0.2);
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: rgba(16, 185, 129, 0.15);
    bottom: -50px;
    left: -50px;
    animation-delay: -7s;
}

.orb-3 {
    width: 200px;
    height: 200px;
    background: rgba(59, 130, 246, 0.15);
    top: 50%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(20px, 10px) scale(1.02); }
}

/* Auth Container / Card */
.login-container {
    width: 100%;
    max-width: 440px;            /* 필드가 많은 signup/first_run 대응으로 살짝 넓힘 */
    padding: 2rem;
    position: relative;
    z-index: 1;
    margin: auto 0;              /* 긴 폼이 화면보다 클 때 위아래 스크롤 접근 */
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 2.5rem;
    backdrop-filter: blur(20px);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.4),
        0 0 80px rgba(34, 211, 238, 0.08);
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Logo / Brand */
.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-brand-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-400), var(--success-main));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 32px rgba(34, 211, 238, 0.3);
}

.login-brand-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.login-brand h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.login-brand p {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* Form */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    transition: all 0.25s ease;
}

.form-group select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-group select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
    background: var(--bg-surface);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* 전화번호 3분할 */
.phone-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.phone-group input {
    text-align: center;
}

.phone-group span {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* 인라인 필드 에러 (비밀번호 불일치 등) */
.field-error {
    color: var(--danger-light);
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    min-height: 1rem;
}

/* 라벨 옆 (선택사항) 힌트 */
.optional-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 400;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    border: none;
    margin-bottom: 0.75rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    box-shadow: 0 4px 14px rgba(34, 211, 238, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-400), var(--primary-500));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 211, 238, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--primary-500);
    color: var(--text-primary);
}

.btn-link {
    display: inline-block;
    width: 100%;
    text-align: center;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.btn-link:hover {
    color: var(--primary-400);
}

/* Toast — Error / Success */
.error-message {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 1.5rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    color: var(--danger-light);
    font-size: 0.9375rem;
    font-weight: 500;
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: slideDown 0.3s ease-out;
}

.success-message {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 1.5rem;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    color: var(--success-light);
    font-size: 0.9375rem;
    font-weight: 500;
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: slideDown 0.3s ease-out;
}

.success-message.fade-out,
.error-message.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* Responsive */
@media (max-width: 480px) {
    .login-container { padding: 1rem; }
    .login-card { padding: 1.5rem; }
    .login-brand h1 { font-size: 1.5rem; }
}
