/* CSS Variables */
:root {
    --primary: #10B981;
    --primary-dark: #059669;
    --primary-light: #D1FAE5;
    --secondary: #F59E0B;
    --secondary-light: #FEF3C7;
    --success: #10B981;
    --success-light: #D1FAE5;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --info: #3B82F6;
    --info-light: #DBEAFE;
    --light: #F3F4F6;
    --dark: #1F2937;
    --gray: #6B7280;
    --gray-light: #E5E7EB;
    --white: #FFFFFF;
    --font-heading: 'Nunito', sans-serif;
    --font-body: 'Inter', sans-serif;
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
    --safe-area-left: env(safe-area-inset-left);
    --safe-area-right: env(safe-area-inset-right);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: #F9FAFB;
    color: var(--dark);
    line-height: 1.6;
    padding-bottom: calc(80px + var(--safe-area-bottom));
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* Safe Area Support */
@supports (padding-top: env(safe-area-inset-top)) {
    .safe-area-top {
        padding-top: var(--safe-area-top);
    }

    .safe-area-bottom {
        padding-bottom: var(--safe-area-bottom);
    }
}

/* Utility Classes - Background Colors */
.text-primary {
    color: var(--primary) !important;
}

.text-secondary {
    color: var(--secondary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-info {
    color: var(--info) !important;
}

.text-gray {
    color: var(--gray) !important;
}

.text-dark {
    color: var(--dark) !important;
}

.text-white {
    color: var(--white) !important;
}

.bg-primary {
    background-color: var(--primary) !important;
}

.bg-primary-light {
    background-color: var(--primary-light) !important;
    color: var(--primary-dark) !important;
}

.bg-secondary {
    background-color: var(--secondary) !important;
}

.bg-secondary-light {
    background-color: var(--secondary-light) !important;
    color: #92400E !important;
}

.bg-success {
    background-color: var(--success) !important;
}

.bg-success-light {
    background-color: var(--success-light) !important;
    color: #065F46 !important;
}

.bg-danger {
    background-color: var(--danger) !important;
}

.bg-danger-light {
    background-color: var(--danger-light) !important;
    color: #991B1B !important;
}

.bg-warning {
    background-color: var(--warning) !important;
}

.bg-warning-light {
    background-color: var(--warning-light) !important;
    color: #92400E !important;
}

.bg-info {
    background-color: var(--info) !important;
}

.bg-info-light {
    background-color: var(--info-light) !important;
    color: #1E40AF !important;
}

.bg-light {
    background-color: var(--light) !important;
}

.bg-dark {
    background-color: var(--dark) !important;
}

.bg-white {
    background-color: var(--white) !important;
}

.font-heading {
    font-family: var(--font-heading);
}

.font-body {
    font-family: var(--font-body);
}

/* Shadows */
.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}

.shadow {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
}

.shadow-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* Border Radius */
.rounded-xl {
    border-radius: 1rem !important;
}

.rounded-2xl {
    border-radius: 1.5rem !important;
}

.rounded-3xl {
    border-radius: 2rem !important;
}

/* Buttons - Fixed Focus Ring */
.btn {
    font-family: var(--font-body);
    font-weight: 500;
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn:focus,
.btn:focus-visible,
.btn:active:focus {
    outline: none !important;
    box-shadow: none !important;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-primary:active {
    background-color: var(--primary-dark) !important;
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #D97706;
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #DC2626;
}

.btn-warning {
    background-color: var(--warning);
    color: white;
}

.btn-info {
    background-color: var(--info);
    color: white;
}

.btn-light {
    background-color: var(--light);
    color: var(--dark);
}

.btn-dark {
    background-color: var(--dark);
    color: white;
}

.btn-outline-primary {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:active,
.btn-outline-primary.active,
.btn-outline-primary:focus {
    background-color: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

.btn-outline-secondary {
    background-color: transparent;
    border: 2px solid var(--secondary);
    color: var(--secondary);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:active,
.btn-outline-secondary.active,
.btn-outline-secondary:focus {
    background-color: var(--secondary) !important;
    color: white !important;
    border-color: var(--secondary) !important;
}

.btn-outline-success {
    background-color: transparent;
    border: 2px solid var(--success);
    color: var(--success);
}

.btn-outline-danger {
    background-color: transparent;
    border: 2px solid var(--danger);
    color: var(--danger);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Button Group Fix */
.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 0.75rem;
    border-bottom-left-radius: 0.75rem;
}

.btn-group .btn:last-child {
    border-top-right-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
}

/* Forms */
.form-control, .form-select {
    border-radius: 0.75rem;
    border: 2px solid var(--gray-light);
    padding: 0.875rem 1rem;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.form-text {
    font-size: 0.875rem;
    color: var(--gray);
}

.input-group-text {
    background-color: var(--light);
    border: 2px solid var(--gray-light);
    border-right: none;
    border-radius: 0.75rem 0 0 0.75rem;
    padding: 0.875rem 1rem;
}

.input-group .form-control {
    border-left: none;
    border-radius: 0 0.75rem 0.75rem 0;
}

/* Custom Checkbox & Radio */
.form-check {
    padding-left: 2em;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-left: -2em;
    margin-top: 0.15em;
    border: 2px solid var(--gray-light);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    border-color: var(--primary);
    outline: none;
}

.form-check-label {
    cursor: pointer;
    font-weight: 500;
}

/* Radio Button Style */
.form-check-input[type="radio"] {
    border-radius: 50%;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
    background: var(--gray-light);
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
    flex-shrink: 0;
    margin-left: 1rem;
}

.toggle-switch.active {
    background: var(--primary);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-switch.active::after {
    transform: translateX(24px);
}

/* Cards */
.card {
    border: none;
    border-radius: 1rem;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Safari Fix: Flex container links */
.card-body > a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-light);
    text-decoration: none;
    color: var(--dark);
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(16, 185, 129, 0.2);
    touch-action: manipulation;
    position: relative;
    z-index: 2;
    min-height: 80px;
}

.card-body > a:last-child {
    border-bottom: none;
}

.card-body > a:active {
    background-color: rgba(16, 185, 129, 0.05);
}

/* Ensure all interactive elements are clickable on Safari */
.card-body > a > * {
    pointer-events: none;
}

/* Plan Day Link - Safari Fix */
.plan-day-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-light);
    text-decoration: none;
    color: var(--dark);
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(16, 185, 129, 0.2);
    touch-action: manipulation;
    position: relative;
    z-index: 2;
    min-height: 80px;
    background: transparent;
    transition: background-color 0.2s ease;
}

.plan-day-link:last-child {
    border-bottom: none;
}

.plan-day-link:hover {
    background-color: rgba(16, 185, 129, 0.02);
}

.plan-day-link:active {
    background-color: rgba(16, 185, 129, 0.08);
}

.plan-day-link > * {
    pointer-events: none;
}

.card-body {
    padding: 1.5rem;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--gray-light);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--gray-light);
    padding: 1.25rem 1.5rem;
}

/* App Header */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 0 0 2rem 2rem;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
    margin-bottom: 1.5rem;
}

.app-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

/* Bottom Navigation - Safari Fix */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-light);
    padding: 0.75rem 0 calc(0.75rem + var(--safe-area-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    z-index: 9999;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.bottom-nav .container {
    position: relative;
    z-index: 9999;
}

.bottom-nav .nav-link {
    color: var(--gray);
    text-align: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    border-radius: 0.75rem;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
    z-index: 9999;
}

.bottom-nav .nav-link i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.25rem;
    pointer-events: none;
}

.bottom-nav .nav-link span {
    pointer-events: none;
}

.bottom-nav .nav-link.active,
.bottom-nav .nav-link:hover,
.bottom-nav .nav-link:active {
    color: var(--primary);
    background-color: var(--primary-light);
    -webkit-tap-highlight-color: rgba(16, 185, 129, 0.2);
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: calc(100px + var(--safe-area-bottom));
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 999;
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* Icon Circles - Fixed */
.icon-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.25rem;
}

.icon-circle-sm {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-circle-sm i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
}

.icon-circle-lg {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-circle-xl {
    width: 72px;
    height: 72px;
    font-size: 2rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Badge Styles - Fixed */
.badge {
    font-weight: 600;
    padding: 0.5em 0.75em;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.badge-soft-primary {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

.badge-soft-secondary {
    background-color: var(--secondary-light);
    color: #92400E;
}

.badge-soft-success {
    background-color: var(--success-light);
    color: #065F46;
}

.badge-soft-danger {
    background-color: var(--danger-light);
    color: #991B1B;
}

.badge-soft-warning {
    background-color: var(--warning-light);
    color: #92400E;
}

.badge-soft-info {
    background-color: var(--info-light);
    color: #1E40AF;
}

/* Progress Bar */
.progress {
    height: 8px;
    border-radius: 4px;
    background-color: var(--gray-light);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 4px;
    transition: width 0.6s ease;
}

.progress-header {
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
}

.progress-header .progress-bar {
    background: white;
}

.progress-sm {
    height: 8px;
}

/* Landing Page Wrapper */
.landing-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--white);
}

.landing-wrapper > section:first-of-type {
    flex-grow: 1;
    background: linear-gradient(180deg, var(--white) 0%, var(--light) 100%);
}

.landing-wrapper > footer {
    flex-shrink: 0;
    margin-top: auto;
}

/* Landing page body fix - no bottom padding since there's no bottom-nav */
body.landing-page {
    padding-bottom: 0;
}

/* AI Robot Icon */
.ai-robot-icon {
    font-size: 4rem;
    opacity: 0.3;
    color: var(--primary);
}

/* Toggle Password Button */
.btn-toggle-password {
    border: none;
    background: var(--light);
    border: 2px solid var(--gray-light);
    border-left: none;
    border-radius: 0 0.75rem 0.75rem 0;
    padding: 0.875rem 1rem;
    cursor: pointer;
}

.btn-toggle-password:hover {
    background: var(--gray-light);
}

.btn-toggle-password:focus {
    outline: none;
    box-shadow: none;
}

/* Recipe Content Link */
.recipe-content {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
}

.recipe-content:hover,
.recipe-content:active {
    color: inherit;
    text-decoration: none;
}

/* Meal Card Link */
.meal-card {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
}

.meal-card:hover,
.meal-card:active {
    text-decoration: none;
    color: inherit;
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--primary-light) 0%, white 50%, var(--secondary-light) 100%);
}

.auth-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 1.5rem;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}

.auth-form-card {
    background: white;
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    width: 100%;
}

/* Social Login */
.btn-social {
    width: 100%;
    padding: 0.875rem;
    border-radius: 0.75rem;
    border: 2px solid var(--gray-light);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--dark);
}

.btn-social:hover {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

/* Stepper Styles */
.stepper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.stepper::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gray-light);
    z-index: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--gray);
    transition: all 0.3s ease;
}

