/* 
 * ToolBox - Premium Design System (Vanilla CSS)
 * Supports System Theme and Manual Theme Toggle (Light / Dark)
 */

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

:root {
    /* Color Palette - HSL Tailored (Light Mode by Default) */
    --bg-base: #f8fafc;          /* Slate 50 */
    --bg-surface: #ffffff;       /* White */
    --bg-card: #f1f5f9;          /* Slate 100 */
    --border-color: #cbd5e1;     /* Slate 300 */
    
    --text-primary: #0f172a;     /* Slate 900 */
    --text-secondary: #334155;   /* Slate 700 */
    --text-muted: #64748b;       /* Slate 500 */

    /* Brand / Accent Colors */
    --primary: #4f46e5;          /* Indigo 600 */
    --primary-glow: rgba(79, 70, 229, 0.08);
    --secondary: #059669;        /* Emerald 600 */
    --accent: #f43f5e;           /* Rose 500 */
    
    /* Gradients */
    --grad-primary: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    --grad-glow: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
    --grad-card-hover: linear-gradient(180deg, rgba(0, 0, 0, 0.01) 0%, rgba(0, 0, 0, 0) 100%);

    /* Shadows & Glassmorphism */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.05), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
    --shadow-neon: 0 0 15px rgba(79, 70, 229, 0.1);
    
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(15, 23, 42, 0.08);
    --glass-blur: blur(12px);

    /* Transitions & Borders */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Dark Mode Variables Override */
[data-theme="dark"] {
    --bg-base: #0f172a;          /* Slate 900 */
    --bg-surface: #1e293b;       /* Slate 800 */
    --bg-card: #334155;          /* Slate 700 */
    --border-color: #475569;     /* Slate 600 */
    
    --text-primary: #f8fafc;     /* Slate 50 */
    --text-secondary: #cbd5e1;   /* Slate 300 */
    --text-muted: #94a3b8;       /* Slate 400 */

    --primary: #6366f1;          /* Indigo 500 */
    --primary-glow: rgba(99, 102, 241, 0.15);
    --secondary: #10b981;        /* Emerald 500 */
    
    --grad-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --grad-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.4) 0%, rgba(168, 85, 247, 0.4) 100%);
    --grad-card-hover: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 100%);
    
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-neon: 0 0 20px rgba(99, 102, 241, 0.2);
    
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-smooth);
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: none;
    border: none;
    outline: none;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & GNB */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    transition: var(--transition-smooth);
}

.site-header.scrolled {
    box-shadow: var(--shadow-lg);
}

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

.logo a {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 28px;
    height: 28px;
    fill: url(#logo-grad);
}

.gnb-nav {
    display: none; /* Desktop GNB - will show on large screens */
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Glass Buttons */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-bounce);
}

.btn-icon:hover {
    transform: scale(1.1) rotate(5deg);
    background-color: var(--primary-glow);
    border-color: var(--primary);
    box-shadow: var(--shadow-neon);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
    fill: var(--text-secondary);
    transition: var(--transition-smooth);
}

.btn-icon:hover svg {
    fill: var(--primary);
}

.menu-toggle {
    display: flex;
}

/* Sidebar Menu */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.sidebar-menu {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100vh;
    background-color: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-lg);
}

.sidebar-menu.active {
    transform: translateX(-320px);
}

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

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.category-group {
    margin-bottom: 24px;
}

.category-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    margin-bottom: 12px;
    padding-left: 4px;
}

.category-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.category-links a:hover {
    background-color: var(--bg-card);
    color: var(--primary);
    padding-left: 16px;
}

/* Ad Layout Sections */
.ad-section {
    width: 100%;
    margin: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Main Layout & App Container */
.main-wrapper {
    flex: 1;
    padding: 20px 0 60px 0;
}

/* Dashboard / Index UI */
.search-bar-container {
    margin-bottom: 30px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 16px 20px 16px 52px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-neon);
    background-color: var(--bg-surface);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    fill: var(--text-muted);
    pointer-events: none;
}

