@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

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

/* Zoom Consistency */
html {
    font-size: 16px; /* Base font size for consistent zooming */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-size: 1rem; /* Ensure consistent base font size */
}

:root {
    /* New Dark Theme Color Palette */
    --bg-primary: #121212;        /* Charcoal Black */
    --bg-secondary: #2E2E2E;      /* Slate Gray */
    --bg-tertiary: #1A1A1A;       /* Darker charcoal */
    
    --primary: #00FFB2;           /* Neon Green */
    --primary-dark: #00CC8F;      /* Darker neon green */
    --secondary: #4FD1C5;         /* Aqua Blue */
    --secondary-dark: #3BB5A9;    /* Darker aqua blue */
    --accent: #00FFB2;            /* Neon Green accent */
    
    --success: #00FFB2;           /* Neon Green for success */
    --danger: #FF6B6B;            /* Red for errors */
    --warning: #FFD93D;           /* Yellow for warnings */
    --info: #4FD1C5;              /* Aqua Blue for info */
    
    --text-primary: #F0F0F0;      /* Ghost White */
    --text-secondary: #E0E0E0;    /* Brighter light gray for better contrast */
    --text-muted: #B0B0B0;        /* Brighter medium gray for better contrast */
    
    --gray-50: #2E2E2E;           /* Slate Gray */
    --gray-100: #3A3A3A;          /* Lighter slate */
    --gray-200: #4A4A4A;          /* Medium gray */
    --gray-300: #5A5A5A;          /* Lighter gray */
    --gray-600: #A0A0A0;          /* Brighter text muted for better contrast */
    --gray-700: #D0D0D0;          /* Brighter text secondary for better contrast */
    --gray-900: #1A1A1A;          /* Dark gray for text on light backgrounds */
    
    --border-color: rgba(240, 240, 240, 0.1);
    --glass-bg: rgba(46, 46, 46, 0.7);
}

body {
    background: linear-gradient(135deg, #121212 0%, #2E2E2E 50%, #1A1A1A 100%);
    min-height: 100vh;
    background-attachment: fixed;
    color: var(--text-primary);
}

/* Floating Background Orbs */
.bg-orbs {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: float 6s ease-in-out infinite;
}

.orb-1 {
    top: 10%;
    left: 5%;
    width: 300px;
    height: 300px;
    background: rgba(0, 255, 163, 0.15);
    box-shadow: 0 0 100px rgba(0, 255, 163, 0.3);
}

.orb-2 {
    bottom: 10%;
    right: 5%;
    width: 400px;
    height: 400px;
    background: rgba(124, 58, 237, 0.15);
    box-shadow: 0 0 120px rgba(124, 58, 237, 0.3);
    animation-delay: 1s;
}

.orb-3 {
    top: 50%;
    left: 50%;
    width: 350px;
    height: 350px;
    background: rgba(59, 130, 246, 0.12);
    box-shadow: 0 0 110px rgba(59, 130, 246, 0.25);
    animation-delay: 2s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* Navigation */
.navbar {
    background: rgba(30, 35, 55, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.75rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}

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

.nav-links a {
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    transition: all 0.3s;
}

.nav-links a:hover {
    background: var(--gray-100);
    color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 255, 163, 0.2);
}

.nav-links a.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--bg-primary);
    box-shadow: 0 4px 20px rgba(0, 255, 163, 0.4), 0 0 40px rgba(124, 58, 237, 0.3);
}

/* Glass Effect */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5), 0 0 1px rgba(0, 255, 178, 0.1);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--bg-primary);
    box-shadow: 0 4px 20px rgba(0, 255, 163, 0.3), 0 0 40px rgba(124, 58, 237, 0.2);
    font-weight: 800;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 255, 163, 0.5), 0 0 60px rgba(124, 58, 237, 0.4);
}

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

.btn-secondary:hover {
    background: var(--gray-200);
    box-shadow: 0 0 20px rgba(0, 255, 163, 0.1);
}

/* Table Styles */
.meal-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: 1rem;
}

.meal-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.meal-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meal-table tbody tr {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s;
}

.meal-table tbody tr:hover {
    background: var(--bg-tertiary);
    transform: scale(1.01);
    box-shadow: 0 0 20px rgba(0, 255, 163, 0.1);
}

.meal-table td {
    padding: 1rem;
    color: var(--text-secondary);
}

.meal-table tbody tr:last-child {
    border-bottom: none;
}