.step.active .step-circle,
.step.completed .step-circle {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.step-label {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray);
    font-weight: 500;
}

.step.active .step-label,
.step.completed .step-label {
    color: var(--primary);
    font-weight: 600;
}

.step-content {
    display: none;
}

.step-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Recipe Hero */
.recipe-hero {
    position: relative;
    height: 300px;
    border-radius: 0 0 2rem 2rem;
    overflow: hidden;
    margin-bottom: -2rem;
}

.recipe-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recipe-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
}

.recipe-hero-content {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    color: white;
}

.btn-hero {
    position: absolute;
    top: 1rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-hero:hover {
    transform: scale(1.1);
}

.btn-hero-back {
    left: 1rem;
}

.btn-hero-favorite {
    right: 1rem;
}

/* Info Badges */
.info-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Calendar Styles */
.calendar-scroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    scrollbar-width: none;
    justify-content: space-between;
}

.calendar-scroll::-webkit-scrollbar {
    display: none;
}

.calendar-day {
    min-width: 60px;
    text-align: center;
    padding: 0.75rem 0.5rem;
    border-radius: 1rem;
    background: white;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-day:hover {
    border-color: var(--primary-light);
}

.calendar-day.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.calendar-day-name {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    opacity: 0.7;
}

.calendar-day-number {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

/* Meal Card */
.meal-card {
    background: white;
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    display: block;
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
    position: relative;
    z-index: 1;
}

.meal-card:hover {
    border-color: var(--primary);
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
}

.meal-time {
    font-size: 0.875rem;
    color: var(--gray);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meal-title {
    font-weight: 700;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
    color: var(--dark);
}

.meal-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--gray);
}

/* Shopping List */
.category-section {
    margin-bottom: 1.5rem;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--light);
    border-radius: 0.75rem;
}

