/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-orange: #FF6B00;
    --primary-orange-dark: #E65C00;
    --primary-orange-light: #FF8533;
    --background-light: #FAFAFA;
    --background-white: #FFFFFF;
    --text-dark: #1A1A1A;
    --text-gray: #666666;
    --text-light: #999999;
    --border-color: #E0E0E0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background-light);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Header */
.header {
    background: var(--background-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-orange);
    letter-spacing: -0.5px;
}

.logo h1 span {
    color: var(--text-gray);
    font-weight: 400;
}

.shopping-btn {
    background: var(--background-white);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.shopping-btn:hover {
    border-color: var(--primary-orange);
    background: var(--background-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.history-btn {
    background: var(--background-white);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.history-btn:hover {
    border-color: var(--primary-orange);
    background: var(--background-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.add-btn {
    background: var(--primary-orange);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.add-btn:hover {
    background: var(--primary-orange-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.plus-icon {
    font-size: 20px;
    font-weight: 300;
}

/* Main Content */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 100px);
}

.hero-section {
    text-align: center;
    margin-bottom: 40px;
}

.hero-section h2 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.subtitle {
    font-size: 18px;
    color: var(--text-gray);
}

/* Filters Section */
.filters-section {
    background: var(--background-white);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
    justify-content: space-between;
}

.filters-left {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
}

.filters-right {
    display: flex;
    align-items: center;
}

.filters-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
}

.type-filters,
.status-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-chip {
    background: var(--background-light);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-gray);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: var(--primary-orange-light);
    background: var(--background-white);
}

.filter-chip.active {
    background: rgba(255, 107, 0, 0.1);
    color: var(--primary-orange);
    border-color: var(--primary-orange);
}

.filter-chip.active:hover {
    background: rgba(255, 107, 0, 0.15);
    border-color: var(--primary-orange-dark);
}

.filter-chip-icon {
    font-size: 16px;
}

.filter-chip-text {
    font-size: 13px;
}

.sort-select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    background: var(--background-white);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.sort-select:hover {
    border-color: var(--primary-orange);
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-orange);
}

/* Food Grid */
.food-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 0;
}

.food-card {
    background: var(--background-white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.food-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-orange);
    transform: scaleX(0);
    transition: var(--transition);
}

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

.food-card:hover::before {
    transform: scaleX(1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.food-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.food-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.food-type {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
}

.type-ready {
    background: #E8F5E9;
    color: #2E7D32;
}

.type-snack {
    background: #E3F2FD;
    color: #1565C0;
}

.type-ingredients {
    background: #FFF3E0;
    color: #E65100;
}

.food-date {
    font-size: 14px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.days-ago {
    font-size: 13px;
    color: var(--text-gray);
    font-weight: 500;
}

.days-warning {
    color: var(--primary-orange);
}

.days-old {
    color: #D32F2F;
}

.food-notes {
    font-size: 14px;
    color: var(--text-gray);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    line-height: 1.5;
}

.long-lasting-badge {
    font-size: 14px;
    color: var(--text-gray);
    font-weight: 500;
    margin-top: 4px;
    padding: 8px 12px;
    background: var(--background-light);
    border-radius: 8px;
    display: inline-block;
}

.opened-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    background: #FFF3E0;
    color: #E65100;
    margin-bottom: 8px;
    border: 2px solid #FFB74D;
}

.amount-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: #E3F2FD;
    color: #1565C0;
    margin-bottom: 8px;
    border: 2px solid #BBDEFB;
}

.rating-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: #FFF9C4;
    color: #F57F17;
    margin-bottom: 8px;
    border: 2px solid #FFF176;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    font-size: 80px;
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 24px;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 16px;
    color: var(--text-gray);
    margin-bottom: 24px;
}

.cta-btn {
    background: var(--primary-orange);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.cta-btn:hover {
    background: var(--primary-orange-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

/* Review modal should be on top of other modals */
#reviewModal {
    z-index: 1100;
    background: rgba(0, 0, 0, 0.6);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--background-white);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-small {
    max-width: 400px;
}

.modal-large {
    max-width: 800px;
}

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

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

.modal-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
}

.modal-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.edit-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-gray);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.edit-btn:hover {
    background: var(--background-light);
    color: var(--primary-orange);
}

.close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-gray);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.close-btn:hover {
    background: var(--background-light);
    color: var(--text-dark);
}

/* Form */
.add-form {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--background-white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-orange);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Type selector buttons */
.type-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.type-btn {
    background: var(--background-white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-height: 100px;
}

.type-btn:hover {
    border-color: var(--primary-orange);
    background: var(--background-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.type-btn.selected {
    border-color: var(--primary-orange);
    background: rgba(255, 107, 0, 0.05);
    border-width: 3px;
}

.type-btn-icon {
    font-size: 32px;
    margin-bottom: 4px;
}

.type-btn-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
    line-height: 1.3;
}

/* Checkbox styling */
.checkbox-group {
    background: var(--background-light);
    padding: 16px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 600;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-orange);
}

.checkbox-label span {
    font-size: 15px;
    color: var(--text-dark);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--background-light);
}

.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

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

.btn-large {
    padding: 16px 40px;
    font-size: 18px;
    flex: 1;
}

.btn-secondary {
    background: var(--background-white);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--background-light);
}

.btn-danger {
    background: #D32F2F;
    color: white;
}

.btn-danger:hover {
    background: #B71C1C;
}

.btn-delete-small {
    background: transparent;
    color: var(--text-gray);
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 6px;
}

.btn-delete-small:hover {
    background: var(--background-light);
    color: #D32F2F;
}

/* Details Modal */
.details-content {
    padding: 24px;
}

.details-actions {
    justify-content: space-between !important;
    align-items: center;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--text-dark);
}

