/* static/style.css — Deep Space AI Theme v3.0.0 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800;900&display=swap');
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

/* ═══════════════════════════════════════════════════
   DESIGN TOKENS — Deep Space Palette
═══════════════════════════════════════════════════ */
:root {
    /* Brand Colors */
    --blue-core:     #3b82f6;
    --blue-bright:   #60a5fa;
    --blue-glow:     rgba(59, 130, 246, 0.35);
    --blue-deep:     #1d4ed8;
    --purple-core:   #8b5cf6;
    --purple-glow:   rgba(139, 92, 246, 0.25);
    --cyan-core:     #06b6d4;
    --orange-core:   #f97316;
    --orange-glow:   rgba(249, 115, 22, 0.35);
    --green-core:    #10b981;
    --green-glow:    rgba(16, 185, 129, 0.3);
    --red-core:      #ef4444;

    /* Gradient Presets */
    --grad-blue:     linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    --grad-orange:   linear-gradient(135deg, #f97316 0%, #ef4444 100%);
    --grad-green:    linear-gradient(135deg, #10b981 0%, #059669 100%);
    --grad-purple:   linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    --grad-hero:     linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #818cf8 100%);
    --grad-neon:     linear-gradient(90deg, #3b82f6, #8b5cf6, #3b82f6);

    /* Background System - Deep Space */
    --bg-root:       #060b14;
    --bg-main:       #08111f;
    --bg-sidebar:    rgba(8, 17, 31, 0.95);
    --bg-card:       rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-glass:      rgba(255, 255, 255, 0.05);
    --bg-input:      rgba(255, 255, 255, 0.06);

    /* Border System */
    --border:        rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.04);
    --border-blue:   rgba(59, 130, 246, 0.3);
    --border-orange: rgba(249, 115, 22, 0.3);
    --border-green:  rgba(16, 185, 129, 0.3);
    --border-bright: rgba(255, 255, 255, 0.14);

    /* Text System */
    --text-primary:  #f0f6ff;
    --text-secondary:#94a3b8;
    --text-muted:    #475569;
    --text-bright:   #ffffff;

    /* Layout */
    --sidebar-width: 340px;
    --header-h:      60px;
    --radius-xl:     24px;
    --radius-lg:     16px;
    --radius-md:     12px;
    --radius-sm:     8px;
    --radius-xs:     6px;

    /* Shadows */
    --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:     0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg:     0 16px 48px rgba(0,0,0,0.6);
    --shadow-blue:   0 0 24px rgba(59, 130, 246, 0.25);
    --shadow-orange: 0 0 24px rgba(249, 115, 22, 0.25);
    --shadow-green:  0 0 24px rgba(16, 185, 129, 0.25);

    /* Transitions */
    --ease:          all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    --ease-bounce:   all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ═══════════════════════════════════════════════════
   GLOBAL RESET
═══════════════════════════════════════════════════ */
*, *::before, *::after {
    font-family: 'Pretendard', 'Inter', sans-serif;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background-color: var(--bg-root);
    background-image:
        radial-gradient(ellipse at 20% 10%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 90%, rgba(139, 92, 246, 0.10) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.04) 0%, transparent 60%);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
}

/* ═══════════════════════════════════════════════════
   1. SIDEBAR — Deep Space Glass Panel
═══════════════════════════════════════════════════ */
aside {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 20;
    border-right: 1px solid var(--border);
    position: relative;
}

/* Ambient glow line on sidebar right edge */
aside::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    bottom: 20%;
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--blue-glow), transparent);
}

/* Logo Header */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--grad-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.1rem;
    font-family: 'Outfit', sans-serif;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4), var(--shadow-sm);
    flex-shrink: 0;
}

.logo-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-bright);
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.logo-text span {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--blue-bright);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 3px;
    display: block;
}

