* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    font-family: "Comic Sans MS", "Marker Felt", "Segoe Print", cursive, sans-serif;
    color: #5a3d2a; 
    background-color: #fff8e6; 
    line-height: 1.5;
}

.main-container {
    padding-top: 60px;
    max-width: 900px;
    margin: 0 auto;
    padding-left: 15px;
    padding-right: 15px;
}

.top-nav {
    background-color: #8b5a2b;
    color: white;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #5a3d2a; 
}

.nav-brand {
    font-size: 1.5em;
    font-weight: bold;
    text-decoration: none;
    color: white;
}

.nav-links {
    list-style: none;
    display: flex;
}

.nav-links li {
    margin-left: 20px;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-size: 0.9em;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.nav-links a:hover, .nav-links a.active {
    background-color: rgba(255,255,255,0.2);
}

.nav-toggle {
    display: none; 
    font-size: 1.5em;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

.page-header {
    text-align: center;
    padding: 40px 20px 30px;
}

.page-header h1 {
    font-size: 2.5em;
    color: #2c3e50;
    margin-bottom: 10px;
}

.page-header .subtitle {
    font-size: 1.1em;
    color: #555;
}

.card {
    background-color: #fffaf0;
    border-radius: 15px; 
    box-shadow: 0 4px 8px rgba(139, 90, 43, 0.2); 
    padding: 25px;
    margin-bottom: 30px;
    border: 2px solid #8b5a2b; 
}

.card-title {
    font-size: 1.8em;
    color: #5a3d2a;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
    display: flex;
    align-items: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.form-item {
    margin-bottom: 20px;
}

.label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #34495e;
}

.input, .select {
    width: 100%;
    padding: 12px;
    border: 1px solid #d4b483;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #fffdf6;
}

.input:focus, .select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.input-with-unit {
    display: flex;
}

.input-unit {
    flex-grow: 1;
    border-radius: 6px 0 0 6px;
}

.unit-selector {
    display: flex;
}

.unit-btn {
    background-color: #e9ecef;
    border: 1px solid #ddd;
    padding: 12px 15px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.unit-btn:first-of-type {
    border-left: none;
}

.unit-btn:last-of-type {
    border-radius: 0 6px 6px 0;
}

.unit-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.radio-group label, .checkbox-group label {
    margin-right: 20px;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.radio-group input, .checkbox-group input {
    margin-right: 8px;
}

.button-row {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 15px; 
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    font-weight: bold;
    font-family: "Comic Sans MS", "Marker Felt", "Segoe Print", cursive;
    letter-spacing: 1px;
}

.btn:active {
    transform: translateY(1px);
}

.calculate-btn {
    background-color: #8b5a2b;
    color: white;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
}

.calculate-btn:hover {
    background-color: #7b4a2a;
}

.reset-btn {
    background-color: #8b5a2b; 
    color: white;
}

.reset-btn:hover { 
    background-color: #7b4a2a; 
}

.result-section {
    margin-top: 25px;
    padding: 20px;
    background-color: #e8f4ea; 
    border-left: 5px solid #5a8f5a; 
    border-radius: 15px; 
    display: none; 
}

.result-section.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

.result-title {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
}

.result-value {
    font-size: 2em;
    font-weight: bold;
    color: #5a8f5a;
    margin-bottom: 10px;
}

.result-interpretation {
    font-size: 0.95em;
}

.result-interpretation p { 
    margin-bottom: 5px; 
}

.result-interpretation strong { 
    color: #d9534f; 
}

.collapsible-item {
    margin-bottom: 15px;
}

.collapsible-header {
    background-color: #f8f9fa;
    padding: 12px 15px;
    border: 1px solid #eee;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.collapsible-header:hover {
    background-color: #e9ecef;
}

.collapsible-header .toggle-icon {
    transition: transform 0.3s ease;
    display: inline-block; 
}

.collapsible-content {
    padding: 15px;
    border: 1px solid #eee;
    border-top: none;
    border-radius: 0 0 6px 6px;
    display: none; 
    background-color: #fff;
}

.collapsible-content p, .collapsible-content ul {
    margin-bottom: 10px;
}

.collapsible-content ul {
    margin-left: 20px;
}

.info-text p, .info-text ul {
    margin-bottom: 15px;
}

.info-text h3 {
    font-size: 1.3em;
    color: #34495e;
    margin-top: 20px;
    margin-bottom: 10px;
}

.reference {
    font-size: 0.85em;
    color: #666;
    margin-top: 20px;
}

.reference a {
    color: #007bff;
    text-decoration: none;
}

.reference a:hover {
    text-decoration: underline;
}

footer {
    text-align: center;
    padding: 30px 15px;
    margin-top: 30px;
    border-top: 1px solid #eee;
    font-size: 0.9em;
    color: #777;
}

.language-selector {
    position: relative;
    margin-left: 20px;
    z-index: 1002;
}

.language-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 0.9em;
    min-width: 120px;
    justify-content: space-between;
}

.language-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1001;
    margin-top: 8px;
    min-width: 220px;
    padding: 8px 0;
}

.language-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.language-option {
    padding: 10px 15px;
    cursor: pointer;
    color: #333;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95em;
}

.language-option:hover {
    background-color: #f5f5f5;
    color: #007bff;
}

.language-option.active {
    background-color: #e3f2fd;
    color: #007bff;
    font-weight: 500;
}

.language-code {
    color: #666;
    font-size: 0.85em;
    margin-left: 8px;
    opacity: 0.8;
}

.language-dropdown::-webkit-scrollbar {
    width: 8px;
}

.language-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.language-dropdown::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.language-dropdown::-webkit-scrollbar-thumb:hover {
    background: #555;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 60px; 
        left: 0;
        width: 100%;
        background-color: #5a8f5a; 
        padding: 10px 0;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links li {
        margin: 0;
        width: 100%;
        text-align: center;
    }
    
    .nav-links a {
        display: block;
        padding: 12px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .nav-links li:last-child a {
        border-bottom: none;
    }
    
    .nav-toggle {
        display: block; 
    }

    .page-header h1 {
        font-size: 2em;
    }
    
    .page-header .subtitle {
        font-size: 1em;
    }
    
    .card-title {
        font-size: 1.5em;
    }
    
    .button-row {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }

    .language-selector {
        margin-right: 50px;
    }
    
    .language-dropdown {
        right: -10px;
        max-height: 300px;
    }
}