.detail-value {
    color: var(--text-gray);
    text-align: right;
}

/* Token Setup Modal */
.token-setup-content {
    padding: 24px;
}

.token-intro {
    font-size: 16px;
    color: var(--text-gray);
    margin-bottom: 24px;
    line-height: 1.6;
}

.token-steps {
    background: var(--background-light);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.token-steps h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.token-steps ol {
    margin-left: 20px;
    color: var(--text-gray);
}

.token-steps li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.token-steps a {
    color: var(--primary-orange);
    text-decoration: none;
    font-weight: 600;
}

.token-steps a:hover {
    text-decoration: underline;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-light);
    font-weight: normal;
}

/* Settings Button */
.settings-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--background-white);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: var(--primary-orange);
    border-color: var(--primary-orange);
    transform: scale(1.1) rotate(45deg);
    box-shadow: var(--shadow-lg);
}

.settings-btn:active {
    transform: scale(1.05) rotate(45deg);
}

/* Token Notice Popup */
.token-notice {
    position: fixed;
    bottom: 100px;
    right: 24px;
    max-width: 360px;
    z-index: 98;
    animation: slideInRight 0.4s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notice-content {
    background: var(--background-white);
    border: 2px solid var(--primary-orange);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.notice-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-gray);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.notice-close:hover {
    background: var(--background-light);
    color: var(--text-dark);
}

.notice-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    padding-right: 24px;
}

.notice-text {
    font-size: 14px;
    color: var(--text-gray);
    line-height: 1.5;
    margin-bottom: 16px;
}

.notice-actions {
    display: flex;
    gap: 8px;
}

