/* ===== CSS Variables ===== */
:root {
    --primary-color: #10b981;
    --secondary-color: #3b82f6;
    --accent-color: #06b6d4;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #ffffff;
    --bg-gray: #f9fafb;
    --bg-dark: #111827;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Dark Mode Variables */
body.dark-mode {
    --text-dark: #f9fafb;
    --text-light: #d1d5db;
    --bg-light: #1f2937;
    --bg-gray: #111827;
    --bg-dark: #0f172a;
    --border-color: #374151;
}

/* ===== Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-gray);
    transition: var(--transition);
}

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

/* ===== Header & Navigation ===== */
#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-light);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    transition: var(--transition);
}

#header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.logo-icon {
    font-size: 2rem;
}

#navbar ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: var(--transition);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.dark-mode-toggle {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
}

body:not(.dark-mode) .moon-icon {
    display: none;
}

body.dark-mode .sun-icon {
    display: none;
}

/* ===== Hero Section ===== */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%23ffffff" fill-opacity="0.1" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,138.7C960,139,1056,117,1152,101.3C1248,85,1344,75,1392,69.3L1440,64L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
}

.hero-content {
    text-align: center;
    color: white;
    z-index: 1;
    padding: 2rem;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    animation: fadeIn 1s ease-out;
}

.hero-subtitle {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    opacity: 0.95;
    animation: fadeIn 1s ease-out 0.3s both;
}

.scroll-down-btn {
    display: inline-block;
    margin-top: 2rem;
    color: white;
    text-decoration: none;
    animation: bounce 2s infinite;
}

.arrow-down {
    font-size: 3rem;
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

/* ===== Section Styles ===== */
section {
    padding: 5rem 0;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.section-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

/* ===== Calculator Section ===== */
.calculator-section {
    background-color: var(--bg-light);
}

.calculator-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.calculator-form {
    background-color: var(--bg-gray);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    background-color: var(--bg-light);
    color: var(--text-dark);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

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

.btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background-color: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--text-light);
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
    transform: translateY(-2px);
}

/* ===== Results Card ===== */
.results-card {
    background-color: var(--bg-gray);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
    animation: slideIn 0.5s ease-out;
}

.results-card.hidden {
    display: none;
}

.results-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    text-align: center;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.result-item {
    background-color: var(--bg-light);
    padding: 1.5rem;
    border-radius: 0.75rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.result-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.result-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.result-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.result-unit,
.result-category {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ===== Macros Section ===== */
.macros-section {
    background-color: var(--bg-light);
    padding: 2rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
}

.macros-section h4 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    text-align: center;
}

.macros-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

.macros-chart {
    max-width: 300px;
    margin: 0 auto;
}

.macros-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.macro-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--bg-gray);
    border-radius: 0.5rem;
}

.macro-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.protein-color {
    background-color: #ef4444;
}

.carbs-color {
    background-color: #3b82f6;
}

.fat-color {
    background-color: #f59e0b;
}

.macro-label {
    flex: 1;
    font-weight: 600;
    color: var(--text-dark);
}

.macro-value {
    font-weight: bold;
    color: var(--primary-color);
}

.results-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Article Section ===== */
.article-section {
    background-color: var(--bg-gray);
}

.article-content {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-light);
    padding: 3rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    line-height: 1.8;
}

.article-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.article-content h3 {
    font-size: 2rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.article-content h4 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--secondary-color);
}

.article-content p {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    text-align: justify;
}

.article-content strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* ===== FAQ Section ===== */
.faq-section {
    background-color: var(--bg-light);
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background-color: var(--bg-gray);
    margin-bottom: 1rem;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.faq-item:hover {
    box-shadow: var(--shadow-lg);
}

.faq-question {
    width: 100%;
    padding: 1.5rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq-question:hover {
    color: var(--primary-color);
}

.faq-icon {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-answer p {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* ===== About Section ===== */
.about-section {
    background-color: var(--bg-gray);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-light);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
}

.about-content p {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    line-height: 1.8;
    text-align: justify;
}

/* ===== Contact Section ===== */
.contact-section {
    background-color: var(--bg-light);
}

.contact-form {
    max-width: 600px;
    margin: 0 auto;
    background-color: var(--bg-gray);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
}

/* ===== Footer ===== */
.footer {
    background-color: var(--bg-dark);
    color: white;
    text-align: center;
    padding: 2rem 0;
}

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

.footer a:hover {
    color: var(--accent-color);
}

/* ===== Back to Top Button ===== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: #059669;
    transform: translateY(-5px);
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    #navbar ul {
        display: none;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .macros-content {
        grid-template-columns: 1fr;
    }

    .article-content {
        padding: 1.5rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .results-grid {
        grid-template-columns: 1fr 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .results-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.5rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Utility Classes ===== */
.fade-in {
    animation: fadeIn 1s ease-out;
}

.fade-in-delay {
    animation: fadeIn 1s ease-out 0.3s both;
}

.hidden {
    display: none;
}

/* ===== Charts Grid ===== */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.chart-card {
    background-color: var(--bg-light);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.chart-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.chart-card h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    text-align: center;
}

.chart-card canvas {
    max-height: 250px;
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Tool Guide Section ===== */
.tool-guide-section {
    background-color: var(--bg-light);
}

.tool-guide-content {
    max-width: 900px;
    margin: 3rem auto 0;
    background-color: var(--bg-gray);
    padding: 3rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    line-height: 1.8;
}

.tool-guide-content h3 {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    text-align: center;
}

.tool-guide-content h4 {
    font-size: 1.6rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.tool-guide-content p {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    text-align: justify;
}

.tool-guide-content strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* ===== Statistics Visualization ===== */
.stats-visualization {
    background-color: var(--bg-gray);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.subsection-title {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-dark);
}

.charts-showcase {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.chart-showcase-item {
    background-color: var(--bg-light);
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.chart-showcase-item:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-5px);
}

.chart-showcase-item h4 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    text-align: center;
}

.chart-showcase-item canvas {
    max-height: 300px;
    margin-bottom: 1rem;
}

.chart-description {
    font-size: 0.95rem;
    color: var(--text-light);
    text-align: center;
    line-height: 1.5;
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .charts-showcase {
        grid-template-columns: 1fr;
    }

    .tool-guide-content {
        padding: 1.5rem;
    }

    .tool-guide-content h3 {
        font-size: 1.8rem;
    }

    .tool-guide-content h4 {
        font-size: 1.3rem;
    }
}
