/* ── 공용 디자인 토큰 ─────────────────────────────────────────────────────────
   모든 페이지(index/login/register/admin)가 공유하는 단일 소스.
   페이지별로 :root를 재정의하면 값이 드리프트되므로 여기서만 정의한다. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #070b14;
    --surface: #0d1117;
    --card: #111827;
    --card-2: #1a2234;
    --border: rgba(255,255,255,0.07);
    --border-soft: rgba(255,255,255,0.04);
    --accent: #6366f1;
    --accent-2: #8b5cf6;
    --accent-dim: rgba(99,102,241,0.15);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    /* WCAG AA(4.5:1) 이상을 만족하도록 밝기를 올린 muted 텍스트 색.
       기존 #4b5563/#64748b는 --bg/--card 배경 위에서 대비 3:1 미만이었음.
       --card-2(가장 밝은 배경) 기준으로도 5.5:1 여유를 두도록 조정. */
    --text-muted: #8b98b8;
    --warning-bg: rgba(245, 158, 11, 0.08);
    --warning-border: rgba(245, 158, 11, 0.25);
    --warning-text: #fde68a;
    --nav-h: 60px;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 24px;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Pretendard', 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
}

/* 스크린리더 전용 텍스트 (시각적으로는 숨기되 보조기술에는 노출) */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* 키보드 포커스 표시 — 모든 인터랙티브 요소 공통 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── 내비게이션 (index.html / admin.html 공통) ──────────────────────────── */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: var(--nav-h);
    background: rgba(7,11,20,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #e2e8f0 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}
.nav-logo .logo-icon {
    font-size: 22px;
    -webkit-text-fill-color: initial;
    filter: drop-shadow(0 0 8px rgba(99,102,241,0.5));
}
.nav-spacer { flex: 1; }
.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}
.nav-username {
    font-weight: 600;
    color: var(--text);
}
.nav-back {
    padding: 6px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}
.nav-back:hover { color: var(--text); border-color: rgba(255,255,255,0.14); }
.nav-divider { width: 1px; height: 20px; background: var(--border); }
.btn-nav {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-nav:hover { background: rgba(255,255,255,0.05); color: var(--text); border-color: rgba(255,255,255,0.14); }
.btn-admin {
    padding: 6px 14px;
    background: rgba(99,102,241,0.12);
    border: 1px solid rgba(99,102,241,0.25);
    border-radius: 8px;
    color: #a5b4fc;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-admin:hover { background: rgba(99,102,241,0.2); }

@media (max-width: 768px) {
    .nav {
        height: auto;
        min-height: 56px;
        padding: 10px 14px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .nav-spacer { display: none; }
    .nav-logo { font-size: 15px; }
    .nav-logo .logo-icon { font-size: 19px; }
    .nav-user {
        font-size: 12px;
        gap: 6px;
        justify-content: space-between;
        width: 100%;
        flex-wrap: wrap;
    }
    .btn-nav, .btn-admin, .nav-back { padding: 5px 10px; font-size: 12px; }
}

@media (max-width: 480px) {
    .nav-username {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ── 카드 ─────────────────────────────────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-header {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-soft);
}
.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title .icon { font-size: 16px; }
.card-body { padding: 18px 20px 20px; }

/* ── 뱃지 ─────────────────────────────────────────────────────────────── */
.badge-admin {
    background: rgba(99,102,241,0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99,102,241,0.3);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
}
.badge-user {
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
}

/* ── 버튼 (공용) ──────────────────────────────────────────────────────── */
.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: white;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 18px rgba(99,102,241,0.3);
    letter-spacing: 0.2px;
}
.btn-primary:hover { opacity: 0.9; box-shadow: 0 6px 24px rgba(99,102,241,0.45); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-delete {
    padding: 5px 12px;
    background: rgba(239,68,68,0.10);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius-sm);
    color: #fca5a5;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-delete:hover { background: rgba(239,68,68,0.2); }
.btn-delete:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── 폼 인풋 (공용) ───────────────────────────────────────────────────── */
.field input:not([type="checkbox"]), .field select,
.form-field input, .form-field select {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    min-height: 40px; /* 모바일 터치 타겟 확보 */
}
.field input:not([type="checkbox"])::placeholder, .form-field input::placeholder { color: var(--text-muted); }
.field input:not([type="checkbox"]):focus, .field select:focus,
.form-field input:focus, .form-field select:focus {
    border-color: rgba(99,102,241,0.5);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.field input:not([type="checkbox"]):hover:not(:focus), .field select:hover:not(:focus) {
    border-color: rgba(255,255,255,0.13);
}

/* ── 경고/주의 박스 (register.html 등) ───────────────────────────────── */
.warning-box {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 20px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--warning-text);
}
.warning-title {
    font-weight: 700;
    margin-bottom: 4px;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── 토스트 알림 (공용, ARIA live region으로 스크린리더에 안내) ───────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: #1a2234;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text);
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    animation: toastIn 0.3s cubic-bezier(0.16,1,0.3,1);
    max-width: 320px;
}
@keyframes toastIn { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }

@media (max-width: 768px) {
    .toast-container { left: 16px; right: 16px; bottom: 16px; }
    .toast { max-width: 100%; }
}

/* ── 인증 페이지 공용 (login.html / register.html) ───────────────────── */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 24px 0;
}
.bg-orb {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}
.bg-orb-1 {
    width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 65%);
    top: -200px; left: -200px;
    animation: drift1 12s ease-in-out infinite;
}
.bg-orb-2 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(139,92,246,0.10) 0%, transparent 65%);
    bottom: -150px; right: -150px;
    animation: drift2 15s ease-in-out infinite;
}
@keyframes drift1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(40px,30px)} }
@keyframes drift2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-30px,-40px)} }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .bg-orb, .job-card, .toast { animation: none !important; }
}

