@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,600;0,700;1,500&display=swap');

:root {
    --primary: #0F5132;
    --primary-light: #198754;
    --primary-rgb: 15, 81, 50;
    --accent: #E5A93B;
    --accent-light: #F4C430;
    --background: #FAF8F5;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(15, 81, 50, 0.08);
    --text-main: #2C3E35;
    --text-muted: #5A6E63;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 25px -5px rgba(15, 81, 50, 0.1);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary: #1EA665;
    --primary-light: #2ECC71;
    --primary-rgb: 30, 166, 101;
    --accent: #F4C430;
    --accent-light: #FFE066;
    --background: #0B130F;
    --card-bg: rgba(18, 30, 24, 0.85);
    --card-border: rgba(30, 166, 101, 0.15);
    --text-main: #ECF0F1;
    --text-muted: #9EAEA5;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    background-image: 
        radial-gradient(at 0% 0%, rgba(var(--primary-rgb), 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(var(--primary-rgb), 0.03) 0px, transparent 50%);
    background-attachment: fixed;
    transition: background-color 0.5s ease;
    overflow-x: hidden;
    padding-bottom: 5rem;
}

/* Header & Navbar */
header {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.logo-text h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
}

.logo-text p {
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
}

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--primary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.theme-toggle:hover {
    transform: rotate(15deg) scale(1.05);
    border-color: var(--accent);
    color: var(--accent);
}

/* App Layout & Main */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    position: relative;
    min-height: calc(100vh - 250px);
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 3.5rem;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.8rem;
    color: var(--text-main);
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.hero h2 span {
    color: var(--primary);
    border-bottom: 3px double var(--accent);
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    font-weight: 300;
}

/* Forms & Cards Styling */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    transition: var(--transition);
}

.input-container {
    max-width: 800px;
    margin: 0 auto;
    animation: slideUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .hero h2 {
        font-size: 2.2rem;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

label span.unit {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

input[type="number"], select {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--card-border);
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
    outline: none;
}

[data-theme="dark"] input[type="number"], 
[data-theme="dark"] select {
    background: rgba(18, 30, 24, 0.4);
}

input[type="number"]:focus, select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15);
    background: var(--card-bg);
}

/* Radio buttons styled as chips */
.chip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.75rem;
}

.chip-label {
    position: relative;
    cursor: pointer;
}

.chip-label input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.chip-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 0.5rem;
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.4);
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
    transition: var(--transition);
    color: var(--text-muted);
    min-height: 52px;
}

[data-theme="dark"] .chip-content {
    background: rgba(18, 30, 24, 0.4);
}

.chip-label input:checked + .chip-content {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.chip-label input:checked + .chip-content .sub-text {
    color: rgba(255,255,255,0.8);
}

.chip-content .sub-text {
    font-size: 0.75rem;
    font-weight: 400;
    margin-top: 0.2rem;
    color: var(--text-muted);
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #ffffff;
    border: none;
    padding: 1.1rem 2.5rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px -6px rgba(var(--primary-rgb), 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: var(--transition);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.5s ease-out;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -6px rgba(var(--primary-rgb), 0.5);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:hover::after {
    transform: translate(-50%, -50%) scale(1);
}

/* Output Dashboard (Hidden by default) */
.results-container {
    display: none; /* Controlled by JS */
    max-width: 1100px;
    margin: 0 auto;
    animation: fadeIn 0.8s ease-out;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-title h3 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--primary);
}

.results-title p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.results-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-secondary {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

/* Summary Cards Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

@media (max-width: 992px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
}

.summary-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-light);
}

.summary-card.accent::before {
    background: var(--accent);
}

.summary-card-icon {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.summary-card-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.summary-card-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
}

.summary-card-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Diet Schedule Section */
.diet-section {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (max-width: 900px) {
    .diet-section {
        grid-template-columns: 1fr;
    }
}

/* Weekday Selector Sidebar */
.weekdays-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (max-width: 900px) {
    .weekdays-list {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--card-border);
    }
}

.day-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    width: 100%;
}

@media (max-width: 900px) {
    .day-btn {
        width: auto;
        white-space: nowrap;
        padding: 0.75rem 1.25rem;
    }
    .day-btn span.day-target {
        display: none; /* Hide target details on small tabs */
    }
}

.day-btn:hover {
    border-color: var(--primary-light);
    transform: translateX(4px);
}

@media (max-width: 900px) {
    .day-btn:hover {
        transform: translateY(-2px);
    }
}

.day-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-md);
}

