/* ==========================================================================
   DESIGN SYSTEM: CLEAN CORPORATE BLUE (PREMIUM SAAS THEME)
   ========================================================================== */

/* --- Font Import --- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Geist+Mono:wght@400;500;600&display=swap');

:root {
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Geist Mono', Consolas, "SF Mono", monospace;
    
    /* --- HSL Color System (Clean Corporate Blue - Light Theme Default) --- */
    --bg-main: hsl(210, 40%, 98%);      /* Soft blue-gray white */
    --bg-card: hsl(0, 0%, 100%);        /* Pure white */
    --bg-sidebar: hsl(0, 0%, 100%);     /* Pure white */
    --border-color: hsl(214, 32%, 91%);  /* Slate-200 */
    --border-hover: hsl(215, 27%, 84%);  /* Slate-300 */
    
    --text-primary: hsl(222, 47%, 11%);  /* Slate-900 */
    --text-secondary: hsl(215, 16%, 37%);/* Slate-600 */
    --text-muted: hsl(215, 16%, 57%);    /* Slate-400 */
    
    --primary: hsl(221, 83%, 53%);       /* Royal Corporate Blue */
    --primary-hover: hsl(224, 76%, 48%);
    --primary-rgb: 37, 99, 235;
    
    --accent: hsl(221, 83%, 53%);
    --success: hsl(142, 76%, 36%);       /* Balanced Emerald */
    --warning: hsl(35, 92%, 45%);        /* Warm Amber */
    --danger: hsl(350, 89%, 50%);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 10px 15px -3px rgba(99, 102, 241, 0.05), 0 4px 6px -4px rgba(99, 102, 241, 0.03);
    
    --transition-fast: 0.12s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
}

/* --- Premium Deep Navy Dark Mode --- */
[data-theme="dark"] {
    --bg-main: hsl(222, 47%, 6%);        /* Slate-950 */
    --bg-card: hsl(222, 47%, 10%);       /* Slate-900 */
    --bg-sidebar: hsl(222, 47%, 8%);     /* Slate-950/900 mix */
    --border-color: hsl(217, 33%, 17%);  /* Slate-800 */
    --border-hover: hsl(217, 33%, 24%);  
    
    --text-primary: hsl(210, 40%, 98%);  /* Slate-50 */
    --text-secondary: hsl(215, 20%, 75%);/* Slate-300 */
    --text-muted: hsl(215, 16%, 47%);    /* Slate-500 */
    
    --primary: hsl(217, 91%, 60%);       /* Lighter corporate blue */
    --primary-hover: hsl(217, 91%, 65%);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 30px 60px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Tabular figures for number alignments */
.tabular-nums, input, .output-value {
    font-variant-numeric: tabular-nums;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* Mobile Header */
.mobile-header {
    display: none;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 20px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.hamburger-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* ==========================================================================
   SIDEBAR & NAVIGATION (CLEAN SAAS STYLE)
   ========================================================================== */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 90;
    transition: transform var(--transition-normal), background-color var(--transition-normal);
}

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

.brand {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--primary);
    box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.5);
}

.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    width: 34px;
    height: 34px;
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.theme-toggle-btn:hover {
    border-color: var(--border-hover);
    background-color: var(--bg-main);
}

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

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
    padding-left: 8px;
    margin-bottom: 8px;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: block;
    padding: 9px 12px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-main);
}

.nav-link.active {
    color: var(--primary);
    background-color: hsl(221, 83%, 97%);
    font-weight: 600;
}

[data-theme="dark"] .nav-link.active {
    color: var(--text-primary);
    background-color: var(--border-color);
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 16px;
    font-size: 12px;
}

.sidebar-footer a {
    color: var(--text-muted);
}

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

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main-content {
    padding: 48px 56px;
    max-width: 1150px;
    width: 100%;
}

.hero-section {
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 28px;
}

.hero-section h1 {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.hero-section p {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 780px;
}

/* ==========================================================================
   CARDS & GRID LAYOUT
   ========================================================================== */
.grid-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 28px;
    align-items: start;
    margin-bottom: 48px;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 24px;
    color: var(--text-secondary);
}

/* ==========================================================================
   FORM CONTROLS (CLEAN INTERACTIVE DESIGN)
   ========================================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 11px 14px;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-sans);
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.input-suffix {
    position: absolute;
    right: 14px;
    color: var(--text-muted);
    font-size: 13px;
    font-family: var(--font-mono);
    pointer-events: none;
}

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

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 32px;
    cursor: pointer;
}

/* ==========================================================================
   OUTPUT VISUALIZATION
   ========================================================================== */
.output-card {
    border-top: 3px solid var(--primary);
}

.output-value-container {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 16px;
    text-align: left;
}

.output-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 6px;
    display: block;
}

.output-value {
    font-family: var(--font-mono);
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.output-value.highlight-success {
    color: var(--success);
}

.output-value.highlight-warning {
    color: var(--warning);
}

.output-subtext {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Alert Notification Panel */
.alert-box {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--border-radius-sm);
    margin-top: 16px;
    font-size: 13px;
    border: 1px solid var(--border-color);
}

.alert-box.info {
    background-color: hsl(210, 40%, 96%);
    border-color: hsl(214, 32%, 91%);
    color: var(--text-secondary);
}

[data-theme="dark"] .alert-box.info {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

.alert-box.warning {
    background-color: hsl(38, 92%, 97%);
    border-color: hsl(35, 92%, 85%);
    color: var(--warning);
}

[data-theme="dark"] .alert-box.warning {
    background-color: hsl(38, 92%, 4%);
    border-color: hsl(35, 92%, 12%);
}

.alert-icon {
    font-size: 15px;
    flex-shrink: 0;
}

/* ==========================================================================
   SEO / ARTICLES SECTION
   ========================================================================== */
.content-wrapper {
    margin-top: 48px;
    border-top: 1px solid var(--border-color);
    padding-top: 36px;
}

.article-section {
    margin-bottom: 36px;
    max-width: 800px;
}

.article-section h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.article-section p {
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.6;
}

.article-section ul {
    margin-left: 24px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 15px;
}

.article-section li {
    margin-bottom: 8px;
}

/* Formula Block */
.formula-block {
    background-color: hsl(210, 40%, 96%);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 16px 24px;
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--primary);
    margin: 20px 0;
    text-align: center;
    overflow-x: auto;
}

[data-theme="dark"] .formula-block {
    background-color: var(--bg-card);
}

/* ==========================================================================
   FAQ ACCORDION (MINIMALIST)
   ========================================================================== */
.faq-accordion {
    max-width: 800px;
    margin-bottom: 48px;
    border-top: 1px solid var(--border-color);
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
}

.faq-question {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    padding: 20px 0;
}

.faq-answer {
    color: var(--text-secondary);
    padding: 0 0 20px 0;
    display: none;
    font-size: 15px;
    line-height: 1.6;
}

.faq-icon {
    font-weight: 300;
    font-size: 18px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.faq-item.active .faq-answer {
    display: block;
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    
    .mobile-header {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        height: 100vh;
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0,0,0,0.15);
    }
    
    .main-content {
        padding: 24px 16px;
    }
    
    .hero-section h1 {
        font-size: 26px;
    }
}