.notice-btn-primary,
.notice-btn-secondary {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

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

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

.notice-btn-secondary {
    background: var(--background-light);
    color: var(--text-dark);
}

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

/* Mark as Eaten Modal */
.eaten-content {
    padding: 24px;
    text-align: center;
}

.eaten-question {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.eaten-subtitle {
    font-size: 14px;
    color: var(--text-gray);
    margin-bottom: 32px;
}

.eaten-choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.choice-btn {
    background: var(--background-white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.choice-btn:hover {
    border-color: var(--primary-orange);
    background: var(--background-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.choice-primary {
    border-color: var(--primary-orange);
    background: rgba(255, 107, 0, 0.05);
}

.choice-primary:hover {
    background: rgba(255, 107, 0, 0.1);
}

.choice-icon {
    font-size: 32px;
    margin-bottom: 4px;
    pointer-events: none;
}

.choice-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    pointer-events: none;
}

.choice-detail {
    font-size: 13px;
    color: var(--text-gray);
    pointer-events: none;
}

/* Review Modal */
.review-content {
    padding: 24px;
    text-align: center;
}

.review-question {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.review-subtitle {
    font-size: 14px;
    color: var(--text-gray);
    margin-bottom: 32px;
}

.star-rating {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.star-btn {
    background: none;
    border: none;
    font-size: 48px;
    color: var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    padding: 4px;
    line-height: 1;
}

.star-btn:hover {
    color: var(--primary-orange-light);
    transform: scale(1.2);
}

/* Highlight all stars up to and including the hovered one */
.star-btn:hover ~ .star-btn {
    color: var(--border-color);
}

.star-rating:hover .star-btn {
    color: var(--primary-orange-light);
}

.star-rating:hover .star-btn:hover ~ .star-btn {
    color: var(--border-color);
}

.star-btn.selected {
    color: var(--primary-orange);
}

.review-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.review-actions .btn-primary,
.review-actions .btn-secondary {
    flex: 1;
    max-width: 200px;
}

/* Shopping Mode */
.shopping-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.btn-back {
    background: var(--background-white);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-back:hover {
    border-color: var(--primary-orange);
    background: var(--background-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.shopping-search-wrapper {
    flex: 1;
    min-width: 300px;
}

.shopping-search {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
}

.shopping-search:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

/* History Modal */
.history-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    padding: 0 24px;
}

.history-tab {
    flex: 1;
    padding: 16px 24px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-gray);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.history-tab:hover {
    color: var(--primary-orange);
    background: var(--background-light);
}

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

.history-search {
    padding: 20px 24px 0 24px;
}

.history-search input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--background-white);
}

.history-search input:focus {
    outline: none;
    border-color: var(--primary-orange);
}

.history-search input::placeholder {
    color: var(--text-light);
}

.history-content {
    padding: 24px;
    max-height: 600px;
    overflow-y: auto;
}

#emptyHistory,
#noSearchResults {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-gray);
}

#emptyHistory .empty-icon,
#noSearchResults .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.history-item {
    background: var(--background-white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: var(--transition);
}

.history-item:hover {
    border-color: var(--primary-orange-light);
    box-shadow: var(--shadow-sm);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.history-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-date {
    font-size: 14px;
    color: var(--text-light);
}

.history-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.history-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.history-badge.type-ready {
    background: #E8F5E9;
    color: #2E7D32;
}

.history-badge.type-snack {
    background: #E3F2FD;
    color: #1565C0;
}

.history-badge.type-ingredients {
    background: #FFF3E0;
    color: #E65100;
}

.history-badge.leftover {
    background: #E3F2FD;
    color: #1976D2;
}

.history-badge.cooked {
    background: #F3E5F5;
    color: #7B1FA2;
}

.history-badge.rating {
    background: #FFF9C4;
    color: #F57F17;
    border: 1px solid #FFF176;
}

.history-review {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.review-stars {
    font-size: 20px;
    margin-bottom: 8px;
    line-height: 1;
}

.review-description {
    font-size: 14px;
    color: var(--text-gray);
    line-height: 1.6;
    margin: 0 0 12px 0;
    text-align: left;
    font-style: italic;
}

.btn-review-edit,
.btn-review-add {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

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

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

.btn-review-add {
    background: rgba(255, 107, 0, 0.1);
    color: var(--primary-orange);
    border: 1px dashed var(--primary-orange);
}

.btn-review-add:hover {
    background: rgba(255, 107, 0, 0.15);
    border-style: solid;
}

.history-review-empty {
    border-top: 1px dashed var(--border-color);
}

/* Products View */
.product-item {
    background: var(--background-white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.product-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-orange);
    transform: scaleX(0);
    transition: var(--transition);
}

.product-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-item:hover::before {
    transform: scaleX(1);
}

/* Product Details Modal */
.product-details-content {
    padding: 24px;
}

.product-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--background-light);
    border-radius: 8px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-gray);
    font-weight: 500;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.product-notes-section {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--background-light);
    border-radius: 8px;
}

.product-notes-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.product-notes-section p {
    font-size: 14px;
    color: var(--text-gray);
    line-height: 1.6;
}

.product-reviews-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.product-review-item {
    padding: 16px;
    background: var(--background-light);
    border-radius: 8px;
    margin-bottom: 12px;
}

.product-review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.product-review-date {
    font-size: 13px;
    color: var(--text-light);
}

.product-review-stars {
    font-size: 16px;
    color: var(--primary-orange);
}

.product-review-description {
    font-size: 14px;
    color: var(--text-gray);
    line-height: 1.6;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section h2 {
        font-size: 28px;
    }

    .subtitle {
        font-size: 16px;
    }

    .food-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions button {
        width: 100%;
    }

    .type-selector {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .type-btn {
        flex-direction: row;
        justify-content: flex-start;
        padding: 16px;
        min-height: auto;
    }

    .type-btn-icon {
        font-size: 28px;
    }

    .type-btn-label {
        font-size: 14px;
        text-align: left;
    }

    .filters-section {
        padding: 16px;
        gap: 16px;
        flex-direction: column;
        align-items: stretch;
    }

    .filters-left,
    .filters-right {
        width: 100%;
    }

    .filters-left {
        flex-direction: column;
        gap: 16px;
    }

    .filters-group {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 8px;
    }

    .type-filters,
    .status-filters {
        width: 100%;
    }

    .filter-chip {
        flex: 1;
        justify-content: center;
    }

    .sort-select {
        width: 100%;
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Autocomplete */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--background-white);
    border: 2px solid var(--primary-orange);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    display: none;
}

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background: rgba(255, 107, 0, 0.1);
}

.autocomplete-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.autocomplete-type {
    font-size: 13px;
    color: var(--text-gray);
    margin-bottom: 4px;
}

.autocomplete-stats {
    font-size: 12px;
    color: var(--text-light);
    font-style: italic;
}

.autocomplete-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-gray);
    font-size: 14px;
}
