/* 
  BulkCalculator Temperature Tools - Design System 
  Theme: Modern SaaS, Clean, High Contrast, Accessibility Focused
*/

:root {
    --primary-color: #2563eb;
    /* Royal Blue */
    --primary-hover: #1d4ed8;
    --secondary-color: #0f172a;
    /* Slate 900 */
    --accent-color: #f59e0b;
    /* Amber 500 */
    --danger-color: #dc2626;
    --success-color: #16a34a;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    --nav-height: 64px;
}

[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-hover: #60a5fa;
    --secondary-color: #f8fafc;
    --background: #0f172a;
    --surface: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout Grid */
.layout-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: calc(100vh - var(--nav-height) - 200px);
    /* Adjust for header/footer */
    max-width: 1400px;
    margin: 0 auto;
    gap: 2rem;
    padding: 2rem;
}

.main-content {
    width: 100%;
}

/* Header */
.site-header {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    height: var(--nav-height);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: -0.025em;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background-color: transparent;
    color: var(--text-main);
    padding: 0;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
    display: flex;
    align-items: center;
}

.dropbtn::after {
    content: ' ▾';
    margin-left: 0.25rem;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--surface);
    min-width: 260px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0;
    max-height: 80vh;
    overflow-y: auto;
}

.dropdown-content a {
    color: var(--text-main);
    padding: 0.75rem 1rem;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
}

.dropdown-content a:hover {
    background-color: var(--background);
    color: var(--primary-color);
}

/* Desktop Hover */
@media (min-width: 769px) {
    .dropdown:hover .dropdown-content {
        display: block;
    }
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar */
.tools-sidebar {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: calc(var(--nav-height) + 2rem);
    box-shadow: var(--shadow-sm);
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tool-search {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    background: var(--background);
    color: var(--text-main);
}

.tool-list {
    list-style: none;
    max-height: 60vh;
    overflow-y: auto;
}

.tool-list li a {
    display: block;
    padding: 0.75rem 0.5rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 0.375rem;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.tool-list li a:hover,
.tool-list li a.active {
    background-color: var(--background);
    color: var(--primary-color);
    font-weight: 500;
    padding-left: 1rem;
}

/* Calculator Card */
.calculator-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 3rem;
}

.calc-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.calc-header h1 {
    font-size: 2rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.calc-subtitle {
    color: var(--text-muted);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.input-field {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1.1rem;
    background: var(--background);
    color: var(--text-main);
}

.unit-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--text-main);
    cursor: pointer;
    font-weight: 500;
}

.validation-error {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: none;
}

.action-buttons {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--background);
    border-color: var(--text-muted);
}

/* Results Panel */
.result-panel {
    margin-top: 2rem;
    padding: 2rem;
    background-color: var(--background);
    border-radius: 0.75rem;
    border: 1px solid var(--border);
}

.result-main {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.result-band {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.band-normal {
    background: #dcfce7;
    color: #166534;
}

.band-caution {
    background: #fef9c3;
    color: #854d0e;
}

.band-danger {
    background: #fee2e2;
    color: #991b1b;
}

.band-extreme {
    background: #450a0a;
    color: #fff;
}

.result-details p {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* Content Area */
.content-section {
    max-width: 800px;
    margin-bottom: 3rem;
}

.content-section h2 {
    font-size: 1.75rem;
    margin: 2rem 0 1rem;
    color: var(--text-main);
}

.content-section h3 {
    font-size: 1.25rem;
    margin: 1.5rem 0 1rem;
    color: var(--text-main);
}

.content-section p,
.content-section li {
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.formula-box {
    background: var(--background);
    padding: 1.5rem;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
    margin: 1rem 0;
    border-left: 4px solid var(--primary-color);
}

/* FAQ */
.faq-section {
    margin-top: 3rem;
    border-top: 1px solid var(--border);
    padding-top: 3rem;
}

.faq-item {
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    text-align: left;
    padding: 1.25rem;
    background: var(--surface);
    border: none;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
}

.faq-question::after {
    content: '+';
    font-size: 1.5rem;
    font-weight: 400;
}

.faq-item.active .faq-question::after {
    content: '-';
}

.faq-answer {
    padding: 0 1.25rem;
    max-height: 0;
    overflow: hidden;
    transition: 0.3s ease-out;
    background: var(--background);
    color: var(--text-muted);
}

.faq-item.active .faq-answer {
    padding: 1.25rem;
    max-height: 500px;
}

/* Related */
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.related-card {
    display: block;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.2s;
}

.related-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Footer */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 4rem 2rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
}

.footer-links a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 0.75rem;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* Mobile Button Default State */
.mobile-menu-btn {
    display: none;
    /* Hidden on Desktop */
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
}

/* Mobile */
@media (max-width: 1024px) {
    .layout-wrapper {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .tools-sidebar {
        position: static;
        margin-bottom: 2rem;
        max-height: none;
    }

    .tool-list {
        display: none;
        /* Collapse by default on mobile */
    }

    .tools-sidebar.active .tool-list {
        display: block;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 0 1rem;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        width: 100%;
        background: var(--surface);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--border);
        align-items: flex-start;
        /* Align left on mobile */
    }

    .nav-links.active {
        display: flex;
    }

    .mobile-menu-btn {
        display: block;
        /* Show on Mobile */
    }

    /* Mobile Dropdown styles */
    .dropdown {
        width: 100%;
    }

    .dropbtn {
        width: 100%;
        text-align: left;
        padding: 0.5rem 0;
        justify-content: space-between;
    }

    .dropdown-content {
        position: static;
        box-shadow: none;
        border: none;
        margin-left: 1rem;
        width: auto;
        display: none;
        transform: none;
        max-height: none;
        background: var(--background);
    }

    .dropdown.active .dropdown-content {
        display: block;
    }
}

/* Hub Page Specifics */
.hero-section {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--surface) 0%, var(--background) 100%);
    border-bottom: 1px solid var(--border);
    margin-bottom: 3rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Print Styles */
@media print {

    .site-header,
    .site-footer,
    .tools-sidebar,
    .action-buttons,
    .related-section,
    .faq-section {
        display: none !important;
    }

    .layout-wrapper {
        display: block;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .calculator-card {
        border: none;
        box-shadow: none;
    }

    body {
        background: white;
        color: black;
    }
}