/* Main CSS - 공통 스타일 (UA body margin 8px 제거로 모바일 배너 양옆 꽉 참) */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html, body {
    margin: 0;
    padding: 0;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --dark: #1e293b;
    --gray-900: #0f172a;
    --gray-800: #1e293b;
    --gray-700: #334155;
    --gray-600: #475569;
    --gray-500: #64748b;
    --gray-400: #94a3b8;
    --gray-300: #cbd5e1;
    --gray-200: #e2e8f0;
    --gray-100: #f1f5f9;
    --gray-50: #f8fafc;
    --white: #ffffff;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    /* 테마 변수 (라이트) */
    --bg-page: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --input-bg: #ffffff;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-page);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* 다크모드: 테마 변수 오버라이드 (모바일 포함, 인라인 스타일보다 우선) */
body.dark-mode {
    --bg-page: #0f172a;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --card-bg: #1e293b;
    --card-border: #334155;
    --input-bg: #1e293b;
    background-color: var(--bg-page) !important;
    color: var(--text-primary);
}
body.dark-mode .navbar { background: rgba(15, 23, 42, 0.95); }
body.dark-mode .nav-link { color: #94a3b8; }
body.dark-mode .nav-link:hover,
body.dark-mode .nav-link.active { color: #a5b4fc; }
body.dark-mode .nav-brand a { color: #a5b4fc; }
body.dark-mode .btn-outline { border-color: #6366f1; color: #a5b4fc; }
body.dark-mode .btn-outline:hover { background: #6366f1; color: #fff; }
body.dark-mode .footer { background: #020617; color: #94a3b8; }
body.dark-mode .footer-title { color: #fff; }
body.dark-mode .footer-subtitle { color: #e2e8f0; }
body.dark-mode .footer-links a { color: #94a3b8; }
body.dark-mode .footer-links a:hover { color: #a5b4fc; }
body.dark-mode .btn-icon { color: #94a3b8; }
body.dark-mode .btn-icon:hover { color: #a5b4fc; background: rgba(99, 102, 241, 0.2); }
body.dark-mode .cert-card { background: var(--card-bg); border-color: var(--card-border); }
body.dark-mode .cert-card .cert-name { color: #e2e8f0; }
body.dark-mode .cert-card .cert-desc { color: #94a3b8; }
body.dark-mode .cert-card .cert-meta { color: #64748b; }
body.dark-mode .cert-list-intro h1 { color: #e2e8f0; }
body.dark-mode .cert-list-intro p { color: #94a3b8; }
body.dark-mode main { background: var(--bg-page); }
body.dark-mode .search-box,
body.dark-mode .search-results { background: var(--card-bg); color: var(--text-primary); border-color: var(--card-border); }
body.dark-mode .search-box input { color: var(--text-primary); }
body.dark-mode .search-box input::placeholder { color: var(--text-secondary); }
/* 홈(index) 다크모드 */
body.dark-mode .home-quick .quick-card { background: var(--card-bg); color: var(--text-primary); }
body.dark-mode .home-quick .quick-card .quick-title { color: var(--text-primary); }
body.dark-mode .home-quick .quick-card .quick-desc { color: var(--text-secondary); }
body.dark-mode .home-cta { background: #1e293b; }
/* 대시보드 다크모드 */
body.dark-mode .dash-header { background: var(--card-bg); }
body.dark-mode .dash-header h1 { color: var(--text-primary); }
body.dark-mode .dash-header p { color: var(--text-secondary); }
body.dark-mode .dash-user { background: #1e293b; color: var(--text-primary); }
body.dark-mode .dash-user h2 { color: var(--text-primary); }
body.dark-mode .dash-user p { color: var(--text-secondary); }
body.dark-mode .quick-actions { background: var(--card-bg); }
body.dark-mode .quick-actions h2 { color: var(--text-primary); }
body.dark-mode .page-container .stat-card { background: var(--card-bg); }
body.dark-mode .page-container .stat-card h3 { color: var(--text-primary); }
body.dark-mode .page-container .stat-card p { color: var(--text-secondary); }
body.dark-mode .section-title { color: var(--text-primary); }
body.dark-mode .section-subtitle { color: var(--text-secondary); }
/* 로그인/회원가입 다크모드 */
body.dark-mode .auth-card { background: var(--card-bg); border-color: var(--card-border); }
body.dark-mode .auth-header { border-bottom-color: var(--card-border); }
body.dark-mode .auth-title { color: var(--text-primary); }
body.dark-mode .auth-card .form-group label { color: var(--text-secondary); }
body.dark-mode .auth-card .form-control { background: var(--input-bg); border-color: var(--card-border); color: var(--text-primary); }
body.dark-mode .auth-card .form-control::placeholder { color: var(--text-secondary); }
body.dark-mode .auth-card .checkbox-label { color: var(--text-secondary); }
body.dark-mode .auth-card .form-options a { color: #a5b4fc; }
body.dark-mode .auth-divider span { color: var(--text-secondary); }
body.dark-mode .social-btn { background: var(--card-bg); border-color: var(--card-border); color: var(--text-primary); }
body.dark-mode .social-btn:hover { background: #334155; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* 자격증 페이지 상단 현재 위치 표시 (상단 중앙) - 공통 */
.cert-page-identity {
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
    padding: 0.375rem 0;
    text-align: center;
    margin-top: 48px;
}

.cert-page-identity .container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.cert-page-identity-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-700);
}

body.dark-mode .cert-page-identity { background: #1e293b; border-bottom-color: #334155; }
body.dark-mode .cert-page-identity-label { color: #e2e8f0; }

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    z-index: 1000;
    transition: var(--transition);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.375rem 0.75rem;
    flex-wrap: nowrap;
    min-height: 48px;
}

@media (min-width: 769px) {
    .nav-container {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
        min-height: 52px;
    }
    .nav-brand {
        flex-shrink: 0;
        min-width: 1px;
    }
    /* 네비 아래로 본문이 내려가도록(덮이지 않음) */
    main {
        margin-top: 100px;
    }
}

.nav-brand a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}

.nav-menu {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    flex-shrink: 0;
}

.nav-link {
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
}

.nav-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.btn-icon {
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gray-700);
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.btn-outline {
    padding: 0.625rem 1.25rem;
    border: 2px solid var(--primary);
    background: transparent;
    color: var(--primary);
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-primary {
    padding: 0.625rem 1.25rem;
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
    text-decoration: none;
    display: inline-block;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-large {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

main {
    margin-top: 100px;
}

/* Footer */
.footer {
    background: var(--gray-900);
    color: var(--gray-300);
    padding: 4rem 0 2rem;
    margin-top: 5rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    color: var(--white);
    margin-bottom: 1rem;
}

.footer-desc {
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.social-link {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--gray-800);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-300);
    transition: var(--transition);
}

.social-link:hover {
    background: var(--primary);
    color: var(--white);
}

.footer-subtitle {
    font-size: 1.125rem;
    color: var(--white);
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--gray-300);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-800);
}

/* Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}

.search-overlay.active {
    display: flex;
}

.search-container {
    max-width: 600px;
    width: 100%;
    padding: 0 1rem;
}

.search-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
}

.search-box i {
    color: var(--gray-400);
    margin-right: 1rem;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.125rem;
}

.search-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
}

.search-results {
    background: var(--white);
    border-radius: var(--radius-lg);
    max-height: 60vh;
    overflow-y: auto;
}

.nav-toggle {
    display: none;
}

/* Responsive - 모바일 상단 메뉴 정리 */
@media (max-width: 768px) {
    .nav-container {
        padding: 0.25rem 0.5rem;
        min-height: 48px;
        flex-wrap: nowrap;
    }
    .nav-menu,
    .nav-actions {
        display: none !important;
    }
    .nav-toggle {
        display: flex !important;
        flex-shrink: 0;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }
    .nav-brand {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    .nav-brand a {
        font-size: 0.9375rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    .nav-brand a span {
        font-size: inherit;
    }
    .footer-content {
        grid-template-columns: 1fr;
    }
}
