/* 擀擀好点单系统 - 样式文件 */

* {
    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;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

/* 容器 */
.container {
    max-width: 750px;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
    background-color: #fff;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, #ff9500 0%, #ff6b00 100%);
    color: #fff;
    padding: 15px 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(255, 149, 0, 0.3);
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
}

/* 优惠活动提示 */
.promotion-tip {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: #e65100;
    padding: 10px 15px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px dashed #ffcc80;
}

.promotion-tip .icon {
    font-size: 18px;
}

.promotion-tip .text {
    flex: 1;
}

.promotion-tip .text strong {
    color: #d84315;
}

/* 分类Tab */
.category-tabs {
    display: flex;
    background-color: #fafafa;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 48px;
    z-index: 99;
}

.category-tab {
    flex: 1;
    padding: 12px 10px;
    text-align: center;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.category-tab:hover {
    color: #ff9500;
}

.category-tab.active {
    color: #ff9500;
    border-bottom-color: #ff9500;
    font-weight: 600;
}

/* 商品列表 */
.product-list {
    padding: 15px;
}

.product-list.hidden {
    display: none;
}

.product-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 12px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s;
}

.product-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.product-info {
    flex: 1;
}

.product-name {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.product-price {
    font-size: 16px;
    color: #ff9500;
    font-weight: 600;
}

.product-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.qty-btn.minus {
    background-color: #f5f5f5;
    color: #999;
}

.qty-btn.minus:hover {
    background-color: #ffebee;
    color: #f44336;
}

.qty-btn.plus {
    background-color: #fff3e0;
    color: #ff9500;
}

.qty-btn.plus:hover {
    background-color: #ffe0b2;
}

.qty-input {
    width: 40px;
    height: 32px;
    border: 1px solid #eee;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    outline: none;
}

.qty-input:focus {
    border-color: #ff9500;
}

/* 底部结算栏 */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 12px 15px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 100;
}

.footer-inner {
    max-width: 750px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.cart-info {
    flex: 1;
}

.cart-qty {
    font-size: 13px;
    color: #666;
}

.cart-qty span {
    color: #ff9500;
    font-weight: 600;
}

.cart-amount {
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

.cart-amount .original {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
    font-weight: normal;
    margin-right: 5px;
}

.cart-amount .discount {
    color: #f44336;
    font-size: 13px;
    font-weight: normal;
}

.btn-clear {
    padding: 10px 15px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
}

.btn-submit {
    padding: 12px 30px;
    border: none;
    background: linear-gradient(135deg, #ff9500 0%, #ff6b00 100%);
    color: #fff;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255, 149, 0, 0.3);
}

.btn-submit:hover {
    opacity: 0.9;
}

.btn-submit:disabled {
    background: #ccc;
    box-shadow: none;
    cursor: not-allowed;
}

/* 空购物车提示 */
.empty-cart {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-cart .icon {
    font-size: 48px;
    margin-bottom: 10px;
}

/* 弹窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.2s;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 30px;
    height: 30px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 表单 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #ff9500;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 5px;
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row .form-group {
    flex: 1;
}

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #ff9500 0%, #ff6b00 100%);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-default {
    background: #f5f5f5;
    color: #666;
}

/* 表格 */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #fafafa;
    font-weight: 600;
    font-size: 13px;
    color: #666;
}

tr:hover {
    background: #fafafa;
}

/* 管理端样式 */
.admin-container {
    min-height: 100vh;
}

.admin-header {
    background: linear-gradient(135deg, #4a4a4a 0%, #333 100%);
    color: #fff;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-header h1 {
    font-size: 18px;
}

.admin-tabs {
    display: flex;
    background: #fafafa;
    border-bottom: 1px solid #eee;
}

.admin-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.admin-tab.active {
    color: #ff9500;
    border-bottom-color: #ff9500;
    font-weight: 600;
}

.admin-content {
    padding: 15px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 统计卡片 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.stat-card .label {
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
}

.stat-card .value {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.stat-card.orange .value {
    color: #ff9500;
}

.stat-card.red .value {
    color: #f44336;
}

/* 操作按钮 */
.action-btns {
    display: flex;
    gap: 5px;
}

.action-btn {
    padding: 5px 10px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.action-btn:hover {
    border-color: #ff9500;
    color: #ff9500;
}

.action-btn.delete:hover {
    border-color: #f44336;
    color: #f44336;
}

/* 登录页面 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ff9500 0%, #ff6b00 100%);
}

.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
}

/* 状态切换 */
.switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.2s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #ff9500;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* 日期选择器 */
.date-picker {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.date-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.date-btn.active {
    border-color: #ff9500;
    background: #fff3e0;
    color: #ff9500;
}

input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 10px;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: rgba(76, 175, 80, 0.9);
}

.toast.error {
    background: rgba(244, 67, 54, 0.9);
}

/* 图表容器 */
.chart-container {
    margin-top: 20px;
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

/* 优惠活动提示 */
.promotion-info {
    margin-bottom: 20px;
}

.promotion-card {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.promotion-card .name {
    font-weight: 600;
    color: #e65100;
}

.promotion-card .desc {
    font-size: 12px;
    color: #bf360c;
    margin-top: 2px;
}

.promotion-card .switch {
    transform: scale(0.8);
}

/* 响应式 */
@media (max-width: 480px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        flex-wrap: wrap;
    }

    .cart-info {
        width: 100%;
        margin-bottom: 10px;
    }
}