/* Loading Spinner */
.loading-spinner {
    border: 3px solid var(--gray-200);
    border-top: 3px solid var(--primary);
    border-right: 3px solid var(--secondary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px rgba(0, 255, 163, 0.3);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pulse animation for interactive elements */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 255, 163, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 255, 163, 0.6), 0 0 60px rgba(124, 58, 237, 0.4);
    }
}

/* ========================================
   RESPONSIVE DESIGN IMPROVEMENTS
   ======================================== */

/* Mobile Navigation */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.75rem;
    min-width: 44px;
    min-height: 44px;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    z-index: 1001;
    position: relative;
}

.mobile-menu-toggle:hover {
    background: rgba(0, 255, 178, 0.1);
    color: var(--primary);
}

.mobile-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    backdrop-filter: blur(10px);
    pointer-events: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.mobile-nav.active {
    display: block;
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
}

.mobile-nav ul {
    list-style: none;
    padding: 1rem;
    margin: 0;
}

.mobile-nav li {
    margin-bottom: 0.5rem;
}

.mobile-nav a {
    display: block;
    padding: 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.3s;
    min-height: 44px;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.mobile-nav a:hover,
.mobile-nav a.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--bg-primary);
}

/* Responsive Typography */
.responsive-text {
    font-size: clamp(1rem, 4vw, 1.5rem);
    line-height: 1.6;
}

.responsive-heading {
    font-size: clamp(1.5rem, 6vw, 3rem);
    line-height: 1.2;
}

.responsive-subheading {
    font-size: clamp(1.25rem, 5vw, 2rem);
    line-height: 1.3;
}

/* Responsive Grid System */
.responsive-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .responsive-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .responsive-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .responsive-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Responsive Form Layout */
.form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

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

@media (min-width: 1024px) {
    .form-grid {
        grid-template-columns: 1fr 2fr;
    }
}

/* Responsive Container */
.responsive-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

@media (min-width: 640px) {
    .responsive-container {
        padding: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .responsive-container {
        padding: 2rem;
    }
}

/* Responsive Buttons */
.btn-responsive {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-radius: 0.5rem;
}

@media (min-width: 640px) {
    .btn-responsive {
        width: auto;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

/* Responsive Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table {
    min-width: 600px;
}

/* Responsive Cards */
.card-responsive {
    padding: 1rem;
    border-radius: 0.75rem;
}

@media (min-width: 640px) {
    .card-responsive {
        padding: 1.5rem;
        border-radius: 1rem;
    }
}

@media (min-width: 1024px) {
    .card-responsive {
        padding: 2rem;
        border-radius: 1.5rem;
    }
}

/* Responsive Images */
.img-responsive {
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: cover;
}

/* Responsive Spacing */
.spacing-responsive {
    padding: 1rem;
    margin: 1rem 0;
}

@media (min-width: 640px) {
    .spacing-responsive {
        padding: 1.5rem;
        margin: 1.5rem 0;
    }
}

@media (min-width: 1024px) {
    .spacing-responsive {
        padding: 2rem;
        margin: 2rem 0;
    }
}

/* Touch-friendly interactions */
.touch-friendly {
    min-height: 44px;
    min-width: 44px;
    padding: 0.75rem;
}

/* Responsive Modal */
.modal-responsive {
    width: 95%;
    max-width: 500px;
    margin: 1rem;
}

@media (min-width: 640px) {
    .modal-responsive {
        width: 90%;
        max-width: 600px;
        margin: 2rem;
    }
}

@media (min-width: 1024px) {
    .modal-responsive {
        width: 80%;
        max-width: 800px;
        margin: 3rem;
    }
}

/* Responsive Navigation */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block;
        position: relative;
        z-index: 1002;
    }
    
    .nav-container {
        padding: 1rem;
        position: relative;
        z-index: 1000;
    }
    
    .nav-logo {
        font-size: 1.5rem;
    }
    
    .nav-logo img {
        height: 35px !important;
    }
    
    /* Ensure mobile nav is above everything */
    .mobile-nav {
        z-index: 1001;
    }
    
    /* Mobile chart sizing - make graphs bigger on mobile */
    #weightChart {
        max-height: 600px !important;
        height: 500px !important;
        min-height: 400px !important;
    }
    
    #chartContainer {
        margin: 0 -1rem 2rem -1rem;
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0.75rem;
    }
    
    .nav-logo {
        font-size: 1.25rem;
    }
    
    .nav-logo img {
        height: 30px !important;
    }
    
    /* Extra large chart for very small screens */
    #weightChart {
        max-height: 700px !important;
        height: 600px !important;
        min-height: 500px !important;
    }
    
    #chartContainer {
        margin: 0 -0.5rem 2rem -0.5rem;
        padding: 0 0.5rem;
    }
}

