/* --- Core Variables & Base Styles --- */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --card-bg-color: #ffffff;
    --text-color: #212529;
    --label-color: #495057;
    --body-bg-color: #f4f7f6;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--body-bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.card {
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
}

/* --- Page Header --- */
.page-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1.1rem;
    color: var(--label-color);
    max-width: 700px;
    margin: 0 auto;
}

.last-updated {
    font-size: 0.9rem;
    color: var(--label-color);
    margin-top: 0.5rem;
    font-style: italic;
}

/* --- Main Layout --- */
.main-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
}

.calculator-column, .content-column {
    flex: 1;
    min-width: 300px;
}

/* --- Calculator Form Styles --- */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

/* Custom Radio Button Styles */
.radio-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.radio-label {
    display: inline-block;
    position: relative;
    cursor: pointer;
}
.radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.radio-custom {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--light-gray);
    transition: all 0.3s ease;
    font-weight: 600;
}
.radio-label input[type="radio"]:checked + .radio-custom {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(0,123,255,0.2);
}
.radio-label input[type="radio"]:focus + .radio-custom {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.input-wrapper .icon {
    padding: 0 12px;
    background-color: var(--light-gray);
    align-self: stretch;
    display: flex;
    align-items: center;
    border-right: 1px solid var(--border-color);
    color: var(--label-color);
}

.input-wrapper input[type="number"] {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px;
    width: 100%;
    background-color: var(--card-bg-color);
    color: var(--text-color);
    font-size: 1rem;
}

.input-wrapper input[type="number"]::-webkit-outer-spin-button,
.input-wrapper input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-wrapper input[type="number"] {
    -moz-appearance: textfield;
}

.stepper-buttons {
    display: flex;
}

.stepper-buttons button {
    border: none;
    background: transparent;
    border-left: 1px solid var(--border-color);
    padding: 8px 12px;
    cursor: pointer;
    color: var(--label-color);
    transition: background-color 0.2s;
}

.stepper-buttons button:hover {
    background-color: var(--light-gray);
}

.slider-group {
    margin-top: 0.75rem;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: var(--light-gray);
    border-radius: 5px;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
}

input[type="range"]:hover {
    opacity: 1;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid white;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid white;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.info-note {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--label-color);
    background-color: var(--light-gray);
    padding: 0.5rem 1rem;
    border-radius: 6px;
}
.info-note i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}
.info-note.error-container {
    background-color: #ffefef;
    color: #d90429;
    margin-top: 1.5rem;
    font-weight: 600;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}
.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}
.btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,123,255,0.2);
}
.btn-secondary, .btn-reset {
    background-color: var(--light-gray);
    color: var(--text-color);
    border-color: var(--border-color);
}
.btn-secondary:hover, .btn-reset:hover {
    background-color: #e2e6ea;
    border-color: #dae0e5;
}

/* Styles for Custom Select Dropdown */
.custom-select {
    width: 100%;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 11px 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: var(--card-bg-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    background-size: 16px 12px;
    cursor: pointer;
}
.custom-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

/* Styles for Custom Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* --- Results Section --- */
.results-card h2, .info-section h2 {
    font-size: 1.5rem;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}
.info-section h2 .icon, .results-card h2 .icon {
    color: var(--primary-color);
    margin-right: 0.75rem;
}

.edit-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-edit {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
    white-space: nowrap;
}
.btn-edit:hover {
    background-color: var(--light-gray);
    border-color: var(--primary-color);
}
.btn-edit i {
    margin-right: 0.4rem;
}

.results-tabs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--label-color);
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    transition: color 0.3s, border-color 0.3s;
}
.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.5s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.result-item {
    background-color: var(--light-gray);
    padding: 1.25rem;
    border-radius: 8px;
}
.result-item p {
    margin: 0 0 0.5rem 0;
    color: var(--label-color);
    font-weight: 600;
}
.result-item .value {
    font-weight: 700;
    font-size: 1.5rem;
    word-break: break-all;
    color: var(--primary-color);
}
.result-item .value-block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.copy-btn {
    background: none;
    border: none;
    color: var(--label-color);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
}
.copy-btn:hover {
    color: var(--primary-color);
    background-color: #e9ecef;
}

.chart-container {
    max-width: 350px;
    min-height: 350px; 
    margin: 0 auto;
    position: relative;
}

/* --- Info & FAQ Sections --- */
.info-section .feature-list {
    list-style: none;
    padding-left: 0;
}
.info-section .feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}
.info-section .feature-list .feature-icon {
    color: var(--success-color);
    font-size: 1.2rem;
    margin-top: 0.25rem;
}

.formula-box {
    margin-top: 1rem;
    padding: 1.5rem;
    background-color: var(--light-gray);
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--primary-color);
    border-radius: 8px;
    font-size: 1.1rem;
    text-align: center;
    font-family: monospace;
}

.faq-item {
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1rem;
    transition: background-color 0.3s;
    overflow: hidden;
}
.faq-item[open] {
    background-color: #fff;
}
.faq-item summary {
    font-weight: 600;
    padding: 1rem 1.25rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease-out;
}
.faq-item summary:hover {
    background-color: var(--light-gray);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    transition: transform 0.3s ease-in-out;
    color: var(--primary-color);
}
.faq-item[open] > summary {
    border-bottom: 1px solid var(--border-color);
}
.faq-item[open] summary::after {
    transform: rotate(180deg);
}
.faq-item div {
    padding: 1.25rem;
    line-height: 1.8;
}

/* --- Language Switcher --- */
.section-lang-switcher {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}
.section-lang-switcher .lang-btn {
    background-color: var(--light-gray);
    border: 1px solid var(--border-color);
    color: var(--label-color);
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}
.section-lang-switcher .lang-btn:first-child { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.section-lang-switcher .lang-btn:last-child { border-top-right-radius: 6px; border-bottom-right-radius: 6px; border-left: none; }
.section-lang-switcher .lang-btn.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
.card > .section-lang-switcher { margin-top: -0.5rem; }

/* --- Floating Language Switcher --- */
.floating-lang-switcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border-radius: 8px;
    overflow: hidden;
}
.floating-lang-switcher .lang-btn {
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    color: var(--label-color);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}
.floating-lang-switcher .lang-btn:last-child { border-left: none; }
.floating-lang-switcher .lang-btn.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* --- Notification / Toast --- */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background-color: var(--success-color);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    animation: slideIn 0.3s ease-out, fadeOut 0.3s ease-in 2.7s;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* --- Responsive Design --- */
@media (min-width: 992px) {
    .main-container { flex-wrap: nowrap; }
    .calculator-column {
        position: sticky;
        top: 2rem;
        align-self: flex-start;
    }
}
@media (max-width: 768px) {
    .container { padding-left: 0; padding-right: 0; }
    .card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: 0 5px 15px rgba(0,0,0,0.02);
        padding: 1.5rem 1rem;
    }
    .results-card { padding-left: 1rem; padding-right: 1rem; }
    .result-item .value { font-size: 1.2rem; }
    .page-header h1 { font-size: 2rem; }
}