/* Tab Switcher */
.sidebar-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.tab-btn {
    padding: 9px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    border: 1px solid var(--border);
    background: var(--bg-glass);
    color: var(--text-secondary);
    transition: var(--ease);
    letter-spacing: -0.01em;
}

.tab-btn:hover:not(.active) {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-bright);
}

.tab-btn.active {
    background: var(--grad-blue);
    color: white;
    border-color: transparent;
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.3);
}

/* Sidebar Scroll Area */
.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar-title {
    display: none !important;
}

/* Manual Guide Box */
.manual-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    transition: var(--ease);
}

.manual-container-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.manual-btn {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-glass);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--ease);
    text-align: center;
    letter-spacing: -0.01em;
}

.manual-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-blue);
}

.manual-btn.active {
    background: var(--grad-blue);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-blue);
}

/* Auto Routing Button */
.btn-auto-routing {
    width: 100%;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    text-align: center;
    border: 1px solid var(--border);
    background: var(--bg-glass);
    color: var(--text-secondary);
    transition: var(--ease);
    letter-spacing: -0.02em;
}

.btn-auto-routing.active {
    background: var(--grad-orange);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-orange);
}

.btn-auto-routing:hover:not(.active) {
    background: var(--bg-card-hover);
    border-color: var(--border-orange);
    color: var(--text-primary);
}

/* Category Chip Grid */
.category-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.cat-btn {
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 1.02rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-glass);
    color: var(--text-secondary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    transition: var(--ease);
    letter-spacing: -0.01em;
}

.cat-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-bright);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.cat-btn.active {
    background: var(--grad-blue);
    color: white;
    border-color: transparent;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

/* Download Container */
.file-container {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    border: 1px solid var(--border);
}

.file-container-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.download-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.download-link {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-glass);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.98rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--ease);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.download-link:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-blue);
    color: var(--blue-bright);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
}

.manual-btn-footer {
    width: 100%;
    padding: 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border-blue);
    border-radius: var(--radius-md);
    font-size: 1.0rem;
    font-weight: 700;
    color: var(--blue-bright);
    cursor: pointer;
    text-align: center;
    transition: var(--ease);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.manual-btn-footer:hover {
    background: var(--bg-card-hover);
    border-color: var(--blue-core);
    color: var(--text-bright);
    box-shadow: var(--shadow-blue);
}

.admin-link-btn {
    width: 100%;
    padding: 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1.0rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: center;
    transition: var(--ease);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
    position: relative;
}

.admin-link-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-bright);
    color: var(--text-primary);
}

.admin-link-btn.logged-in::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--green-core);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--green-core);
    animation: pulse-green 2s ease-in-out infinite;
}

.disclaimer {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════
   2. MAIN CONTENT AREA
═══════════════════════════════════════════════════ */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: var(--bg-main);
    background-image:
        radial-gradient(ellipse at 70% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 80%, rgba(139, 92, 246, 0.04) 0%, transparent 40%);
}

/* 2-A. Header */
.main-header {
    height: var(--header-h);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(8, 17, 31, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 5;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green-core);
    box-shadow: 0 0 10px var(--green-core);
    flex-shrink: 0;
    animation: pulse-green 2s ease-in-out infinite;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 6px var(--green-core); }
    50% { box-shadow: 0 0 14px var(--green-core), 0 0 24px rgba(16, 185, 129, 0.3); }
}

.active-mode-badge {
    padding: 3px 9px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.active-mode-badge.badge-blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--blue-bright);
    border: 1px solid var(--border-blue);
}

.active-mode-badge.badge-green {
    background: rgba(16, 185, 129, 0.12);
    color: var(--green-core);
    border: 1px solid var(--border-green);
}

.active-category-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.engine-badge {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 30px;
}

.engine-badge.badge-blue {
    border: 1px solid var(--border-blue);
    color: var(--blue-bright);
    background: rgba(59, 130, 246, 0.08);
}

.engine-badge.badge-green {
    border: 1px solid var(--border-green);
    color: var(--green-core);
    background: rgba(16, 185, 129, 0.06);
}