.category-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--dark);
    flex: 1;
}

.list-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.list-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.list-item.checked {
    opacity: 0.6;
    background: var(--light);
}

.list-item.checked .item-name {
    text-decoration: line-through;
    color: var(--gray);
}

.item-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--gray-light);
    border-radius: 6px;
    margin-right: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.item-checkbox.checked {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.item-details {
    flex: 1;
}

.item-name {
    font-weight: 500;
    color: var(--dark);
}

.item-quantity {
    font-size: 0.875rem;
    color: var(--gray);
}

.item-price {
    font-weight: 600;
    color: var(--primary);
}

/* Budget Styles */
.budget-summary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 1.5rem;
    margin-bottom: 1.5rem;
}

.budget-amount {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.budget-label {
    opacity: 0.9;
    font-size: 0.875rem;
}

.transaction-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.transaction-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
    font-size: 1.25rem;
}

.transaction-icon.market {
    background: var(--info-light);
    color: var(--info);
}

.transaction-icon.restaurant {
    background: var(--secondary-light);
    color: var(--secondary);
}

.transaction-icon.other {
    background: var(--light);
    color: var(--gray);
}

.transaction-details {
    flex: 1;
}

.transaction-title {
    font-weight: 600;
    color: var(--dark);
}

.transaction-date {
    font-size: 0.875rem;
    color: var(--gray);
}

