/* --- Global Styles --- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f9;
    color: #333;
    line-height: 1.5;
}

/* --- Header & Navigation --- */
.main-banner {
    background-color: #ffffff;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.banner-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 30px;
}

.logo {
    margin: 0;
    font-size: 24px;
    letter-spacing: -0.5px;
}

.logo a {
    text-decoration: none;
}

.logo .lab-text {
    font-weight: 400;
    color: #000000;
}

.logo .calc-text {
    font-weight: 700;
    color: #005fa3;
}

.nav-links {
    display: flex;
    gap: 25px;
}

.nav-links a {
    text-decoration: none;
    color: #666;
    font-weight: 600;
    font-size: 15px;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease-in-out;
}

.nav-links a:hover, 
.nav-links a.active {
    color: #005fa3;
    border-bottom: 2px solid #005fa3;
}

/* --- Layout Structure --- */
.container {
    display: flex;
    max-width: 1200px;
    margin: 40px auto;
    gap: 30px;
    padding: 0 20px;
}

.left-panel {
    flex: 1.5;
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.right-panel {
    flex: 1;
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    height: fit-content;
}

/* --- Calculator UI Elements --- */
h2 {
    color: #005fa3;
    margin-top: 0;
    font-weight: 700;
}

label {
    display: block;
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 5px;
    font-size: 14px;
    color: #555;
}

.row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

input[type="number"] {
    flex: 3.5;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
}

select {
    flex: 0.8;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    background-color: #f9f9f9;
    min-width: 85px;
}

input:focus, select:focus {
    outline: none;
    border-color: #005fa3;
    box-shadow: 0 0 0 3px rgba(0, 95, 163, 0.1);
}

/* --- Buttons --- */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    width: 50%; 
}

button {
    flex: 1; 
    padding: 10px;
    background-color: #005fa3;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    white-space: nowrap; 
}

button:hover {
    background-color: #004a80;
}

/* --- Results Area --- */
.result-grid-box {
    margin-top: 25px;
    padding: 20px;
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-height: 150px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    white-space: pre-wrap;
    background-image: linear-gradient(rgba(200, 200, 200, 0.3) 1px, transparent 1px), 
                      linear-gradient(90deg, rgba(200, 200, 200, 0.3) 1px, transparent 1px);
    background-size: 20px 20px;
}

.result-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.result-footer button {
    flex: 0;
    padding: 8px 20px;
    background-color: #28a745;
}

.checkbox-container {
    font-size: 13px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* --- Footer --- */
.main-footer {
    text-align: center;
    padding: 40px 0;
    color: #888;
    font-size: 14px;
}

.main-footer a {
    color: #005fa3;
    text-decoration: none;
}

/* --- ADDED FOR MOBILE (Strictly isolated) --- */
@media (max-width: 768px) {
    /* 1. Prevent banner from stopping at 2/3 width */
    html, body { overflow-x: hidden; width: 100%; }
    .main-banner { width: 100%; box-sizing: border-box; }
    
    /* 2. Fix bunched tabs by allowing them to wrap and stacking logo */
    .banner-container {
        flex-direction: column;
        padding: 15px;
        gap: 15px;
    }
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    .nav-links a {
        font-size: 13px;
        padding: 5px 8px;
        border: 1px solid #eee;
        border-radius: 4px;
    }
    
    /* 3. Stack the Calculator and "How to use" panels */
    .container {
        flex-direction: column;
        margin: 20px auto;
    }
}
