/* ==========================================================================
   CSS Variables & Theme Setup
   ========================================================================== */
:root {
    /* Color Palette */
    --color-primary: #ff6b6b; /* Vibrant Coral */
    --color-primary-light: #ff8e8e;
    --color-primary-dark: #cc5555;
    
    --color-secondary: #4ecdc4; /* Energetic Teal */
    --color-secondary-light: #7be4dd;
    
    --color-bg-main: #f8f9fa; /* Light Grayish Background */
    --color-bg-card: #ffffff; /* White Cards */
    
    --color-text-main: #2b2d42; /* Dark Navy for High Contrast */
    --color-text-muted: #8d99ae; /* Muted Text */
    
    --color-success: #2ecc71;
    --color-warning: #f1c40f;
    --color-danger: #e74c3c;

    /* Typography */
    --font-family-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Shadows - Multi-layered "Lifted" Effect */
    --shadow-soft: 
        0 2px 4px rgba(43, 45, 66, 0.04), 
        0 4px 8px rgba(43, 45, 66, 0.04), 
        0 16px 24px rgba(43, 45, 66, 0.06);
    --shadow-hover: 
        0 4px 8px rgba(43, 45, 66, 0.06), 
        0 8px 16px rgba(43, 45, 66, 0.08), 
        0 24px 32px rgba(43, 45, 66, 0.1);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 9999px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
}

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

html {
    font-size: 16px;
    /* Soft noise texture overlay using CSS background blend */
    background-color: var(--color-bg-main);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family-main);
    color: var(--color-text-main);
    line-height: 1.5;
    min-height: 100vh;
}

/* ==========================================================================
   Web App Layout (Sidebar + Main Content)
   ========================================================================== */
.web-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background-color: var(--color-bg-card);
    border-right: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    padding: var(--space-xl) var(--space-lg);
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    margin-bottom: var(--space-xl);
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.logo {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.logo-sub {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    flex: 1; /* Pushes footer to bottom */
}

.nav-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--color-text-muted);
    font-size: 1rem;
    font-weight: 500;
    gap: var(--space-sm);
    padding: 12px var(--space-md);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-item .material-icons-round {
    font-size: 1.25rem;
}

.nav-item:hover {
    background-color: var(--color-bg-main);
    color: var(--color-text-main);
}

.nav-item.active {
    background-color: rgba(255, 107, 107, 0.1);
    color: var(--color-primary);
    font-weight: 600;
}

.sidebar-footer {
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-top: var(--space-lg);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 280px; /* Offset for sidebar */
    display: flex;
    flex-direction: column;
}

/* Top Header (Simplified) */
.top-header {
    display: flex;
    justify-content: flex-end; /* Align the date to the right */
    align-items: center;
    padding: var(--space-md) 60px; /* Matched 60px padding */
    background-color: transparent;
}

.header-date {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-bg-card);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.header-date .material-icons-round {
    font-size: 1.1rem;
    color: var(--color-primary);
}

/* Dashboard Grid */
.dashboard-grid {
    padding: var(--space-xl) 60px; /* Increased horizontal padding from 32px to 60px */
    display: flex;
    flex-direction: column;
    gap: 40px; /* Increased gap between sections */
    max-width: 1400px; /* Slightly wider max-width to allow more breathing room */
    margin: 0 auto;
    width: 100%;
}

/* Greeting Section */
.greeting-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--space-md);
}

.greeting-section h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: var(--space-xs);
    color: var(--color-text-main);
}

.greeting-section p {
    color: var(--color-text-muted);
    font-size: 1rem;
}

.primary-button {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    border: none;
    padding: 12px var(--space-lg);
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    transition: all 0.2s ease;
    font-family: inherit;
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 107, 107, 0.4);
}

/* Plan Columns (Diet and Exercise side-by-side on desktop) */
.plan-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
}

/* Section Header Styles inside Cards */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-md);
}

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.section-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.success {
    background-color: rgba(46, 204, 113, 0.15); 
    color: var(--color-success);
}

.status-badge.warning {
    background-color: rgba(241, 196, 15, 0.15); 
    color: #d4ac0d; 
}

/* Add Task Form */
.add-task-form {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px dashed rgba(0,0,0,0.05);
}

.add-task-form.mini {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    flex: 1;
    max-width: 250px;
}

.meal-group {
    margin-bottom: var(--space-lg);
}

.meal-group:last-child {
    margin-bottom: 0;
}

.meal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
    padding-left: var(--space-xs);
}

.meal-header h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-main);
}

.task-input {
    flex: 2;
    border: 1px solid rgba(0,0,0,0.1);
    background-color: var(--color-bg-main);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--color-text-main);
    outline: none;
    transition: border-color 0.2s ease;
}

.add-task-form.mini .task-input {
    padding: 6px 10px;
}

.task-input:focus {
    border-color: var(--color-primary);
}

.task-input.small {
    flex: 1;
}

.add-btn {
    background-color: var(--color-primary);
    color: white;
    border-radius: var(--radius-sm);
}

.add-task-form.mini .add-btn {
    width: 32px;
    height: 32px;
}

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

.add-exercise-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px dashed rgba(0,0,0,0.05);
}

.exercise-type-selector {
    display: flex;
    gap: var(--space-md);
    margin-bottom: 8px;
}

.type-radio {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.type-radio input[type="radio"] {
    accent-color: var(--color-primary);
}

.exercise-input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.exercise-details-inputs {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.exercise-details-inputs .task-input.small {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
}

/* Utility Classes */
.card {
    background-color: var(--color-bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    box-shadow: var(--shadow-soft);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.plan-section .section-header {
    margin-bottom: var(--space-md);
}

.meal-group {
    margin-bottom: var(--space-lg);
}

.add-task-form.mini {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    flex: 1;
    max-width: 250px;
}

.exercise-details-inputs {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

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

/* Responsive adjustments */
@media (max-width: 1024px) {
    .plan-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none; /* Hide sidebar on small screens for this prototype */
    }
    .main-content {
        margin-left: 0;
    }
    .top-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-md);
    }
    .search-bar {
        width: 100%;
    }
    .greeting-section {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }
}
