/* ------------------------------
   GLOBAL
------------------------------ */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
                 Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    background: #f2f2f7;
    color: #111827;
}

.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem 1.25rem 2rem;
}

/* ------------------------------
   TABS
------------------------------ */

.top-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 20;
}

.tab-btn {
    flex: 1;
    padding: 0.85rem 0.5rem;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: #6b7280;
    cursor: pointer;
    white-space: nowrap;
}

.tab-btn.active {
    color: #2563eb;
    font-weight: 600;
    border-bottom: 3px solid #2563eb;
}

/* ------------------------------
   TAB PAGES
------------------------------ */

.tab-page {
    display: none;
}

.tab-page.active {
    display: block;
}

h1 {
    font-size: 1.6rem;
    margin: 1.1rem 0 0.5rem;
}

.section-note {
    color: #6b7280;
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
}

/* For future cards / sections (we'll use this in next phases) */
.card {
    background: #ffffff;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    margin-bottom: 1rem;
}

/* Responsive tweaks */
@media (max-width: 600px) {
    .app-container {
        padding: 0.8rem 0.9rem 1.6rem;
    }

    h1 {
        font-size: 1.4rem;
    }

    /* Wrap tabs to two rows on small screens */
    .top-tabs {
        flex-wrap: wrap;
        overflow-x: unset;
    }

    .tab-btn {
        flex: 1 1 33%;
        font-size: 0.8rem;
        padding: 0.7rem 0.25rem;
        text-align: center;
        white-space: normal;
    }
}
/* ================================
   MODAL SYSTEM (Phase 2)
================================= */

.hidden {
    display: none !important;
}

/* Modal container */
.modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Backdrop */
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(2px);
    pointer-events: auto;
}

/* Modal content */
.modal-content {
    position: relative;
    pointer-events: auto;
    width: 92%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 18px;
    padding: 1.2rem 1.4rem 1.6rem;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    transform: translateZ(0); /* iOS scroll fix */
}

/* Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Step indicators */
.modal-steps {
    display: flex;
    gap: 0.45rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.step-dot {
    width: 10px;
    height: 10px;
    background: #d1d5db;
    border-radius: 50%;
    transition: background 0.2s;
}

.step-dot.active {
    background: #2563eb;
}

/* Step animation */
.modal-step {
    animation: fadeIn 0.18s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Ingredient rows */
#ingredientsContainer {
    margin-bottom: 0.8rem;
}

.ingredient-row {
    background: #f8f8fa;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.8rem;
    margin-bottom: 0.75rem;
}

.ingredient-row input,
.ingredient-row select {
    width: 100%;
    margin-bottom: 0.45rem;
}

.default-toggle {
    background: #e5e7eb;
    border-radius: 6px;
    padding: 0.35rem 0.55rem;
    display: inline-block;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.default-toggle.active {
    background: gold;
}

/* Review section */
.review-block {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 0.85rem;
    margin-bottom: 0.9rem;
    border-radius: 10px;
}

.review-block ul {
    margin: 0.4rem 0 0;
    padding-left: 1.2rem;
}

/* Modal buttons */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.7rem;
    margin-top: 1rem;
}

.modal-actions button {
    padding: 0.55rem 0.95rem;
    border: none;
    border-radius: 8px;
    background: #e5e7eb;
    cursor: pointer;
}

.modal-actions .primary {
    background: #2563eb;
    color: #ffffff;
}

/* Add Recipe button on Recipes tab */
.add-recipe-btn {
    display: inline-block;
    margin-bottom: 1rem;
    background: #2563eb;
    color: white;
    padding: 0.65rem 1rem;
    font-size: 1rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
}

/* Photo Import button on Recipes tab */
.photo-import-btn {
    display: inline-block;
    margin-bottom: 1rem;
    background: #059669;
    color: white;
    padding: 0.65rem 1rem;
    font-size: 1rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
}
.planner-category {
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.planner-category-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.2rem 0;
}

.planner-meal-block {
    margin-left: 0.75rem;
    margin-top: 0.25rem;
}

.planner-meal-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.planner-ingredients {
    margin-left: 1.5rem;
    margin-top: 0.3rem;
    font-size: 0.9rem;
}

.planner-ingredient {
    margin: 2px 0;
}

.muted {
    color: #6b7280;
    font-size: 0.85em;
}

.planner-extras {
    margin-top: 1.5rem;
}

.planner-extra-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.build-grocery-btn {
    margin-top: 1rem;
    width: 100%;
}

/* Visible grocery store group */
/* =========================
   GROCERY LIST STYLES
   ========================= */

#groceryContainer {
    margin-top: 1rem;
    padding: 1rem;
}

.grocery-store-card {
    background: #ffffff;
    border: 1px solid #d1d5db;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 10px;
}

#groceryContainer h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: #111827;
}

/* each grocery line */
.grocery-item {
    display: flex;
    justify-content: space-between; /* LEFT and RIGHT alignment */
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    font-size: 16px;
}

/* Left side item text — stays left aligned */
.grocery-item-name {
    flex: 1;
    text-align: left;
}

