:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #10b981; /* Emerald */
    --accent-hover: #059669;
    --secondary: #6366f1; /* Indigo */
    --warning: #f59e0b; /* Amber */
    --danger: #ef4444; /* Red */
    --glass-blur: blur(12px);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 3rem;
    padding-left: 0.5rem;
}

.logo i {
    width: 28px;
    height: 28px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-links li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-links li:hover, .nav-links li.active {
    background: var(--card-bg);
    color: var(--text-primary);
    transform: translateX(5px);
}

.nav-links li.active {
    border-left: 4px solid var(--accent);
    background: rgba(16, 233, 129, 0.05);
}

.nav-links li i {
    width: 20px;
    height: 20px;
}

.user-profile {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--card-border);
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info .name {
    display: block;
    font-weight: 600;
}

.user-info .plan {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Main Content Styling */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem 3rem;
    max-width: calc(100vw - 260px);
}

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

.content-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: 'Space Grotesk', sans-serif;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--accent);
    color: #0f172a;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
}

.btn-outline:hover {
    background: rgba(16, 185, 129, 0.1);
}

.btn-outline.active {
    background: var(--accent);
    color: #0f172a;
}

.btn-text {
    background: transparent;
    color: var(--accent);
    padding: 0.5rem 0;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--danger);
}

/* Cards & Glassmorphism */
.glass {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 1.5rem;
    transition: var(--transition);
}

.glass:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    font-family: 'Space Grotesk', sans-serif;
}

/* Fasting Widget */
.fasting-widget {
    text-align: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-color: rgba(99, 102, 241, 0.2);
}

.timer-display {
    font-size: 3rem;
    font-weight: 800;
    margin: 1.5rem 0;
    font-family: 'Space Grotesk', sans-serif;
    background: linear-gradient(to right, #6366f1, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.timer-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.fasting-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Lists */
.item-list {
    list-style: none;
}

.item-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--card-border);
}

.status-urgent { color: var(--danger); font-weight: 600; }
.status-warning { color: var(--warning); font-weight: 600; }

/* Table Styling */
.table-card {
    overflow-x: auto;
    padding: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Recipe Cards */
.recipe-cards, .recipe-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recipe-suggestion-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.tag {
    align-self: flex-start;
    padding: 0.25rem 0.75rem;
    background: rgba(99, 102, 241, 0.2);
    color: var(--secondary);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Checklist */
.checklist {
    list-style: none;
}

.checklist li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--card-border);
}

.checklist input[type="checkbox"] {
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
}

/* Days Selector */
.days-selector {
    display: flex;
    gap: 0.5rem;
}

.day-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.day-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.day-btn.active {
    background: var(--accent);
    color: #0f172a;
    border-color: var(--accent);
}

/* Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--card-border);
}

.timeline-item {
    display: flex;
    gap: 2rem;
    align-items: center;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -29px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--secondary);
    border: 4px solid #0f172a;
}

.timeline-date {
    min-width: 100px;
    font-weight: 600;
    font-size: 0.9rem;
}

.timeline-content {
    flex: 1;
    padding: 1rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 1;
    transition: var(--transition);
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    padding: 2.5rem;
}

.modal-content h2 {
    margin-bottom: 2rem;
    font-family: 'Space Grotesk', sans-serif;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
}

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

/* Helper Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 2rem 0.5rem;
    }
    .logo span, .nav-links li span, .user-info {
        display: none;
    }
    .main-content {
        margin-left: 80px;
        max-width: calc(100vw - 80px);
        padding: 2rem;
    }
    .logo {
        justify-content: center;
        padding-left: 0;
    }
    .nav-links li {
        justify-content: center;
    }
}

/* Profile Tab Styles */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.tag-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag-btn {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.tag-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tag-btn.active {
    background: var(--accent);
    color: #0f172a;
    border-color: var(--accent);
}

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

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
}

.result-box {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
}

/* Meal Planner Styles */
.meal-planner-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.day-column {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--card-border);
}

.day-column h4 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

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

.meal-slot {
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px dashed var(--card-border);
}

.meal-slot:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
}

.meal-slot.filled {
    border-style: solid;
    border-color: var(--secondary);
    background: rgba(99, 102, 241, 0.1);
}

/* Allergy Alert Styles */
.status-risk {
    color: var(--danger);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.risk-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.risk-bar-fill {
    height: 100%;
    background: var(--danger);
    transition: width 0.5s ease;
}

/* Mobile Friendly Styles */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        left: 0;
        top: auto;
        border-right: none;
        border-top: 1px solid var(--card-border);
        padding: 0.5rem;
        flex-direction: row;
        justify-content: space-around;
        background: rgba(15, 23, 42, 0.9);
        backdrop-filter: var(--glass-blur);
    }

    .logo {
        display: none;
    }

    .nav-links {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        gap: 0;
    }

    .nav-links li {
        padding: 0.5rem;
        flex-direction: column;
        gap: 0.25rem;
        font-size: 0.75rem;
        align-items: center;
        border-radius: 0;
    }

    .nav-links li span {
        display: block;
    }

    .nav-links li.active {
        border-left: none;
        border-top: 2px solid var(--accent);
        background: rgba(16, 185, 129, 0.05);
        transform: none;
    }

    .user-profile {
        display: none;
    }

    .main-content {
        margin-left: 0 !important;
        margin-bottom: 70px;
        padding: 1.5rem;
        max-width: 100vw;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .dashboard-grid, .profile-grid, .meal-planner-container {
        grid-template-columns: 1fr;
    }

    .calendar-grid {
        grid-template-columns: repeat(7, minmax(80px, 1fr));
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .table-card {
        overflow-x: auto;
    }

    .data-table th, .data-table td {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
}