.transaction-amount {
    font-weight: 700;
    color: var(--danger);
    font-size: 1.1rem;
}

/* Recipe Grid */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.recipe-card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.recipe-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.recipe-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.recipe-content {
    padding: 1rem;
    display: block;
}

.recipe-content .recipe-title {
    padding: 0;
    margin: 0 0 0.5rem 0;
}

.recipe-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recipe-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--gray);
}

.btn-favorite {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.btn-favorite:hover {
    transform: scale(1.1);
}

.btn-favorite.active {
    color: var(--danger);
}

/* Filter Pills */
.filter-pills {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    border: 2px solid var(--gray-light);
    background: white;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.filter-pill:hover {
    border-color: var(--primary);
}

.filter-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Person Card */
.person-card {
    background: white;
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.person-card:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.person-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
}

.person-info {
    flex: 1;
}

.person-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.person-meta {
    font-size: 0.875rem;
    color: var(--gray);
}

.person-badges {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

/* Modal Styles - Mobile Optimized */
.modal {
    z-index: 10000 !important;
}

.modal-backdrop {
    z-index: 9999 !important;
}

.modal-content {
    border: none;
    border-radius: 1.5rem;
}

.modal-header {
    border-bottom: 1px solid var(--gray-light);
    padding: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--gray-light);
    padding: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.modal-footer .btn {
    flex: 1;
    min-width: 80px;
}

/* Mobile Modal Optimizations */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-dialog-centered {
        min-height: calc(100% - 1rem);
        align-items: flex-end;
    }
    
    .modal-dialog-centered .modal-content {
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }
    
    .modal-content {
        border-radius: 1.25rem 1.25rem 1rem 1rem;
    }
    
    .modal-header {
        padding: 1rem 1.25rem;
        position: sticky;
        top: 0;
        background: white;
        z-index: 1;
        border-radius: 1.25rem 1.25rem 0 0;
    }
    
    .modal-body {
        padding: 1.25rem;
        max-height: calc(100vh - 250px);
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 1rem 1.25rem calc(1rem + var(--safe-area-bottom));
        position: sticky;
        bottom: 0;
        background: white;
        z-index: 1;
        border-radius: 0 0 1rem 1rem;
    }
    
    /* Ensure modal is scrollable on small screens */
    .modal.show .modal-dialog {
        transform: none;
    }
}

/* iOS Safari Safe Area Fix for Modals */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    @media (max-width: 576px) {
        .modal-footer {
            padding-bottom: calc(1rem + max(var(--safe-area-bottom), 20px));
        }
        
        .modal-dialog-centered {
            padding-bottom: env(safe-area-inset-bottom);
        }
    }
}

/* Action Buttons - Mobile Optimized */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.action-buttons .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.action-buttons .btn-icon-only {
    width: 46px;
    height: 46px;
    padding: 0;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-buttons .btn-icon-only i {
    margin: 0;
    font-size: 1.1rem;
}

@media (max-width: 375px) {
    .action-buttons .btn-text {
        font-size: 0.9rem;
    }
    
    .action-buttons .btn {
        padding: 0.625rem 1rem;
    }
    
    .action-buttons .btn-icon-only {
        width: 42px;
        height: 42px;
    }
}

/* Modal Dialog Scrollable Fix */
.modal-dialog-scrollable .modal-content {
    max-height: calc(100vh - 2rem);
    overflow: hidden;
}

.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
    flex: 1;
}

/* Modal Dialog Large - Mobile Fix */
@media (max-width: 992px) {
    .modal-lg {
        max-width: calc(100% - 1rem);
        margin: 0.5rem auto;
    }
    
    .modal-dialog-scrollable.modal-lg .modal-content {
        max-height: calc(100vh - 1rem);
    }
}

@media (max-width: 576px) {
    .modal-lg {
        max-width: 100%;
        margin: 0;
        min-height: 100vh;
    }
    
    .modal-lg .modal-content {
        min-height: 100vh;
        border-radius: 0;
    }
    
    .modal-dialog-scrollable.modal-lg .modal-content {
        max-height: 100vh;
    }
    
    .modal-lg .modal-header {
        border-radius: 0;
        padding-top: calc(1rem + var(--safe-area-top));
        flex-shrink: 0;
    }
    
    .modal-lg .modal-body {
        max-height: none;
        flex: 1;
    }
    
    .modal-lg .modal-footer {
        border-radius: 0;
        padding-bottom: calc(1rem + max(var(--safe-area-bottom), 20px));
        flex-shrink: 0;
    }
}

/* Modal Footer Button Wrap for Small Screens */
@media (max-width: 400px) {
    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        width: 100%;
        flex: none;
    }
}

