:root {
    --bg-page: #0f172a;
    /* Deep Dark Blue */
    --bg-card: #1e293b;
    /* Lighter Dark Blue */
    --bg-input: #334155;
    /* Input Background */
    --primary: #f59e0b;
    /* Golden Yellow */
    --primary-hover: #d97706;
    --text-main: #f8fafc;
    /* White-ish */
    --text-sec: #94a3b8;
    /* Light Grey */
    --border: #475569;
    /* Dark Grey Border */
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans Lao', 'Inter', sans-serif;
}

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.page-container {
    width: 100%;
    max-width: 900px;
}

.calculator-wrapper {
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 40px;
    border: 1px solid var(--border);
}

/* Header */
/* Header */
.calc-header {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    /* Stack Brand and Subtitle */
    align-items: center;
    /* Center everything */
    gap: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 25px;
    text-align: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-circle {
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: #fff;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.brand h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
    line-height: 1;
}

/* Subtitle (p tag inside header) */
.calc-header .subtitle {
    color: var(--text-sec);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.calc-header .credit {
    color: var(--primary);
    /* Incorporate brand color or just stick to text-sec */
    font-size: 0.85rem;
    font-weight: 400;
    opacity: 0.7;
    margin-bottom: 15px;
    /* Space before button */
    font-style: italic;
}

.contact-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 10px;
}

/* WhatsApp Button */
.whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #25d366;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    /* margin-top: 15px; Removed, handled by parent */
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.2);
}

.whatsapp-btn:hover {
    background: #128c7e;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(37, 211, 102, 0.3);
}

.whatsapp-btn i {
    font-size: 1.1rem;
}

/* Mode Switcher */
.mode-switcher {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.mode-btn {
    flex: 1;
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-sec);
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.mode-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.action-btn {
    flex: 1;
    background: transparent;
    border: 2px solid var(--border);
    /* Match border */
    color: var(--text-sec);
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.action-btn:hover {
    border-color: #ef4444;
    /* Red */
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Form Fields */
.calc-body {
    display: none;
    animation: fadeIn 0.4s ease;
}

.calc-body.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-group.full {
    grid-column: span 2;
}

.field-group label {
    color: var(--primary);
    /* Gold labels as per reference */
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-left: 3px solid var(--primary);
    padding-left: 8px;
}

.input-box,
.select-box {
    position: relative;
    display: flex;
    align-items: center;
}

.input-box input,
.select-box select {
    width: 100%;
    padding: 14px 16px;
    font-size: 1.1rem;
    background: var(--bg-page);
    /* Darker background for inputs */
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s;
}

.input-box input:focus,
.select-box select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
}

.input-box .prefix,
.input-box .unit {
    position: absolute;
    color: var(--primary);
    font-weight: 700;
}

.input-box .prefix {
    left: 16px;
}

.input-box .unit {
    right: 16px;
}

.input-box:has(.prefix) input {
    padding-left: 35px;
}

.input-box:has(.unit) input {
    padding-right: 45px;
}

/* Space for unit */

/* Remove Spinners & Clearer Select */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.select-box i {
    position: absolute;
    right: 16px;
    color: var(--primary);
    pointer-events: none;
}

/* Results Section */
.results-area {
    background: var(--bg-page);
    border-radius: 16px;
    padding: 30px;
    border: 1px solid var(--border);
}

.results-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    color: var(--text-main);
    font-size: 1.2rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
}

.results-header i {
    color: var(--primary);
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px dashed var(--border);
}

.result-row:last-child {
    border-bottom: none;
}

.divider-dashed {
    height: 1px;
    border-bottom: 2px dashed var(--border);
    margin: 15px 0;
    opacity: 0.5;
}

.result-row.highlight-cost {
    background: rgba(245, 158, 11, 0.1);
    padding: 8px 15px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.result-row.highlight-cost strong {
    color: var(--primary);
    font-size: 1.3rem;
}

.result-row span:first-child {
    color: var(--text-sec);
    font-size: 1rem;
}

.result-row strong {
    color: var(--text-main);
    font-size: 1.2rem;
    font-weight: 700;
}

.result-row.highlight strong {
    color: var(--primary);
}

/* Total Card */
.total-card-dark {
    margin-top: 20px;
    background: var(--bg-input);
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
}

.total-card-dark span {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.total-card-dark strong {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 800;
}

/* Responsive */
@media (max-width: 768px) {
    .input-grid {
        grid-template-columns: 1fr;
    }

    .field-group.full {
        grid-column: span 1;
    }

    .calculator-wrapper {
        padding: 20px;
    }

    /* Mobile Header Optimization */
    .brand {
        flex-direction: column;
        /* Logo heavily on top */
        gap: 10px;
        text-align: center;
    }

    .brand h1 {
        font-size: 1.6rem;
        /* Increase from 1.4, still use nowrap but may scroll or fit better */
        white-space: nowrap;
        margin: 0;
    }

    .logo-circle {
        margin-bottom: 5px;
        width: 48px;
        /* Restore closer to desktop size */
        height: 48px;
        font-size: 1.4rem;
    }

    /* Results Header Optimization */
    .results-header {
        flex-direction: column;
        text-align: center;
        gap: 5px;
        font-size: 1.2rem;
        /* Bump up */
    }

    /* Increase Mobile Readability */
    .field-group label {
        font-size: 1.1rem;
        /* Increase */
    }

    .input-box input,
    .select-box select {
        font-size: 1.3rem;
        /* Increase */
        padding: 16px;
    }

    /* Bigger Buttons on Mobile - Adjusted Padding */
    .mode-btn,
    .action-btn {
        font-size: 0.95rem;
        /* Sligthly smaller to fit */
        padding: 10px 4px;
        /* Reduced horizontal padding */
        white-space: nowrap;
        /* Force 1 line */
    }

    .reset-btn {
        font-size: 1rem;
        padding: 12px;
    }

    .result-row span:first-child {
        font-size: 1.1rem;
    }

    .result-row strong {
        font-size: 1.4rem;
        /* Increase */
    }
}

/* Actions */
.actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.reset-btn {
    background: transparent;
    border: 1px solid var(--text-sec);
    color: var(--text-sec);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.reset-btn:hover {
    border-color: #ef4444;
    /* Red */
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}