/* Responsive Hero Section */
.hero-responsive {
    padding: 2rem 1rem;
    text-align: center;
}

@media (min-width: 640px) {
    .hero-responsive {
        padding: 3rem 1.5rem;
    }
}

@media (min-width: 1024px) {
    .hero-responsive {
        padding: 4rem 2rem;
    }
}

/* Responsive Stats Grid */
.stats-responsive {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 640px) {
    .stats-responsive {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
}

/* Responsive Features Grid */
.features-responsive {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .features-responsive {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .features-responsive {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Responsive Form Elements */
.form-element-responsive {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: 0.5rem;
}

@media (min-width: 640px) {
    .form-element-responsive {
        padding: 1rem;
        font-size: 1.125rem;
        border-radius: 0.75rem;
    }
}

/* Responsive Button Groups */
.btn-group-responsive {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .btn-group-responsive {
        flex-direction: row;
        gap: 1rem;
    }
}

/* Responsive Text Sizing */
.text-responsive-xs {
    font-size: clamp(0.75rem, 2vw, 0.875rem);
}

.text-responsive-sm {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
}

.text-responsive-base {
    font-size: clamp(1rem, 3vw, 1.125rem);
}

.text-responsive-lg {
    font-size: clamp(1.125rem, 4vw, 1.5rem);
}

.text-responsive-xl {
    font-size: clamp(1.5rem, 5vw, 2rem);
}

.text-responsive-2xl {
    font-size: clamp(2rem, 6vw, 3rem);
}

.text-responsive-3xl {
    font-size: clamp(2.5rem, 8vw, 4rem);
}

/* Responsive Spacing Utilities */
.p-responsive {
    padding: clamp(0.5rem, 2vw, 1rem);
}

.p-responsive-sm {
    padding: clamp(0.25rem, 1vw, 0.5rem);
}

.p-responsive-lg {
    padding: clamp(1rem, 3vw, 2rem);
}

.m-responsive {
    margin: clamp(0.5rem, 2vw, 1rem);
}

.m-responsive-sm {
    margin: clamp(0.25rem, 1vw, 0.5rem);
}

.m-responsive-lg {
    margin: clamp(1rem, 3vw, 2rem);
}

/* Responsive Visibility */
.hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block;
    }
}

.show-mobile {
    display: block;
}

@media (min-width: 768px) {
    .show-mobile {
        display: none;
    }
}

/* Responsive Overflow */
.overflow-responsive {
    overflow-x: auto;
    overflow-y: visible;
}

@media (min-width: 1024px) {
    .overflow-responsive {
        overflow: visible;
    }
}

/* Responsive Flexbox */
.flex-responsive {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 640px) {
    .flex-responsive {
        flex-direction: row;
        gap: 1.5rem;
    }
}

/* Responsive Grid Auto-fit */
.grid-auto-responsive {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

@media (min-width: 640px) {
    .grid-auto-responsive {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .grid-auto-responsive {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 2rem;
    }
}

/* Utility Classes */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.glow {
    box-shadow: 0 0 40px rgba(0, 255, 163, 0.4), 0 0 80px rgba(124, 58, 237, 0.3);
}

.card {
    background: var(--bg-secondary);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--secondary-dark) 100%);
    box-shadow: 0 0 20px rgba(0, 255, 163, 0.5);
}

/* Form Elements Dark Mode */
input, select, textarea {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    transition: all 0.3s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 255, 163, 0.1), 0 0 20px rgba(0, 255, 163, 0.2);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

/* Dark mode adjustments for inline styles */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
}

p {
    color: var(--text-secondary);
}

/* Enhance glow effects */
.glass:hover {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5), 0 0 2px rgba(0, 255, 178, 0.2);
}

/* Stats and feature cards */
.stat-card, .feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.stat-card:hover, .feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(0, 255, 163, 0.2);
}

/* Override any white backgrounds globally */
button {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

pre {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

/* Fix modal and content areas */
div[style*="background: white"],
div[style*="background:white"],
button[style*="background: white"],
button[style*="background:white"] {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* Fix any remaining light text on light backgrounds */
small {
    color: var(--text-muted) !important;
}

/* Loading Spinner */
.loading-spinner {
    border: 4px solid rgba(0, 255, 163, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Meal Table Styles */
.meal-table {
    width: 100%;
    border-collapse: collapse;
}

.meal-table th,
.meal-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.meal-table th {
    background: var(--bg-secondary);
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.875rem;
}

.meal-table td {
    color: var(--text-primary);
}

.meal-table tr:hover {
    background: var(--bg-secondary);
}
