/* ======================================
   商城前端 - 移动端公共样式 v1
   ====================================== */

/* ===== Reset ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    color: #333333;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }
input, textarea, select, button { font-family: inherit; }

/* ===== Header ===== */
.header {
    background-color: #e53935;
    color: white;
    padding: 15px;
    text-align: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(229, 57, 53, 0.3);
}
.header h1 { font-size: 18px; }
.header .back-btn {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    text-decoration: none;
    font-size: 16px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px;
}
.header .header-right {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 12px;
}
.header .header-right a,
.header .header-right span {
    color: white;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
}

/* ===== Main Content ===== */
.main-content {
    padding: 75px 15px 80px;
}
.main-content-no-bottom {
    padding: 75px 15px 20px;
}

/* ===== Messages ===== */
.messages {
    position: fixed;
    top: 70px;
    left: 10px;
    right: 10px;
    z-index: 1001;
}
.message {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    font-size: 14px;
}
.message.success {
    background-color: #ffffff;
    color: #e53935;
    border: 1px solid #e53935;
    box-shadow: 0 2px 8px rgba(184, 134, 11, 0.3);
}
.message.error {
    background-color: #ffffff;
    color: #f44336;
    border: 1px solid #f44336;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
}
.message.info {
    background-color: #ffffff;
    color: #1976d2;
    border: 1px solid #1976d2;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
}
.message.warning {
    background-color: #ffffff;
    color: #f57c00;
    border: 1px solid #f57c00;
    box-shadow: 0 2px 8px rgba(245, 124, 0, 0.3);
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background-color: #e53935;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    text-decoration: none;
}
.btn:hover {
    background-color: #c62828;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.btn-secondary {
    background-color: #757575;
    color: white;
}
.btn-secondary:hover {
    background-color: #616161;
}
.btn-outline {
    background-color: transparent;
    color: #e53935;
    border: 1px solid #e53935;
}
.btn-outline:hover {
    background-color: #e53935;
    color: white;
}
.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}
.btn-block {
    display: block;
    width: 100%;
}
.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Card ===== */
.card {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border: 1px solid #e0e0e0;
}
.card-header {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}
.card-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

/* ===== Form ===== */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #666666;
    font-weight: bold;
    font-size: 14px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background-color: #fff;
    color: #333;
    transition: border-color 0.3s ease;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #e53935;
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.1);
}

/* ===== Table (简洁表格) ===== */
.table-responsive {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
table th, table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}
table th {
    background-color: #fafafa;
    color: #666;
    font-weight: bold;
    font-size: 13px;
}
table tbody tr:hover {
    background-color: #fafafa;
}

/* ===== Bottom Navigation ===== */
.footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #ffffff;
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e0e0e0;
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}
.footer-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #999999;
    text-decoration: none;
    font-size: 11px;
    transition: color 0.3s ease;
    min-width: 50px;
}
.footer-nav a i {
    font-size: 22px;
    margin-bottom: 3px;
    font-style: normal;
}
.footer-nav a.active {
    color: #e53935;
}

/* ===== Badge ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    background-color: #e53935;
}

/* ===== Status Tags ===== */
.status-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.status-pending { background-color: #fff3e0; color: #e65100; }
.status-paid { background-color: #e8f5e9; color: #2e7d32; }
.status-shipped { background-color: #e3f2fd; color: #1565c0; }
.status-completed { background-color: #e8f5e9; color: #2e7d32; }
.status-canceled { background-color: #ffebee; color: #c62828; }

/* ===== Loading ===== */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}
.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 8px;
    border: 2px solid #e0e0e0;
    border-top-color: #e53935;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #b0b0b0;
}
.empty-state .empty-icon {
    font-size: 60px;
    display: block;
    margin-bottom: 20px;
    opacity: 0.3;
}
.empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* ===== Flexbox Utilities ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-10 { gap: 10px; }
.gap-15 { gap: 15px; }
.flex-1 { flex: 1; }

/* ===== Spacing ===== */
.mt-header { margin-top: 55px; }
.mt-5 { margin-top: 5px; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.p-15 { padding: 15px; }
.p-20 { padding: 20px; }

/* ===== Text ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #999999; }
.text-danger { color: #e53935; }
.text-success { color: #2e7d32; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.font-bold { font-weight: bold; }

/* ===== Grid ===== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

/* ===== Divider ===== */
.divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 15px 0;
}

/* ===== Search Bar ===== */
.search-bar {
    padding: 0 15px 15px;
}
.search-bar input {
    width: 100%;
    padding: 12px 15px;
    margin: 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background-color: #fff;
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}
.search-bar input:focus {
    outline: none;
    border-color: #e53935;
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.15);
}
.search-bar input::placeholder {
    color: #999;
}

/* ===== Product Grid (首页商品网格) ===== */
.product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 15px;
}
.product-item {
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}
.product-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.product-item a {
    text-decoration: none;
    color: #333333;
    display: block;
}
.product-image {
    width: 100%;
    padding-top: 100%;
    background-color: #ffffff;
    position: relative;
    overflow: hidden;
}
.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.product-info {
    padding: 10px;
}
.product-name {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: #333333;
}
.product-price {
    font-size: 16px;
    color: #e53935;
    font-weight: bold;
}
.product-meta {
    font-size: 12px;
    color: #999999;
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
}

/* ===== Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.modal h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #333;
}

/* ===== Confirm Modal ===== */
.confirm-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.confirm-modal.active { display: flex; }
.confirm-box {
    background: #fff;
    border-radius: 12px;
    padding: 30px 25px 20px;
    width: 300px;
    max-width: 85%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    text-align: center;
}
.confirm-box .confirm-icon {
    font-size: 40px;
    margin-bottom: 12px;
}
.confirm-box .confirm-text {
    font-size: 15px;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.5;
}
.confirm-box .confirm-actions {
    display: flex;
    gap: 10px;
}
.confirm-box .confirm-btn {
    flex: 1;
    padding: 12px;
    background-color: #e53935;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}
.confirm-box .cancel-btn {
    flex: 1;
    padding: 12px;
    background-color: #f5f5f5;
    color: #666;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
}
