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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #F5F5F5;
    min-height: 100vh;
    padding-bottom: 60px;
}

/* 页面容器 */
.page {
    display: none;
    padding: 16px;
}

.page.active {
    display: block;
}

/* 导航栏 */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background-color: #22C55E;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
}

.back-btn, .save-btn, .settings-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
}

.save-btn {
    font-size: 16px;
    font-weight: 500;
}

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

/* 统计卡片 */
.stats-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    flex: 1;
    background-color: white;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stat-card.warning {
    background-color: #FEF3C7;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1F2937;
}

.stat-card.warning .stat-value {
    color: #D97706;
}

.stat-label {
    font-size: 12px;
    color: #6B7280;
    margin-top: 4px;
}

/* 过期提醒横幅 */
.expiry-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background-color: #FEF2F2;
    border-radius: 8px;
    margin-bottom: 16px;
    color: #EF4444;
    cursor: pointer;
}

.expiry-banner i {
    font-size: 16px;
}

/* 单位切换 */
.unit-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #6B7280;
}

.unit-btn {
    padding: 4px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    background-color: white;
    font-size: 12px;
    color: #6B7280;
    cursor: pointer;
}

.unit-btn.active {
    background-color: #22C55E;
    color: white;
    border-color: #22C55E;
}

/* 状态标签 */
.status-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.status-tab {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background-color: white;
    font-size: 14px;
    color: #6B7280;
    cursor: pointer;
}

.status-tab.active {
    background-color: #22C55E;
    color: white;
}

/* 商品列表 */
.product-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product-card {
    background-color: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    cursor: pointer;
}

.product-card:hover {
    background-color: #FAFAFA;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 4px;
}

.product-info {
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 8px;
}

.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.tag.main {
    background-color: #DBEAFE;
    color: #1D4ED8;
}

.tag.sub {
    background-color: #F3E8FF;
    color: #7C3AED;
}

.tag.status {
    background-color: #D1FAE5;
    color: #059669;
}