/* ═══════════════════════════════════════════════════
   2-B. MANUAL VIEWER — Full-Screen Fixed Overlay
═══════════════════════════════════════════════════ */
.manual-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none; /* JS로 flex 전환 */
    flex-direction: column;
    background: var(--bg-root);
    padding-left: var(--sidebar-width);
}

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

.manual-overlay-header {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(8, 17, 31, 0.9);
    backdrop-filter: blur(20px);
    flex-shrink: 0;
}

.manual-overlay-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.manual-overlay-close {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 14px;
    transition: var(--ease);
    display: flex;
    align-items: center;
    gap: 6px;
}

.manual-overlay-close:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-bright);
    color: var(--text-primary);
}

.manual-iframe-wrapper {
    flex: 1;
    overflow: hidden;
    background: #ffffff;
    margin: 20px 28px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg), var(--shadow-blue);
}

.manual-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ═══════════════════════════════════════════════════
   2-C. CHAT AREA
═══════════════════════════════════════════════════ */
.chat-viewport {
    flex: 1;
    overflow: hidden;
    width: 100%;
    position: relative;
}

.chat-container {
    height: 100%;
    overflow-y: auto;
    padding: 32px 28px 220px;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}

.chat-container::-webkit-scrollbar { width: 4px; }
.chat-container::-webkit-scrollbar-track { background: transparent; }
.chat-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

/* Chat Messages */
.chat-message {
    width: 100%;
    margin-bottom: 28px;
    display: flex;
    gap: 16px;
    animation: slideIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.chat-message.user {
    flex-direction: row-reverse;
}

/* Avatars */
.avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--grad-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.75rem;
    font-family: 'Outfit', sans-serif;
    flex-shrink: 0;
    box-shadow: var(--shadow-blue);
}

.chat-message.user .avatar {
    background: rgba(71, 85, 105, 0.8);
    box-shadow: var(--shadow-sm);
}

/* Message Bubbles */
.message-content {
    flex: 1;
    font-size: 1.12rem;
    line-height: 1.85;
    color: var(--text-primary);
    overflow-wrap: break-word;
    word-break: keep-all;
}

.chat-message.user .message-content {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    max-width: 75%;
    min-width: 200px;
    width: fit-content;
    flex-grow: 0;
    color: var(--text-primary);
}

/* AI message has a subtle left accent */
.chat-message.ai .message-content {
    border-left: 2px solid rgba(59, 130, 246, 0.3);
    padding-left: 16px;
}

/* ═══════════════════════════════════════════════════
   2-D. WELCOME SCREEN
═══════════════════════════════════════════════════ */
.welcome-screen {
    text-align: center;
    margin: auto 0;
    padding: 40px 0;
    animation: slideIn 0.5s ease-out forwards;
    flex-shrink: 0;
}

.welcome-logo {
    font-family: 'Outfit', sans-serif;
    font-size: 3.2rem;
    font-weight: 900;
    background: var(--grad-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: -0.03em;
    animation: shimmer 4s ease-in-out infinite;
    background-size: 200% auto;
}

@keyframes shimmer {
    0% { background-position: 0% center; }
    50% { background-position: 100% center; }
    100% { background-position: 0% center; }
}

.welcome-screen h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.welcome-screen p {
    font-size: 1.08rem;
    color: var(--text-secondary);
    margin-bottom: 36px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}

/* 모바일 전용: 입력창 안내 힌트 */
.welcome-mobile-hint {
    font-size: 1.0rem !important;
    color: var(--blue-bright) !important;
    margin-bottom: 0 !important;
    padding: 14px 24px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid var(--border-blue);
    border-radius: var(--radius-lg);
    display: inline-block;
    animation: pulse-glow 2.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); }
    50%       { box-shadow: 0 0 16px rgba(59,130,246,0.3); }
}

