/* =====================================================
   재무 분석 시스템 — 디자인 시스템
   Premium Dark Theme + Glassmorphism + Micro-animations
   ===================================================== */

/* ─── 폰트 ─── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700;900&family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── CSS Variables ─── */
:root {
    --font-primary: 'Noto Sans KR', 'Inter', sans-serif;

    /* 색상 팔레트 */
    --bg-primary:   #0a0e1a;
    --bg-secondary: #111827;
    --bg-card:      rgba(17, 24, 39, 0.7);
    --bg-glass:     rgba(30, 41, 59, 0.5);

    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;

    --accent-blue:    #3b82f6;
    --accent-purple:  #8b5cf6;
    --accent-cyan:    #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber:   #f59e0b;
    --accent-rose:    #f43f5e;

    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-hero:    linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    --gradient-card:    linear-gradient(145deg, rgba(59,130,246,0.08) 0%, rgba(139,92,246,0.08) 100%);

    --border-color: rgba(148, 163, 184, 0.15);
    --shadow-soft:  0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow:  0 0 30px rgba(59, 130, 246, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* ─── Reset & Base ─── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.3s ease;
}
a:hover {
    color: var(--accent-cyan);
}

/* ─── Layout ─── */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.container.admin-container {
    max-width: 1800px;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 40px 0;
}

/* ─── Header / Navigation ─── */
.nav-header {
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.3s ease;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.nav-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    background: var(--bg-glass);
    color: var(--text-primary);
}

/* ─── Hero Section ─── */
.hero {
    background: var(--gradient-hero);
    padding: 100px 0 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59,130,246,0.12) 0%, transparent 70%);
    top: -150px;
    right: -100px;
    border-radius: 50%;
    animation: pulse-glow 6s ease-in-out infinite;
}

.hero::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139,92,246,0.1) 0%, transparent 70%);
    bottom: -100px;
    left: -50px;
    border-radius: 50%;
    animation: pulse-glow 8s ease-in-out infinite reverse;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 1; }
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 900;
    line-height: 1.3;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.hero h1 .gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    position: relative;
    z-index: 1;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.4);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
    background: rgba(244, 63, 94, 0.25);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 16px 36px;
    font-size: 1.05rem;
}

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.4s ease;
    overflow: hidden;
}

.card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: var(--shadow-glow);
    transform: translateY(-4px);
}

.card-header {
    padding: 24px 28px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 24px 28px;
}

.card-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--border-color);
}

/* ─── Feature Cards Grid ─── */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.feature-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: all 0.4s ease;
}

.feature-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-6px);
    box-shadow: var(--shadow-glow);
}

.feature-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* ─── Score Badge ─── */
.score-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 700;
}

.score-badge.high {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.score-badge.medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.score-badge.low {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.score-badge.none {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

/* ─── Score Circle ─── */
.score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 900;
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid;
    border-color: inherit;
    opacity: 0.25;
}

/* ─── Forms ─── */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* ─── Upload Zone ─── */
.upload-zone {
    border: 2px dashed rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-xl);
    padding: 60px 40px;
    text-align: center;
    background: var(--gradient-card);
    cursor: pointer;
    transition: all 0.4s ease;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.08);
    transform: scale(1.01);
}

.upload-zone .upload-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.upload-zone h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ─── Results Dashboard ─── */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
}

.analyzer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.analyzer-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.4s ease;
}

.analyzer-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: var(--shadow-glow);
}

.analyzer-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
}

.analyzer-header .icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.analyzer-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.analyzer-header .score-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.solution-list {
    padding: 16px 24px;
}

.solution-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.solution-item:last-child {
    border-bottom: none;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.solution-item:nth-child(1) { animation-delay: 0.1s; }
.solution-item:nth-child(2) { animation-delay: 0.2s; }
.solution-item:nth-child(3) { animation-delay: 0.3s; }
.solution-item:nth-child(4) { animation-delay: 0.4s; }

.solution-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.solution-reason {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.solution-effects {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.effect-tag {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.5;
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.risk-tag {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.5;
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

/* ─── Top Recommendations ─── */
.top-recommendations {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    margin-bottom: 40px;
}

.top-recommendations h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.top-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
}

.top-item:hover {
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateX(4px);
}

.top-rank {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.top-rank.rank-1 { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }
.top-rank.rank-2 { background: rgba(148, 163, 184, 0.2); color: var(--text-secondary); }
.top-rank.rank-3 { background: rgba(180, 83, 9, 0.2); color: #d97706; }

.top-info {
    flex: 1;
}

.top-info h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.top-info .category {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ─── Flash Messages ─── */
.flash {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.flash-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--accent-emerald);
}

.flash-error {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: var(--accent-rose);
}

.flash-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--accent-blue);
}

/* ─── Table ─── */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 14px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

/* ─── Progress Bar ─── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 100px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 100px;
    transition: width 1.2s ease;
    background: var(--gradient-primary);
}

/* ─── Footer ─── */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 40px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ─── Loading Spinner ─── */
.spinner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.spinner-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.spinner {
    text-align: center;
}

.spinner .ring {
    width: 60px;
    height: 60px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .hero { padding: 60px 0 50px; }
    .feature-grid { grid-template-columns: 1fr; }
    .analyzer-grid { grid-template-columns: 1fr; }
    .nav-links { display: none; }
    .container { padding: 0 16px; }
}

/* ─── Auth Pages ─── */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 70px);
    padding: 40px 24px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(12px);
    padding: 40px;
}

.auth-card h2 {
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 32px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ─── Section Heading ─── */
.section-heading {
    margin-bottom: 16px;
}

.section-heading h2 {
    font-size: 1.5rem;
    font-weight: 800;
}

.section-heading p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}
