/* ===================================
   Chemical Unit Conversions - Main Stylesheet
   Chemistry-inspired color theme (blue/green)
   =================================== */

/* CSS Variables for Theme */
:root {
    --primary-color: #0077be;        /* Deep blue */
    --secondary-color: #00a86b;      /* Green */
    --accent-color: #1e90ff;         /* Bright blue */
    --dark-bg: #1a2332;              /* Dark navy */
    --light-bg: #f0f8ff;             /* Light blue background */
    --card-bg: #ffffff;
    --text-dark: #2c3e50;
    --text-light: #ffffff;
    --text-muted: #6c757d;
    --border-color: #d1e8f5;
    --shadow: 0 4px 12px rgba(0, 119, 190, 0.1);
    --shadow-hover: 0 8px 24px rgba(0, 119, 190, 0.2);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(135deg, #e3f2fd 0%, #e8f5e9 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation Bar */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-light);
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    padding: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo::before {
    content: "⚗️";
    font-size: 1.8rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-menu li a {
    color: var(--text-light);
    text-decoration: none;
    padding: 1rem 1rem;
    display: block;
    transition: var(--transition);
    border-radius: 4px;
    font-size: 0.95rem;
}

.nav-menu li a:hover,
.nav-menu li a.active {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Mobile Menu Toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Main Content Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
    flex: 1;
}

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.page-header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.page-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
}

/* Card Styles */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.card h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 0.5rem;
}

.card h3 {
    color: var(--secondary-color);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

/* Calculator Tool Styles */
.calculator-tool {
    background: linear-gradient(135deg, #ffffff 0%, #f0f8ff 100%);
    border: 2px solid var(--border-color);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1rem;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--card-bg);
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 119, 190, 0.1);
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Button Styles */
.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: var(--text-light);
    box-shadow: 0 4px 12px rgba(0, 119, 190, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 119, 190, 0.4);
}

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

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #00c97a 100%);
    color: var(--text-light);
    box-shadow: 0 4px 12px rgba(0, 168, 107, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 168, 107, 0.4);
}

.btn-block {
    width: 100%;
    margin-top: 1rem;
}

/* Result Display */
.result-box {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #e3f2fd 0%, #e8f5e9 100%);
    border-left: 5px solid var(--secondary-color);
    border-radius: 8px;
    display: none;
}

.result-box.show {
    display: block;
    animation: slideIn 0.3s ease;
}

.result-box h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1rem;
}

.result-box p {
    font-size: 1.2rem;
    color: var(--text-dark);
    font-weight: 600;
}

.error-box {
    background: #ffe6e6;
    border-left-color: #dc3545;
}

.error-box h3 {
    color: #dc3545;
}

/* Content Section */
.content-section {
    margin-top: 3rem;
}

.content-section p {
    margin-bottom: 1rem;
    text-align: justify;
    line-height: 1.8;
}

.formula-box {
    background: #f8f9fa;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    font-family: 'Courier New', monospace;
    text-align: center;
    font-size: 1.1rem;
}

.example-box {
    background: #fff9e6;
    border-left: 5px solid #ffc107;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 8px;
}

.example-box h4 {
    color: #ff8c00;
    margin-bottom: 1rem;
}

/* FAQ Section */
.faq-section {
    margin-top: 3rem;
}

.faq-item {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: var(--transition);
}

.faq-item:hover {
    border-color: var(--primary-color);
}

.faq-question {
    width: 100%;
    padding: 1.25rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq-question:hover {
    background: var(--light-bg);
}

.faq-question::after {
    content: "+";
    font-size: 1.5rem;
    color: var(--primary-color);
    transition: var(--transition);
}

.faq-question.active::after {
    content: "−";
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-answer-content {
    padding: 0 1.25rem 1.25rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

/* Footer */
.footer {
    background: var(--dark-bg);
    color: var(--text-light);
    padding: 3rem 2rem 1rem;
    margin-top: 4rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.footer-section p {
    color: #b0c4de;
    line-height: 1.8;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #b0c4de;
    text-decoration: none;
    transition: var(--transition);
}

.footer-section ul li a:hover {
    color: var(--secondary-color);
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #b0c4de;
}

/* Grid Layout for Tool Cards */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.tool-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 2px solid transparent;
}

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

.tool-card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.tool-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    margin-top: 0;
}

.tool-card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        background: var(--primary-color);
        padding: 1rem 0;
        gap: 0;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu li a {
        padding: 1rem 2rem;
    }

    .nav-container {
        flex-wrap: wrap;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .page-header p {
        font-size: 1rem;
    }

    .input-row {
        grid-template-columns: 1fr;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 1rem;
    }

    .card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.5rem;
    }

    .card h2 {
        font-size: 1.5rem;
    }

    .nav-logo {
        font-size: 1.2rem;
    }
}