@media (max-width: 768px) {
    .welcome-screen {
        padding: 12px 0 8px;
        margin: 0;
    }
    .welcome-logo { font-size: 2.0rem; margin-bottom: 4px; }
    .welcome-screen h3 { font-size: 0.98rem; margin-bottom: 14px; }
}


.welcome-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}

@media (max-width: 600px) {
    .welcome-grid { grid-template-columns: 1fr; }
}

.welcome-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    text-align: left;
    cursor: pointer;
    transition: var(--ease-bounce);
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--grad-blue);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
}

.welcome-card:hover {
    border-color: var(--border-blue);
    transform: translateY(-3px);
    box-shadow: var(--shadow-blue), var(--shadow-md);
}

.welcome-card:hover::before {
    opacity: 0.05;
}

.welcome-card h4 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
    letter-spacing: -0.01em;
    position: relative;
}

.welcome-card p {
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
    position: relative;
}

/* Welcome screen list items */
.welcome-screen ul {
    list-style: none;
    padding: 0;
    max-width: 500px;
    margin: 0 auto 32px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.welcome-screen li {
    font-size: 0.86rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 8px 18px;
    border-radius: 30px;
    border: 1px solid var(--border);
    display: inline-block;
}

/* ═══════════════════════════════════════════════════
   2-E. BOTTOM INPUT BAR
═══════════════════════════════════════════════════ */
.bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, var(--bg-main) 70%, transparent 100%);
    padding: 16px 24px 28px;
    z-index: 4;
}

.bottom-bar-wrapper {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

/* Quick Category Chips */
.quick-chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    justify-content: center;
}

.quick-chip-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 5px 13px;
    border-radius: 30px;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--ease);
    letter-spacing: -0.01em;
}

.quick-chip-btn:hover {
    border-color: var(--border-blue);
    color: var(--blue-bright);
    background: rgba(59, 130, 246, 0.08);
}

/* Input Form — Dark Glass Capsule */
.chat-form {
    position: relative;
    border-radius: 28px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: var(--ease);
    display: flex;
    align-items: center;
    padding: 13px 20px;
    gap: 8px;
}

.chat-form.mode-orange {
    border-color: var(--border-orange);
    box-shadow: var(--shadow-orange), var(--shadow-md);
}

.chat-form.mode-green {
    border-color: var(--border-green);
    box-shadow: var(--shadow-green), var(--shadow-md);
}

.chat-form.mode-blue {
    border-color: var(--border-blue);
    box-shadow: var(--shadow-blue), var(--shadow-md);
}

.chat-form:focus-within {
    border-color: var(--border-blue);
    box-shadow: var(--shadow-blue), var(--shadow-md);
}

.chat-form textarea {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.08rem;
    color: var(--text-primary);
    background: transparent;
    resize: none;
    height: 26px;
    line-height: 26px;
    caret-color: var(--blue-bright);
}

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

.send-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    transition: var(--ease);
    flex-shrink: 0;
}

.send-btn:hover {
    color: var(--blue-bright);
    transform: scale(1.15);
    filter: drop-shadow(0 0 8px var(--blue-core));
}

/* ═══════════════════════════════════════════════════
   3. REFERENCE CARDS (출처 카드)
═══════════════════════════════════════════════════ */
.ref-section-premium {
    margin-top: 18px;
    border-top: 1px solid var(--border-subtle);
    padding-top: 14px;
    width: 100%;
}

