* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #10b981;
    --primary-dark: #059669;
    --primary-light: #d1fae5;
    --secondary-color: #14b8a6;
    --accent-color: #06b6d4;
    --text-dark: #1f2937;
    --text-medium: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-gradient: linear-gradient(135deg, #ecfdf5 0%, #f0fdfa 50%, #cffafe 100%);
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text p {
    font-size: 0.875rem;
    color: var(--text-medium);
}

.settings-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: var(--transition);
    color: var(--text-medium);
}

.settings-btn:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* Settings Dropdown */
.settings-wrapper {
    position: relative;
}

.settings-dropdown {
    position: absolute;
    right: 0;
    top: 48px;
    min-width: 180px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    z-index: 101;
}

.dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    color: var(--text-dark);
    transition: var(--transition);
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* Navigation Tabs */
.nav-tabs {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 80px;
    z-index: 99;
}

.tabs {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    
.walk-tracker {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}
.walk-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.25rem 0;
    font-size: 0.9rem;
}
.walk-row .label {
    color: var(--text-medium);
}
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-medium);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-dark);
    background: var(--bg-secondary);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn svg {
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards */
.card {
    background: var(--bg-primary);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-xl);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

.card-subtitle {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-description {
    color: var(--text-medium);
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

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

/* Upload Area */
.upload-area {
    border: 2px dashed var(--primary-color);
    border-radius: var(--border-radius);
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(20, 184, 166, 0.05));
}

.upload-area:hover {
    border-color: var(--primary-dark);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(20, 184, 166, 0.1));
    transform: translateY(-2px);
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-md);
}

.spinner {
    width: 48px;
    height: 48px;
    margin: 1rem auto;
    border: 4px solid var(--primary-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.upload-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.upload-subtext {
    font-size: 0.875rem;
    color: var(--text-medium);
}

.preview-image {
    margin-top: 1.5rem;
    border-radius: var(--border-radius);
    overflow: hidden;
    max-height: 400px;
}

.preview-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Ingredients Grid */
.ingredients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.ingredient-item {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--bg-secondary), #f3f4f6);
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    transition: var(--transition);
    position: relative;
}

.ingredient-item.unconfirmed {
    border: 2px dashed var(--accent-color);
    background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
}

.ingredient-item.confirmed {
    border: 2px solid var(--primary-color);
    background: linear-gradient(135deg, var(--primary-light), #ecfdf5);
}

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

.ingredient-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
}

.ingredient-info h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.ingredient-info p {
    font-size: 0.875rem;
    color: var(--text-medium);
    margin-bottom: 0.5rem;
}

.confidence-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.confidence-high {
    background: #d1fae5;
    color: #065f46;
}

.confidence-medium {
    background: #fef3c7;
    color: #92400e;
}

.confidence-low {
    background: #fee2e2;
    color: #991b1b;
}

.confidence-icon {
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.freshness-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.freshness-good {
    background: #d1fae5;
    color: #065f46;
}

.freshness-warning {
    background: #fed7aa;
    color: #92400e;
}

.freshness-expired {
    background: #fee2e2;
    color: #991b1b;
}

.ingredient-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.ingredient-actions button {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.btn-confirm {
    background: var(--primary-color);
    color: white;
}

.btn-confirm:hover {
    background: var(--primary-dark);
}

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

.btn-edit:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.btn-delete {
    background: var(--bg-primary);
    color: #dc2626;
    border: 1px solid var(--border-color);
}

.btn-delete:hover {
    background: #fee2e2;
    border-color: #dc2626;
}

.confirmed-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Form */
.profile-form {
    margin-bottom: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--bg-primary);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Preference Input */
.preference-input {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.preference-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.preference-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Preferences Tags */
.preferences-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.preference-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--primary-light), #ccfbf1);
    color: var(--primary-dark);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.preference-tag:hover {
    background: linear-gradient(135deg, #a7f3d0, #99f6e4);
}

.preference-tag button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    padding: 0;
    transition: var(--transition);
}

.preference-tag button:hover {
    color: #dc2626;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

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

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    padding: 0.625rem 1.25rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-add {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-add:hover {
    transform: scale(1.05);
}

/* Form inline errors */
.form-error {
    color: #dc2626; /* red-600 */
    font-size: 0.8125rem;
    margin-top: 0.375rem;
}

/* Badge */
.badge {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Recommendations */
.recommendations-list {
    display: grid;
    gap: 1rem;
}

.recommendation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border-radius: var(--border-radius);
    border: 1px solid #d1fae5;
    transition: var(--transition);
}

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

.recommendation-info h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.recommendation-reason {
    font-size: 0.875rem;
    color: var(--text-medium);
    margin-bottom: 0.5rem;
}

.recommendation-store {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-medium);
}

.recommendation-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Stores List */
.stores-list {
    display: grid;
    gap: 1rem;
}

.store-item {
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.store-item:hover {
    box-shadow: var(--shadow-md);
}

.store-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
}

.store-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
}

.store-distance {
    font-size: 0.875rem;
    color: var(--text-medium);
}

.store-items {
    font-size: 0.875rem;
    color: var(--text-medium);
}

/* Recipes Grid */
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.recipe-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

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

.recipe-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--primary-light), #ccfbf1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.recipe-image svg {
    width: 64px;
    height: 64px;
    color: var(--primary-color);
    opacity: 0.5;
}

.recipe-content {
    padding: 1.25rem;
}

.recipe-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.recipe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-medium);
}

.recipe-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.recipe-ingredients {
    font-size: 0.875rem;
    color: var(--text-medium);
    line-height: 1.5;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-medium);
}

.empty-state svg {
    margin: 0 auto 1.5rem;
    opacity: 0.3;
}

.empty-state p {
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

.empty-state-small {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-medium);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-dark);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal {
    background: var(--bg-primary);
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

.modal-close {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: var(--transition);
    color: var(--text-medium);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.modal-footer .btn-secondary,
.modal-footer .btn-primary {
    padding: 0.75rem 1.5rem;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .logo-text h1 {
        font-size: 1.25rem;
    }
    
    .logo-text p {
        display: none;
    }
    
    .tab-btn span {
        display: none;
    }
    
    .tab-btn {
        padding: 1rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .ingredients-grid,
    .recipes-grid {
        grid-template-columns: 1fr;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
}