.day-btn span.day-name {
    font-size: 1rem;
}

.day-btn span.day-target {
    font-size: 0.75rem;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-weight: 500;
}

.day-btn.active span.day-target {
    background: rgba(255,255,255,0.2);
    color: #ffffff;
}

/* Daily Schedule Detail Board */
.day-details-board {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    min-height: 400px;
    animation: fadeIn 0.4s ease-out;
}

.day-details-header {
    border-bottom: 2px solid var(--card-border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.day-details-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--primary);
}

.day-details-macros {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.day-details-macros span strong {
    color: var(--text-main);
}

/* Meal Grid inside Day Detail */
.meals-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.meal-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    border-bottom: 1px dashed var(--card-border);
    padding-bottom: 1.25rem;
}

.meal-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

@media (max-width: 600px) {
    .meal-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

.meal-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.meal-time-icon {
    font-size: 1.25rem;
}

.meal-content {
    background: rgba(var(--primary-rgb), 0.02);
    border: 1px solid rgba(var(--primary-rgb), 0.05);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: var(--transition);
}

.meal-content:hover {
    background: rgba(var(--primary-rgb), 0.04);
    border-color: rgba(var(--primary-rgb), 0.1);
    transform: translateY(-2px);
}

.meal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.meal-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.meal-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.meal-nutrition-chips {
    display: flex;
    gap: 0.5rem;
}

.nutri-chip {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: rgba(0,0,0,0.05);
    color: var(--text-muted);
}

[data-theme="dark"] .nutri-chip {
    background: rgba(255,255,255,0.08);
}

.nutri-chip.protein {
    background: rgba(46, 204, 113, 0.15);
    color: #27ae60;
}
.nutri-chip.carbs {
    background: rgba(52, 152, 219, 0.15);
    color: #2980b9;
}
.nutri-chip.fat {
    background: rgba(230, 126, 34, 0.15);
    color: #d35400;
}

.meal-portion {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(229, 169, 59, 0.1);
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
}

/* Water Intake tracker card widget */
.water-tracker-widget {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.water-info {
    flex: 1;
    min-width: 250px;
}

.water-info h4 {
    font-size: 1.25rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.water-info p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.water-grid-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.water-glasses {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
}

@media (max-width: 480px) {
    .water-glasses {
        grid-template-columns: repeat(4, 1fr);
    }
}

.glass-item {
    font-size: 1.8rem;
    cursor: pointer;
    filter: grayscale(100%) opacity(30%);
    transition: var(--transition);
}

.glass-item.active {
    filter: none;
    transform: scale(1.15);
}

.glass-item:hover {
    transform: scale(1.2);
}

/* Tips / FAQ Section */
.tips-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin-top: 3rem;
}

.tips-section h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .tips-grid {
        grid-template-columns: 1fr;
    }
}

.tip-card {
    display: flex;
    gap: 1rem;
}

.tip-icon {
    font-size: 1.5rem;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tip-content h5 {
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
    color: var(--text-main);
    font-weight: 700;
}

.tip-content p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Footer styling */
footer {
    text-align: center;
    margin-top: 5rem;
    padding: 2rem;
    border-top: 1px solid var(--card-border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

footer a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

/* Print Styles */
@media print {
    body {
        background: #ffffff;
        color: #000000;
        font-size: 12pt;
    }
    .input-container, .theme-toggle, .results-actions, footer, .water-glasses, .tips-section {
        display: none !important;
    }
    .results-container {
        display: block !important;
    }
    .glass-card, .day-details-board, .meal-content {
        background: none !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
    }
    .day-btn {
        display: none !important;
    }
    .diet-section {
        display: block !important;
    }
    /* Expand all days in print */
    .day-details-board {
        page-break-after: always;
        margin-bottom: 2cm;
    }
}

/* Grocery List Section */
.grocery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .grocery-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.grocery-category {
    background: rgba(var(--primary-rgb), 0.02);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.grocery-category h5 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1.5px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.grocery-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.grocery-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-main);
    user-select: none;
}

.grocery-item input[type="checkbox"] {
    margin-top: 0.25rem;
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.grocery-item input[type="checkbox"]:checked + span {
    text-decoration: line-through;
    color: var(--text-muted);
    opacity: 0.6;
}