.ref-section-title-premium {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ref-grid-premium {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
}

@media (max-width: 900px) { .ref-grid-premium { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .ref-grid-premium { grid-template-columns: 1fr; } }

.ref-card-premium {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--ease);
    cursor: pointer;
    min-width: 0;
}

.ref-card-premium:hover {
    border-color: var(--border-blue);
    transform: translateY(-1.5px);
    box-shadow: var(--shadow-blue);
}

.ref-icon-premium {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.ref-info-premium { flex: 1; min-width: 0; }

.ref-title-premium {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.ref-score-premium {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1px;
}

/* ═══════════════════════════════════════════════════
   4. FEEDBACK & RECOMMENDATIONS
═══════════════════════════════════════════════════ */
.feedback-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.feedback-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 0.74rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--ease);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.feedback-btn:hover {
    border-color: var(--border-blue);
    color: var(--blue-bright);
    background: rgba(59, 130, 246, 0.08);
}

.feedback-registered-text {
    font-size: 0.74rem;
    color: var(--green-core);
    font-weight: 700;
    margin-top: 12px;
}

.feedback-comment-form {
    margin-top: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 14px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 460px;
}

.feedback-comment-form input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    outline: none;
    background: var(--bg-glass);
    color: var(--text-primary);
}

.feedback-comment-form input:focus {
    border-color: var(--border-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.feedback-comment-form button {
    align-self: flex-end;
    padding: 7px 14px;
    background: var(--grad-blue);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

/* Recommendations */
.recommendations-section { margin-top: 16px; }

.recommendations-title {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.recommendations-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rec-btn {
    background: var(--bg-glass);
    color: var(--blue-bright);
    border: 1px solid var(--border-blue);
    border-radius: 30px;
    padding: 7px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--ease);
}

.rec-btn:hover {
    background: var(--grad-blue);
    color: white;
    border-color: transparent;
    transform: translateY(-1.5px);
    box-shadow: var(--shadow-blue);
}

/* ═══════════════════════════════════════════════════
   5. AUTOCOMPLETE DROPDOWN
═══════════════════════════════════════════════════ */
.autocomplete-dropdown {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 10px;
    width: 320px;
    max-height: 260px;
    overflow-y: auto;
    background: rgba(12, 22, 42, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg), var(--shadow-blue);
    z-index: 999;
    display: none;
    padding: 8px 0;
}

.autocomplete-item {
    padding: 9px 16px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--ease);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--blue-bright);
}

.autocomplete-item .shortcut {
    font-size: 0.68rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════
   6. MODAL (출처 원문 팝업)
═══════════════════════════════════════════════════ */
.premium-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.premium-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.premium-modal-window {
    background: rgba(12, 22, 42, 0.96);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 660px;
    max-height: 80vh;
    box-shadow: var(--shadow-lg), var(--shadow-blue);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.premium-modal-overlay.active .premium-modal-window {
    transform: scale(1);
}

.premium-modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.premium-modal-title {
    font-size: 0.96rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.premium-modal-close {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 1.4rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--ease);
    padding: 0 6px;
    line-height: 1.2;
}

.premium-modal-close:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
    border-color: var(--border-bright);
}

.premium-modal-body {
    padding: 24px;
    overflow-y: auto;
    font-size: 1.12rem;
    line-height: 1.75;
    color: var(--text-secondary);
}

.premium-modal-body::-webkit-scrollbar { width: 4px; }
.premium-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.premium-modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
}

.premium-modal-footer-btn {
    background: var(--grad-blue);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--ease);
    box-shadow: var(--shadow-blue);
}

.premium-modal-footer-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════
   7. LOADING & BADGE EXTRAS
═══════════════════════════════════════════════════ */
.loading-bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    padding-left: 4px;
}

.loading-dot {
    width: 6px;
    height: 6px;
    background: var(--blue-core);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
    box-shadow: 0 0 6px var(--blue-core);
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.4); opacity: 0.4; }
    40% { transform: scale(1.0); opacity: 1; }
}

/* Badge extras */
.badge-info, .badge-route, .badge-slash {
    font-size: 0.76rem;
    font-weight: 700;
}

/* ═══════════════════════════════════════════════════
   MOBILE RESPONSIVE (< 768px)
═══════════════════════════════════════════════════ */

/* Hamburger toggle button (hidden on desktop) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 200;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: var(--ease);
}
.sidebar-toggle:hover {
    border-color: var(--border-blue);
    color: var(--blue-bright);
}

/* Sidebar overlay backdrop (mobile) */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}
.sidebar-backdrop.active { display: block; }

