:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --success: #22c55e;
    
    /* Fluid Specific Colors */
    --water: #3b82f6;
    --water-stream: #60a5fa;
    --pressure: #ec4899;
    --velocity: #10b981;
    --solid: #8b5cf6;
    
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --radius: 12px;
}

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

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

/* Header & Nav */
header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 2rem 1rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    text-align: center;
}

.header-content h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.header-content h1 span {
    color: var(--accent);
    font-weight: 300;
}

.header-content h2 {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    max-width: 1100px;
    margin: 0 auto;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.85rem;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

/* Main Layout */
main {
    max-width: 1400px;
    margin: 1rem auto;
    padding: 0 1rem;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

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

/* Components */
.card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

h3 {
    font-size: 1.6rem;
    margin-bottom: 1rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* Theory Table */
.theory-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: 1rem;
}

.theory-table th, .theory-table td {
    padding: 1.2rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.theory-table th {
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    border: none;
}

.theory-table tr td {
    background: rgba(255, 255, 255, 0.02);
    transition: transform 0.2s, background 0.2s;
}

.theory-table tr td:first-child { border-radius: 12px 0 0 12px; }
.theory-table tr td:last-child { border-radius: 0 12px 12px 0; }

.theory-table tr:hover td {
    background: rgba(255, 255, 255, 0.05);
    transform: scale(1.01);
}

.formula-display {
    font-family: 'Roboto Mono', monospace;
    color: white;
}

/* Simulator Container */
.simulator-container {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.controls-panel {
    flex: 1;
    min-width: 320px;
    max-width: 400px;
}

.visual-panel {
    flex: 2;
    min-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 1100px) {
    .simulator-container {
        flex-direction: column;
    }
    .controls-panel {
        max-width: 100%;
    }
    .visual-panel {
        min-width: 100%;
    }
}

/* Controls */
.control-group {
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.15);
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.control-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    font-weight: 500;
}

.input-with-value {
    display: flex;
    gap: 1rem;
    align-items: center;
}

input[type="range"]:focus {
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

button {
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-secondary { background: rgba(255, 255, 255, 0.1); color: white; border: 1px solid var(--glass-border); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.15); }

.btn-action { background: var(--success); color: white; width: 100%; margin-top: 0.5rem; }
.btn-action:hover { filter: brightness(1.1); }

/* Results */
.results-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
    padding: 1.2rem;
    margin-top: 1rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.result-item {
    display: flex;
    flex-direction: column;
}

.result-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    font-family: 'Roboto Mono', monospace;
}

.result-unit {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 4px;
}

/* Equations Section */
.equations-panel {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.equations-title {
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
    padding-bottom: 0.5rem;
}

.equation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.equation-section {
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.equation-section h5 {
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.equation-step {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.equation-note {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--warning);
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(245, 158, 11, 0.05);
    border-radius: 4px;
}

.dynamic-val {
    color: var(--success);
    font-weight: 700;
}

.canvas-overlay {
    position: absolute;
    top: 10px;
    right: 15px;
    pointer-events: none;
    text-align: right;
}

.overlay-tag {
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    margin-bottom: 5px;
}

/* Explanation / Development */
.development-box {
    margin-top: 1rem;
    padding: 1.2rem;
    background: rgba(56, 189, 248, 0.05);
    border-radius: var(--radius);
    border: 1px dashed rgba(56, 189, 248, 0.2);
    font-size: 0.9rem;
}

.development-box h4 {
    color: var(--accent);
    margin-bottom: 0.8rem;
}

.step-item {
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--accent);
}

.input-with-value {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
}

.val-display {
    min-width: 90px;
    text-align: right;
    font-weight: 700;
    color: var(--accent);
    font-family: 'Roboto Mono', monospace;
}

input[type="range"] {
    width: 100%;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--glass-border);
}

footer p {
    margin-bottom: 0.5rem;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

/* Modal System */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1.5rem;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--bg-color);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    z-index: 10;
}

.about-card {
    padding: 2.5rem;
}

.about-header h2 {
    color: var(--accent);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.about-section {
    margin-bottom: 1.5rem;
}

.about-section p {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.warning-card {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin: 2rem 0;
}

.warning-card h4 {
    color: var(--warning);
    margin-bottom: 0.5rem;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.about-grid h4 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.about-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.about-link:hover {
    text-decoration: underline;
}

.modal-footer {
    margin-top: 2.5rem;
    text-align: right;
}

@media (max-width: 768px) {
    .about-grid {
        grid-template-columns: 1fr;
    }
    
    .about-card {
        padding: 1.5rem;
    }
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Utilities */
.hidden { display: none !important; }

/* Responsive adjustments */
@media (max-width: 600px) {
    header { padding: 1.5rem 1rem; }
    .header-content h1 { font-size: 1.6rem; }
    .nav-btn { padding: 0.5rem 0.8rem; font-size: 0.75rem; }
    .card { padding: 1rem; }
    .visual-panel { min-width: 100%; }
}