.product-expiry {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.expiry-countdown {
    font-size: 14px;
    font-weight: 500;
}

.expiry-countdown.expired, .expiry-countdown.urgent {
    color: #EF4444;
}

.expiry-countdown.warning {
    color: #F97316;
}

.expiry-countdown.normal {
    color: #22C55E;
}

.expiry-date {
    font-size: 12px;
    color: #9CA3AF;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    color: #9CA3AF;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 16px;
}

.empty-state button {
    padding: 10px 24px;
    background-color: #22C55E;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

/* 图片上传区 */
.image-section {
    margin-bottom: 24px;
}

.image-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 1px dashed #D1D5DB;
    border-radius: 8px;
    background-color: white;
    color: #6B7280;
    font-size: 14px;
    cursor: pointer;
}

.carousel-container {
    margin-bottom: 12px;
}

.image-carousel {
    height: 200px;
    background-color: #F3F4F6;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.carousel-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9CA3AF;
}

.carousel-placeholder i {
    font-size: 32px;
    margin-bottom: 8px;
}

.carousel-placeholder p {
    font-size: 13px;
}

.thumbnails {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px;
}

.thumbnail {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid transparent;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: white;
}

.thumbnail.active {
    border-color: #22C55E;
}

.delete-icon {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    cursor: pointer;
}

.ocr-btn {
    width: 100%;
    padding: 12px;
    background-color: #F3F4F6;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* 表单样式 */
.form-section {
    margin-bottom: 24px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    color: #374151;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
}

.input-group {
    position: relative;
}

.input-group input {
    padding-right: 100px;
}

.ocr-tag {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px 8px;
    background-color: #ECFDF5;
    color: #059669;
    font-size: 11px;
    border-radius: 4px;
    pointer-events: none;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group.half {
    flex: 1;
}

/* 日期模式切换 */
.date-mode-switch {
    margin-bottom: 16px;
}

.date-mode-switch h4 {
    font-size: 13px;
    color: #374151;
    margin-bottom: 8px;
}

.mode-tabs {
    display: flex;
    gap: 6px;
}

.mode-tab {
    flex: 1;
    padding: 8px 6px;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    background-color: #fff;
    font-size: 11px;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-tab.active {
    background-color: #22C55E;
    color: white;
    border-color: #22C55E;
}

/* 日期模式内容 */
.date-mode {
    display: none;
}

.date-mode.active {
    display: block;
}

/* 计算结果显示 */
.expiry-result {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background-color: #ECFDF5;
    border-radius: 8px;
    margin-top: 12px;
    color: #059669;
    font-size: 14px;
}

/* 分类选择 */
.category-section {
    margin-bottom: 24px;
}

.category-section h4 {
    font-size: 13px;
    color: #374151;
    margin-bottom: 12px;
}

.main-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.category-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    background-color: white;
    font-size: 14px;
    color: #6B7280;
    cursor: pointer;
}

.category-btn.active {
    background-color: #22C55E;
    color: white;
    border-color: #22C55E;
}

.sub-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sub-category-btn {
    padding: 6px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    background-color: white;
    font-size: 12px;
    color: #6B7280;
    cursor: pointer;
}

.sub-category-btn.selected {
    background-color: #F3E8FF;
    color: #7C3AED;
    border-color: #7C3AED;
}

/* 使用状态 */
.status-section {
    margin-bottom: 24px;
}

.status-section h4 {
    font-size: 13px;
    color: #374151;
    margin-bottom: 12px;
}

.status-options {
    display: flex;
    gap: 16px;
}

.status-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

.status-option input {
    width: 18px;
    height: 18px;
}

/* 提醒设置 */
.reminder-section {
    margin-bottom: 24px;
}

.reminder-section h4 {
    font-size: 13px;
    color: #374151;
    margin-bottom: 12px;
}

.reminder-options {
    display: flex;
    gap: 8px;
}

.reminder-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    background-color: white;
    font-size: 12px;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reminder-btn.active {
    background-color: #FEF3C7;
    color: #D97706;
    border-color: #F59E0B;
}

/* 搜索栏 */
.search-section {
    position: relative;
    margin-bottom: 16px;
}

.search-section input {
    width: 100%;
    padding: 12px 40px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    background-color: white;
}

.search-section i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
}

/* 筛选器 */
.filter-section {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.filter-section select {
    flex: 1;
    padding: 10px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
}

/* 商品卡片操作按钮 */
.product-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.product-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.product-actions .edit-btn {
    background-color: #F3F4F6;
    color: #374151;
}

.product-actions .delete-btn {
    background-color: #FEF2F2;
    color: #EF4444;
}

/* 分类管理页 */
.category-management, .status-management {
    margin-bottom: 24px;
}

.category-management h3, .status-management h3 {
    font-size: 14px;
    color: #374151;
    margin-bottom: 12px;
}

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

.add-main-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background-color: #22C55E;
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
}

.main-category-list {
    margin-bottom: 12px;
}

.main-category-card {
    background-color: #fff;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.main-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    cursor: pointer;
}

.main-category-header:hover {
    background-color: #FAFAFA;
}

.main-category-name {
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
}

.main-category-header i {
    color: #9CA3AF;
    font-size: 14px;
    transition: transform 0.3s;
}

.main-category-header.expanded i {
    transform: rotate(90deg);
}

.main-category-info {
    padding: 0 16px 12px;
    font-size: 12px;
    color: #6B7280;
}

.main-category-actions {
    display: flex;
    gap: 8px;
    padding: 0 16px 16px;
}

.main-category-actions button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.main-category-actions .edit-action {
    background-color: #F3F4F6;
    color: #374151;
}

.main-category-actions .add-sub-action {
    background-color: #22C55E;
    color: white;
}

.main-category-actions .delete-action {
    background-color: #FEF2F2;
    color: #EF4444;
}

/* 子类列表 */
.sub-category-list {
    background-color: #F9FAFB;
    padding: 8px 16px;
}

.sub-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin-bottom: 4px;
    background-color: #fff;
    border-radius: 8px;
}

.sub-category-item:last-child {
    margin-bottom: 0;
}

.sub-category-name {
    font-size: 13px;
    color: #374151;
}

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

.sub-category-actions button {
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: 12px;
    cursor: pointer;
}

.sub-category-actions .delete-btn:hover {
    color: #EF4444;
}

/* 状态管理 */
.status-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: #fff;
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.status-tag {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    color: white;
}

.status-tag.blue {
    background-color: #60A5FA;
}

.status-tag.purple {
    background-color: #A78BFA;
}

.status-card span {
    font-size: 13px;
    color: #6B7280;
}

/* 底部导航 */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background-color: white;
    border-top: 1px solid #E5E7EB;
    padding: 8px 0;
    z-index: 100;
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px;
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: 10px;
    cursor: pointer;
}

.tab-btn i {
    font-size: 20px;
}

.tab-btn.active {
    color: #22C55E;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
}

/* 弹窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background-color: white;
    border-radius: 12px;
    padding: 24px;
    width: 80%;
    max-width: 320px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-body input {
    width: 100%;
    padding: 12px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

.modal-actions .cancel-btn {
    background-color: #F3F4F6;
    color: #374151;
}

.modal-actions .confirm-btn {
    background-color: #22C55E;
    color: white;
}

/* 新模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    width: 90%;
    max-width: 360px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #9CA3AF;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #E5E7EB;
}

.modal-footer .btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

.modal-footer .btn-primary {
    background-color: #22C55E;
    color: white;
}

.modal-footer .btn-secondary {
    background-color: #F3F4F6;
    color: #374151;
}

/* 分类区域头部 */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-header h4 {
    margin: 0;
}

.add-category-btn {
    padding: 6px 12px;
    background-color: #22C55E;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

/* 单选框样式 */
.radio-group {
    display: flex;
    gap: 16px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    margin: 0;
}