/* Right side aisle text — light grey */
.grocery-item-aisle {
    color: #9ca3af;         /* Tailwind gray-400 */
    font-size: 0.85rem;
    margin-left: 1rem;
    white-space: nowrap;
}
/* Grocery item checkbox */
.grocery-checkbox {
    margin-right: 0.5rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Checked grocery item — strike through and fade */
.grocery-item-checked .grocery-item-name {
    text-decoration: line-through;
    color: #9ca3af;
}

.grocery-item-checked {
    opacity: 0.6;
}


.grocery-item:last-child {
    border-bottom: none;
}

.grocery-item::before {
    content: "•";
    color: #2563eb;
    font-weight: bold;
}


/* Allow dropdown to display outside the flex row */

/* Prevent clipping of dropdown in the extras section */
.planner-extras {
    overflow: visible !important;
}

/* ===========================================================
   FIX: Make the Other Items store dropdown fully visible
   =========================================================== */


/* Container for Other Items row */
.planner-extra-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.5rem;

    flex-wrap: nowrap;     /* ← REQUIRED */
    overflow: visible !important;
}

/* Make inputs behave nicely in flex */
#plannerExtraInput {
    flex: 1;       /* stretch */
    min-width: 120px;
}

#plannerExtraQty {
    width: 70px;
    min-width: 60px;
}

/* Ensure dropdown never gets clipped by parent container */
.planner-extras {
    overflow: visible !important;
    position: relative;
    z-index: 10;
}
.planner-ingredient-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 4px 0;
}
#plannerExtraStore {
    width: 150px;
    min-width: 120px;
    padding: 4px;
}
/* Prevent iOS Safari zoom on inputs */
input,
select,
textarea {
    font-size: 16px !important;
}
/* Ensure modal text and inputs meet iOS minimum */
.modal-content {
    font-size: 16px !important;
}
.modal-content input,
.modal-content select,
.modal-content textarea,
.modal-content label,
.modal-content span {
    font-size: 16px !important;
}
@supports (-webkit-touch-callout: none) {
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}
.group-suggest-menu {
    background: white;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    max-height: 180px;
    overflow-y: auto;
    font-size: 0.9rem;
}

.group-suggest-item {
    padding: 6px 8px;
    cursor: pointer;
}

.group-suggest-item:hover {
    background: #f0f0f0;
}
/* Fix Grocery List Layout */
#groceryTab {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}


#groceryContainer {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}
.delivery-btn {
    padding: 4px 8px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
}

.instacart-btn {
    background-color: #03a66a;
    color: white;
}

.doordash-btn {
    background-color: #ff3008;
    color: white;
}
/* ================================
   AUTHENTICATION SCREEN STYLES
   ADD TO THE END OF YOUR style.css
================================= */

/* Auth screen container */
.auth-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.auth-container {
    background: white;
    border-radius: 20px;
    padding: 3rem 2.5rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-container h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
    color: #111827;
}

.auth-description {
    color: #6b7280;
    margin-bottom: 2rem;
    font-size: 1rem;
}

/* Google Sign-In Button */
.google-sign-in-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

.google-sign-in-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.google-sign-in-btn:active {
    transform: translateY(0);
}

.auth-note {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: #9ca3af;
}

/* Top navigation bar with user info */
.top-nav {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 30;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
}

.user-info span {
    font-weight: 500;
    color: #374151;
}

.sign-out-btn {
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.sign-out-btn:hover {
    background: #e5e7eb;
}

/* Hide/show utility classes */
.hidden {
    display: none !important;
}

/* Loading state for sign-in button */
.google-sign-in-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .auth-container {
        padding: 2rem 1.5rem;
    }
    
    .auth-container h1 {
        font-size: 1.5rem;
    }
    
    .top-nav {
        padding: 0.5rem 0.75rem;
    }
    
    .user-photo {
        width: 32px;
        height: 32px;
    }
}
/* ================================
   EMAIL AUTHENTICATION STYLES
   ADD TO THE END OF YOUR style.css
================================= */

/* Auth divider (OR separator) */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: #9ca3af;
    font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e5e7eb;
}

.auth-divider span {
    padding: 0 1rem;
}

/* Email/Password Form */
.email-auth-form {
    width: 100%;
}

.email-auth-form input[type="email"],
.email-auth-form input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s;
}

.email-auth-form input:focus {
    outline: none;
    border-color: #667eea;
}

.email-auth-form input::placeholder {
    color: #9ca3af;
}

/* Auth error message */
.auth-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.auth-error.hidden {
    display: none;
}

/* Auth buttons */
.auth-buttons {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.auth-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-btn.primary {
    background: #667eea;
    color: white;
}

.auth-btn.primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.auth-btn.secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.auth-btn.secondary:hover {
    background: #f9fafb;
    transform: translateY(-2px);
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Forgot password link */
.forgot-password-link {
    display: block;
    text-align: center;
    color: #667eea;
    text-decoration: none;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.forgot-password-link:hover {
    text-decoration: underline;
}

/* Email verification message */
.verification-message {
    text-align: center;
    padding: 1.5rem;
    background: #f0fdf4;
    border: 2px solid #86efac;
    border-radius: 12px;
    margin: 1rem 0;
}

.verification-message.hidden {
    display: none;
}

.verification-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.verification-message h3 {
    margin: 0 0 0.5rem 0;
    color: #166534;
}

.verification-message p {
    color: #15803d;
    margin: 0.5rem 0;
}

.verification-note {
    font-size: 0.875rem;
    color: #16a34a;
    margin: 1rem 0 !important;
}

#verificationEmail {
    color: #15803d;
    font-weight: 600;
}

#resendVerificationBtn,
#backToSignInBtn {
    width: 100%;
    margin-top: 0.5rem;
}

/* Loading state */
.auth-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.auth-btn.loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .auth-buttons {
        flex-direction: column;
    }
    
    .auth-btn {
        width: 100%;
    }
}
