/* Base Styles and Variables */
:root {
    --dark-blue: #222831;
    --dark-gray: #393E46;
    --teal: #00ADB5;
    --light-gray: #EEEEEE;
    --yellow: #FFD369;
    --error: #ff6b6b;
    --success: #51cf66;
    --warning: #fcc419;
    --font-family: 'Poppins', sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--light-gray);
    color: var(--dark-blue);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4 {
    margin-bottom: 0.5em;
    color: var(--dark-blue);
    font-weight: 600;
}

h1 {
    font-size: 2.2rem;
    text-align: center;
    color: var(--teal);
}

h2 {
    font-size: 1.8rem;
}

h3 {
    font-size: 1.4rem;
    color: var(--dark-gray);
}

p {
    margin-bottom: 1em;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
}

header p {
    color: var(--dark-gray);
    font-size: 1.1rem;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
}

/* Cards and Containers */
.calculator-card, .results-card, .history-card {
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: var(--transition);
}

.calculator-card {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.illustration {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.health-icon {
    width: 100px;
    height: 100px;
    background-color: var(--teal);
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.health-icon::before {
    content: "❤";
    font-size: 50px;
    color: white;
}

/* Form Styles */
.form-container {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: 500;
    color: var(--dark-gray);
}

input[type="text"],
input[type="number"] {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

input[type="text"]:focus,
input[type="number"]:focus {
    border-color: var(--teal);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 173, 181, 0.2);
}

.radio-group {
    display: flex;
    gap: 1.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 0.5rem;
}

.radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--dark-gray);
    display: inline-block;
    position: relative;
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--teal);
}

.error-message {
    color: var(--error);
    font-size: 0.85rem;
    height: 1.2rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background-color: var(--teal);
    color: white;
}

.btn-primary:hover {
    background-color: #008e95;
}

.btn-secondary {
    background-color: var(--light-gray);
    color: var(--dark-gray);
}

.btn-secondary:hover {
    background-color: #ddd;
}

/* Results Section */
.results-container, .history-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hidden {
    display: none;
}

.result-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.result-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.result-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--teal);
    margin: 0.5rem 0;
}

.result-interpretation {
    font-size: 1.1rem;
    color: var(--dark-gray);
    margin-bottom: 1rem;
}

/* BMI Scale */
.bmi-scale {
    display: flex;
    justify-content: space-between;
    margin: 1rem 0;
    position: relative;
    height: 30px;
}

.scale-item {
    flex: 1;
    text-align: center;
    font-size: 0.85rem;
    padding: 5px;
    position: relative;
}

.scale-item[data-category="underweight"] {
    background-color: var(--warning);
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
}

.scale-item[data-category="normal"] {
    background-color: var(--success);
}

.scale-item[data-category="overweight"] {
    background-color: var(--warning);
}

.scale-item[data-category="obese"] {
    background-color: var(--error);
    border-top-right-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.bmi-marker {
    width: 20px;
    height: 20px;
    background-color: var(--dark-blue);
    border-radius: 50%;
    position: absolute;
    top: -10px;
    transform: translateX(-50%);
    z-index: 2;
    transition: left 0.5s ease;
}

/* Caloric Suggestions */
.caloric-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.caloric-item {
    flex: 1;
    min-width: 150px;
    background-color: var(--light-gray);
    padding: 1rem;
    border-radius: var(--border-radius);
    text-align: center;
}

.caloric-title {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.caloric-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--teal);
}

.result-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
}

/* History Section */
.history-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--teal);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: var(--box-shadow);
    z-index: 10;
    transition: var(--transition);
}

.history-toggle-btn:hover {
    background-color: #008e95;
    transform: scale(1.05);
}

.history-icon {
    font-size: 24px;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 1rem 0;
}

.history-item {
    background-color: var(--light-gray);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-item-name {
    font-weight: 600;
}

.history-item-date {
    font-size: 0.85rem;
    color: var(--dark-gray);
}

.history-item-details {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.history-detail {
    flex: 1;
    min-width: 120px;
}

.history-detail-label {
    font-size: 0.85rem;
    color: var(--dark-gray);
}

.history-detail-value {
    font-weight: 500;
}

.history-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

/* Footer */
.footer {
    background-color: var(--dark-blue);
    color: var(--light-gray);
    padding: 1.5rem 0;
    margin-top: 2rem;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer a {
    color: var(--teal);
    text-decoration: none;
    transition: var(--transition);
}

.footer a:hover {
    color: var(--yellow);
    text-decoration: underline;
}

/* Responsive Styles */
@media (min-width: 768px) {
    .calculator-card {
        flex-direction: row;
        align-items: center;
    }
    
    .illustration {
        flex: 1;
        margin-bottom: 0;
    }
    
    .form-container {
        flex: 2;
    }
    
    .caloric-suggestions {
        flex-wrap: nowrap;
    }
}

@media (max-width: 767px) {
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .calculator-card, .results-card, .history-card {
        padding: 1.5rem;
    }
    
    .form-actions, .result-actions, .history-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .history-toggle-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calculator-card, .results-card, .history-card {
    animation: fadeIn 0.5s ease forwards;
}
