@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-blur: 15px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 60px 20px;
    /* Added horizontal padding for mobile */
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

body::-webkit-scrollbar {
    width: 8px;
}

body::-webkit-scrollbar-track {
    background: #0f172a;
}

body::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 10px;
}

body::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* Background Blobs */
.bg-blobs {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.blob {
    position: absolute;
    width: 400px;
    height: 400px;
    background: var(--primary-gradient);
    filter: blur(100px);
    border-radius: 50%;
    opacity: 0.2;
    animation: move 15s infinite alternate;
}

.blob-2 {
    right: -5%;
    bottom: -5%;
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    animation-delay: -7s;
}

@keyframes move {
    from {
        transform: translate(-10%, -10%);
    }

    to {
        transform: translate(10%, 10%);
    }
}

/* Calculator Card */
.calculator-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 30px 40px;
    width: 95%;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: scaleIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Unit Toggle Redesign */
.unit-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px;
    border-radius: 16px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    position: relative;
}

.unit-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.unit-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.unit-btn:hover:not(.active) {
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.05);
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    opacity: 0.6;
    margin-top: 5px;
    font-weight: 400;
}

/* Form Styles */
.calculator-body {
    margin-bottom: 30px;
}

.input-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.flex-1 {
    flex: 1;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #94a3b8;
}

.helper-text {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 4px;
}

input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

input[type="number"]:focus {
    border-color: #43e97b;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(67, 233, 123, 0.1);
}

/* Gender Radio Styling */
.gender-selection {
    display: flex;
    gap: 15px;
    height: 100%;
    align-items: center;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #cbd5e1;
    user-select: none;
}

.radio-label input {
    display: none;
}

.custom-radio {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    transition: all 0.3s;
}

.radio-label input:checked+.custom-radio {
    border-color: #26e6a0;
    /* Vibrant green from image */
    background: rgba(38, 230, 160, 0.1);
}

.radio-label input:checked+.custom-radio::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: #26e6a0;
    /* Vibrant green from image */
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Dual Input Styling */
.dual-input {
    display: flex;
    gap: 10px;
}

.split-input,
.single-input {
    flex: 1;
    position: relative;
}

/* Unit Display/Select Styling */
.unit-display {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 2;
}

.input-unit {
    font-size: 0.8rem;
    color: #64748b;
    pointer-events: none;
}

.unit-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: #94a3b8;
    font-size: 1rem;
    padding: 2px 4px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.unit-select:hover {
    background: #94a3b8;
    color: white;
}

.split-input input,
.single-input input {
    padding-right: 85px !important;
    /* Extra room for selects */
}

/* Button Group */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.calculate-btn {
    flex: 2;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: #26e6a0;
    /* Solid vibrant green like image */
    color: #0f172a;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 20px rgba(38, 230, 160, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(38, 230, 160, 0.3);
    filter: brightness(1.1);
}

.btn-icon {
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.1);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.clear-btn {
    flex: 1;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Result Section */
.result-section {
    margin-top: 35px;
    display: none;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.bmi-value-box {
    margin-bottom: 20px;
}

#bmiValue {
    font-size: 3.5rem;
    font-weight: 800;
    display: block;
}

#bmiCategory {
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bmi-meter {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
}

.bmi-progress {
    height: 100%;
    width: 0%;
    background: #43e97b;
    transition: width 1s ease-out;
}

.analysis-box {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    border-left: 4px solid #43e97b;
    text-align: left;
}

.analysis-box p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #cbd5e1;
}

@media (max-width: 480px) {
    .calculator-card {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 1.8rem;
    }
}