/* Bottom Sheet */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 1.5rem 1.5rem 0 0;
    padding: 1.5rem;
    padding-bottom: calc(1.5rem + var(--safe-area-bottom));
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.bottom-sheet.show {
    transform: translateY(0);
}

.bottom-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.bottom-sheet-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* Plan Card */
.plan-card {
    background: white;
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.plan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.plan-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.plan-card.featured {
    border-color: var(--secondary);
    position: relative;
}

.plan-badge {
    position: absolute;
    top: -10px;
    right: 1.5rem;
    background: var(--secondary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.plan-price {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--dark);
}

.plan-price span {
    font-size: 1rem;
    color: var(--gray);
    font-weight: 400;
}

/* Quick Actions Grid */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.quick-action-card {
    background: white;
    border-radius: 1rem;
    padding: 1.25rem;
    text-align: center;
    text-decoration: none;
    color: var(--dark);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    color: var(--primary);
}

.quick-action-icon {
    width: 56px;
    height: 56px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    font-size: 1.5rem;
}

.quick-action-title {
    font-weight: 600;
    font-size: 0.95rem;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--gray);
    font-weight: 500;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--gray);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

/* List Group */
.list-group-item {
    border: none;
    border-bottom: 1px solid var(--gray-light);
    padding: 1rem;
    background: transparent;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item-action:hover {
    background: var(--light);
    border-radius: 0.5rem;
}

.list-group-item .icon-circle-sm {
    margin-right: 0;
}

.list-group-item-action {
    padding: 1rem;
    border-radius: 0.5rem;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 1rem;
    padding: 1rem 1.25rem;
}

.alert-primary {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

.alert-secondary {
    background-color: var(--secondary-light);
    color: #92400E;
}

.alert-success {
    background-color: var(--success-light);
    color: #065F46;
}

.alert-danger {
    background-color: var(--danger-light);
    color: #991B1B;
}

.alert-warning {
    background-color: var(--warning-light);
    color: #92400E;
}

.alert-info {
    background-color: var(--info-light);
    color: #1E40AF;
}

/* Accordion */
.accordion-item {
    border: none;
    margin-bottom: 0.5rem;
}

.accordion-button {
    border-radius: 1rem !important;
    padding: 1rem;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    font-weight: 500;
}

.accordion-button:not(.collapsed) {
    background: var(--primary-light);
    color: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.accordion-button:focus {
    box-shadow: none;
    border-color: transparent;
}

.accordion-body {
    padding: 1rem;
    background: white;
    border-radius: 0 0 1rem 1rem;
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.4s ease;
}

/* Fixed Bottom Actions */
.fixed-bottom-actions {
    position: fixed;
    bottom: calc(80px + var(--safe-area-bottom));
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-light);
    padding: 1rem 1.5rem;
    z-index: 1030;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

/* Profile Avatar Container */
.avatar-container {
    position: relative;
    display: inline-block;
}

.avatar-camera-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid white;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.avatar-camera-btn:hover {
    background: var(--primary-dark);
}

/* Responsive */
@media (min-width: 768px) {
    .recipe-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .quick-actions {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 375px) {
    html {
        font-size: 14px;
    }

    .recipe-grid {
        gap: 0.75rem;
    }

    .quick-actions {
        gap: 0.75rem;
    }
}

/* Print Styles */
@media print {
    .bottom-nav,
    .fab,
    .fixed-bottom-actions {
        display: none !important;
    }

    body {
        padding-bottom: 0;
    }
}

/* Spacing Utilities */
.mt-n1 {
    margin-top: -0.25rem;
}

.mt-n2 {
    margin-top: -0.5rem;
}

.mt-n3 {
    margin-top: -1rem;
}

.mt-n4 {
    margin-top: -1.5rem;
}

/* Text Utilities */
.text-decoration-none {
    text-decoration: none !important;
}

.fw-bold {
    font-weight: 700 !important;
}

.fw-semibold {
    font-weight: 600 !important;
}

.fw-medium {
    font-weight: 500 !important;
}

/* Gap Utilities */
.gap-1 {
    gap: 0.25rem !important;
}

.gap-2 {
    gap: 0.5rem !important;
}

.gap-3 {
    gap: 1rem !important;
}

.gap-4 {
    gap: 1.5rem !important;
}


/* =============================================
   START PAGE - MOBILE RESPONSIVE FIXES
   ============================================= */

/* Admin Form Container - Mobile Optimizations */
.admin-form-container {
    padding: 1rem;
}

@media (max-width: 576px) {
    .admin-form-container {
        padding: 1rem 0.75rem;
    }
    
    .admin-form-container .row.g-3 {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }
    
    .admin-form-container .form-control,
    .admin-form-container .form-select {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 0.625rem 0.75rem;
        min-height: 44px;
    }
    
    .admin-form-container .form-label.small {
        font-size: 0.8rem;
        margin-bottom: 0.375rem;
    }
    
    /* Ensure inputs are wide enough on mobile */
    .admin-form-container .col-6,
    .admin-form-container .col-12,
    .admin-form-container .col-sm-6,
    .admin-form-container .col-sm-4 {
        padding-left: 0.375rem;
        padding-right: 0.375rem;
    }
}

/* Modal Form Improvements */
#addPersonModal .modal-body {
    padding: 1.25rem;
}

#addPersonModal .form-control,
#addPersonModal .form-select {
    min-height: 44px;
    font-size: 16px; /* Prevent zoom on iOS */
}

@media (max-width: 576px) {
    #addPersonModal .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    #addPersonModal .modal-body {
        padding: 1rem;
    }
    
    #addPersonModal .row.g-3 {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }
    
    #addPersonModal .col-4,
    #addPersonModal .col-6,
    #addPersonModal .col-8,
    #addPersonModal .col-12,
    #addPersonModal .col-sm-4,
    #addPersonModal .col-sm-6 {
        padding-left: 0.375rem;
        padding-right: 0.375rem;
    }
    
    #addPersonModal .form-label {
        font-size: 0.8rem;
        margin-bottom: 0.375rem;
    }
    
    #addPersonModal .form-control,
    #addPersonModal .form-select {
        padding: 0.625rem 0.75rem;
        font-size: 16px;
    }
    
    #addPersonModal .modal-footer {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    #addPersonModal .modal-footer .btn {
        flex: 1;
        min-width: 0;
        padding: 0.625rem 1rem;
    }
}