@media (max-width: 768px) {
    /* Body: single column, sidebar off-canvas */
    body {
        flex-direction: column;
        overflow: hidden;
    }

    /* Hamburger visible */
    .sidebar-toggle { display: flex; }

    /* Sidebar: off-canvas slide */
    aside {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 30;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
    aside.sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 32px rgba(0,0,0,0.6);
    }

    /* Main: full width */
    main {
        flex: 1;
        width: 100%;
        height: 100vh;
        padding-top: 0;
    }

    /* Header: leave room for hamburger */
    .main-header {
        padding: 14px 16px 14px 62px;
    }

    /* Chat container: tighter padding */
    .chat-container {
        padding: 8px 16px 180px;
    }

    /* Message font sizes */
    .message-content {
        font-size: 1.06rem;
        line-height: 1.8;
    }

    /* Bottom bar: full width, tighter */
    .bottom-bar {
        padding: 8px 14px 16px;
    }
    .bottom-bar-wrapper {
        max-width: 100%;
    }

    /* Chat form: slightly smaller */
    .chat-form {
        padding: 11px 14px;
        border-radius: 22px;
    }
    .chat-form textarea {
        font-size: 1.04rem;
        height: 24px;
        line-height: 24px;
    }

    /* Quick chips: scrollable row instead of wrap */
    .quick-chip-container {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        justify-content: flex-start;
        scrollbar-width: none;
    }
    .quick-chip-container::-webkit-scrollbar { display: none; }
    .quick-chip-btn { flex-shrink: 0; }

    /* Welcome screen: compact */
    .welcome-logo { font-size: 2.2rem; }
    .welcome-screen h3 { font-size: 1.1rem; }
    .welcome-screen p { font-size: 0.85rem; }
    .welcome-grid { grid-template-columns: 1fr; max-width: 100%; }

    /* User message: wider on mobile */
    .chat-message.user .message-content { max-width: 90%; }

    /* Manual overlay: no sidebar offset */
    .manual-overlay { padding-left: 0; }

    /* Send button: bigger tap target */
    .send-btn { padding: 6px 10px; }

    /* Ref cards: 1 column */
    .ref-grid-premium { grid-template-columns: 1fr; }

    /* Modal: full screen on mobile */
    .premium-modal-box {
        max-width: 100% !important;
        max-height: 90vh !important;
        margin: auto 8px 0;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }
    .premium-modal-overlay {
        align-items: flex-end !important;
    }

    /* Admin link smaller */
    .admin-link-btn { font-size: 0.75rem; padding: 8px 10px; }
}

@media (max-width: 480px) {
    .welcome-logo { font-size: 1.9rem; }
    .welcome-screen h3 { font-size: 1.0rem; }
    .active-category-title { font-size: 0.8rem; }
    .engine-badge { display: none; }
    .message-content { font-size: 1.02rem; }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── FAQ 등록 모달 전용 폼 스타일 ── */
.premium-modal-window .form-group {
    margin-bottom: 16px;
    text-align: left;
}

.premium-modal-window .form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.premium-modal-window .form-group input,
.premium-modal-window .form-group select,
.premium-modal-window .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    outline: none;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: var(--ease);
    font-family: inherit;
}

.premium-modal-window .form-group input::placeholder,
.premium-modal-window .form-group textarea::placeholder {
    color: var(--text-muted);
}

.premium-modal-window .form-group select option {
    background: #0d1929;
    color: var(--text-primary);
}

.premium-modal-window .form-group input:focus,
.premium-modal-window .form-group select:focus,
.premium-modal-window .form-group textarea:focus {
    border-color: var(--border-blue);
    background: rgba(59, 130, 246, 0.05);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.premium-modal-window .btn-submit {
    background: var(--grad-blue);
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: var(--ease);
    box-shadow: var(--shadow-blue);
}

.premium-modal-window .btn-submit:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