.auth-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 52px 44px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    box-shadow: 0 30px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    margin: auto;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-logo { text-align: center; margin-bottom: 36px; }
.auth-logo .train-icon {
    font-size: 52px;
    display: block;
    margin-bottom: 14px;
    filter: drop-shadow(0 0 24px rgba(99,102,241,0.6));
    animation: pulse-icon 3s ease-in-out infinite;
}
@keyframes pulse-icon {
    0%,100%{filter:drop-shadow(0 0 18px rgba(99,102,241,0.5))}
    50%{filter:drop-shadow(0 0 30px rgba(139,92,246,0.7))}
}
.auth-logo h1 {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #e2e8f0 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
}
.auth-logo p { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

.error-msg {
    background: rgba(239,68,68,0.10);
    border: 1px solid rgba(239,68,68,0.25);
    color: #fca5a5;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 7px;
}
.form-group input[type="text"], .form-group input[type="password"] {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 13px 15px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    min-height: 44px;
}
.form-group input::placeholder { color: var(--text-muted); }
.form-group input:focus {
    border-color: rgba(99,102,241,0.6);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-group input:hover:not(:focus) { border-color: rgba(255,255,255,0.14); }

.btn-auth {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: white;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-top: 6px;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 20px rgba(99,102,241,0.35);
    letter-spacing: 0.3px;
    min-height: 48px;
}
.btn-auth:hover { opacity: 0.92; box-shadow: 0 6px 28px rgba(99,102,241,0.5); }
.btn-auth:active { transform: scale(0.98); }
.btn-auth:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-muted);
}
.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
}
.auth-footer a:hover { text-decoration: underline; }

@media (max-width: 480px) {
    .auth-card {
        padding: 36px 22px;
        margin: 16px;
        border-radius: 20px;
        max-width: calc(100% - 32px);
    }
    .auth-logo .train-icon { font-size: 44px; }
    .auth-logo h1 { font-size: 19px; }
}