/* Extra small devices */
@media (max-width: 375px) {
    .admin-form-container {
        padding: 0.875rem 0.625rem;
    }
    
    .admin-form-container .icon-circle {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    #addPersonModal .modal-body {
        padding: 0.875rem;
    }
    
    #addPersonModal .form-control,
    #addPersonModal .form-select {
        padding: 0.5rem 0.625rem;
        font-size: 15px;
    }
}

/* Kitchen Equipment Checkboxes - Better Mobile Layout */
@media (max-width: 576px) {
    .equipment-checkbox + .form-check-label {
        font-size: 0.875rem;
    }
    
    .form-check {
        padding-left: 1.75em;
    }
    
    .form-check-input {
        margin-left: -1.75em;
        width: 1.125rem;
        height: 1.125rem;
    }
}

/* Stepper Mobile Adjustments */
@media (max-width: 576px) {
    .stepper {
        margin-bottom: 1.5rem;
    }
    
    .step-circle {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }
    
    .step-label {
        font-size: 0.7rem;
        margin-top: 0.375rem;
    }
    
    .stepper::before {
        top: 18px;
    }
}

/* Summary Card Mobile */
@media (max-width: 576px) {
    #step-3 .bg-light.rounded-3 {
        padding: 1rem !important;
    }
    
    #step-3 h6.fw-bold {
        font-size: 0.9rem;
    }
}