.tool-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.category-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-color) 0%, transparent 100%);
}

.tool-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tool-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: var(--transition-bounce);
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--grad-card-hover);
    opacity: 0;
    transition: var(--transition-smooth);
}

.tool-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg), var(--shadow-neon);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background-color: var(--primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: var(--transition-smooth);
}

.tool-card-icon svg {
    width: 24px;
    height: 24px;
    fill: var(--primary);
}

.tool-card:hover .tool-card-icon {
    background-color: var(--primary);
}

.tool-card:hover .tool-card-icon svg {
    fill: #ffffff;
    transform: scale(1.1);
}

.tool-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-card-info h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

.tool-card-action {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

.tool-card-action svg {
    width: 16px;
    height: 16px;
    fill: var(--primary);
    transition: transform 0.3s ease;
}

.tool-card:hover .tool-card-action svg {
    transform: translateX(4px);
}

/* Tool Workspace Template */
.tool-workspace {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px 20px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

@media (min-width: 768px) {
    .tool-workspace {
        padding: 40px;
    }
}

.tool-header {
    text-align: center;
    margin-bottom: 35px;
}

.tool-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tool-header p {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Universal Forms & Inputs */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.input-control {
    width: 100%;
    padding: 14px 18px;
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: var(--transition-smooth);
}

.input-control:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-neon);
}

.select-control {
    width: 100%;
    padding: 14px 18px;
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 24px;
    transition: var(--transition-smooth);
}

.select-control:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-neon);
}

/* Custom Interactive Switch (Binary Options) */
.switch-group {
    display: flex;
    background-color: var(--bg-base);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.switch-btn {
    flex: 1;
    padding: 12px;
    text-align: center;
    border-radius: calc(var(--radius-md) - 2px);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.switch-btn.active {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-md);
}

/* Core Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px;
    background: var(--grad-primary);
    color: #ffffff;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition-bounce);
}

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

.btn-primary:active {
    transform: translateY(0);
}

/* Results Display Area */
.result-box {
    margin-top: 30px;
    padding: 24px;
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.4s ease-out;
}

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

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.result-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.result-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.result-value {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--secondary);
}

/* SEO Content Section (Bottom) */
.seo-section {
    margin-top: 40px;
    padding: 30px 20px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

@media (min-width: 768px) {
    .seo-section {
        padding: 40px;
    }
}

.seo-content {
    color: var(--text-secondary);
}

.seo-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.seo-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.seo-content p {
    margin-bottom: 16px;
    line-height: 1.7;
}

.seo-content ul {
    margin-left: 20px;
    margin-bottom: 16px;
}

.seo-content li {
    margin-bottom: 8px;
}

/* Footer */
.site-footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 40px 0;
    margin-top: auto;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

@media (min-width: 768px) {
    .footer-container {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

.footer-links {
    list-style: none;
    display: flex;
    gap: 20px;
}

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

/* Media Queries & Desktop Layout adjustments */
@media (min-width: 1024px) {
    .gnb-nav {
        display: block;
    }
    
    .gnb-list {
        display: flex;
        list-style: none;
        gap: 24px;
    }
    
    .gnb-list a {
        font-weight: 600;
        font-size: 0.95rem;
        color: var(--text-secondary);
        position: relative;
        padding: 8px 0;
    }
    
    .gnb-list a::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 0;
        height: 2px;
        background: var(--grad-primary);
        transition: var(--transition-smooth);
    }
    
    .gnb-list a:hover {
        color: var(--text-primary);
    }
    
    .gnb-list a:hover::after {
        width: 100%;
    }
    
    .menu-toggle {
        display: none; /* Hide hamburger menu on desktop */
    }
}

/* Premium Table System */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin: 24px 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    font-size: 0.95rem;
}

.premium-table th, .premium-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}

.premium-table th {
    background-color: var(--bg-card);
    font-weight: 600;
    color: var(--text-primary);
}

.premium-table tr:last-child td {
    border-bottom: none;
}

.premium-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] .premium-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

