/* Shop Mall - Main Styles */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap');

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

:root {
  --primary: #2d3436;
  --accent: #00b894;
  --accent-dark: #00a884;
  --highlight: #e17055;
  --bg: #f8f9fa;
  --card-bg: #ffffff;
  --text-primary: #2d3436;
  --text-secondary: #636e72;
  --border: #dfe6e9;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-sm: 4px;
  --transition: 0.3s ease;
}

body {
  font-family: 'Noto Sans SC', sans-serif;
  background-color: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
}

/* Header & Navigation */
header {
  background: var(--card-bg);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.logo {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cart-icon {
  position: relative;
  cursor: pointer;
  padding: 8px;
}

.cart-icon svg {
  width: 24px;
  height: 24px;
  fill: var(--text-secondary);
  transition: var(--transition);
}

.cart-icon:hover svg {
  fill: var(--accent);
}

.cart-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--highlight);
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.user-menu {
  display: flex;
  gap: 12px;
  align-items: center;
}

.user-menu .btn {
  padding: 8px 16px;
  font-size: 14px;
}

/* Main Content */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Page Title */
.page-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--primary);
}

/* Filters */
.filters {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.category-tab {
  padding: 8px 20px;
  border: none;
  background: var(--card-bg);
  color: var(--text-secondary);
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  border: 1px solid var(--border);
}

.category-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.category-tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.sort-select {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--card-bg);
  cursor: pointer;
  min-width: 140px;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

/* Product Card */
.product-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
}

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

.product-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #f0f0f0;
}

.product-info {
  padding: 16px;
}

.product-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.product-price::before {
  content: '¥';
  font-size: 14px;
  font-weight: 500;
}

.add-cart-btn {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.add-cart-btn:hover {
  background: var(--accent-dark);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  border: none;
}

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

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

.btn-secondary {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 18px;
}

/* Auth Pages */
.auth-container {
  max-width: 420px;
  margin: 60px auto;
  padding: 40px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-title {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 32px;
  color: var(--primary);
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.1);
}

.form-group .error {
  color: var(--highlight);
  font-size: 13px;
  margin-top: 6px;
}

.form-footer {
  text-align: center;
  margin-top: 24px;
  color: var(--text-secondary);
}

.form-footer a {
  color: var(--accent);
  text-decoration: none;
}

.form-footer a:hover {
  text-decoration: underline;
}

/* Cart Page */
.cart-container {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
}

.cart-items {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.cart-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

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

.cart-item-image {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #f0f0f0;
}

.cart-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cart-item-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
}

.cart-item-price {
  color: var(--accent);
  font-weight: 600;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.qty-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.qty-value {
  font-size: 16px;
  font-weight: 500;
  min-width: 32px;
  text-align: center;
}

.remove-btn {
  background: none;
  border: none;
  color: var(--highlight);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
}

.remove-btn:hover {
  text-decoration: underline;
}

.cart-summary {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  height: fit-content;
  position: sticky;
  top: 100px;
}

.cart-summary h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.summary-total {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.cart-summary .btn {
  width: 100%;
  margin-top: 20px;
}

.empty-cart {
  text-align: center;
  padding: 60px 20px;
}

.empty-cart svg {
  width: 80px;
  height: 80px;
  fill: var(--text-secondary);
  opacity: 0.5;
  margin-bottom: 16px;
}

.empty-cart p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Checkout Page */
.checkout-container {
  max-width: 600px;
  margin: 0 auto;
}

.checkout-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.checkout-success {
  text-align: center;
  padding: 40px;
}

.checkout-success svg {
  width: 64px;
  height: 64px;
  fill: var(--accent);
  margin-bottom: 16px;
}

.checkout-success h2 {
  color: var(--primary);
  margin-bottom: 8px;
}

.checkout-success p {
  color: var(--text-secondary);
}

/* Product Detail Page */
.product-detail-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.product-detail-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: #f0f0f0;
}

.product-detail-info h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--primary);
}

.product-detail-price {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 20px;
}

.product-detail-price::before {
  content: '¥';
  font-size: 20px;
}

.product-detail-desc {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 24px;
}

.product-stock {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.product-stock.in-stock {
  color: var(--accent);
}

.quantity-selector {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.quantity-selector label {
  font-weight: 500;
}

.quantity-selector .qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-actions {
  display: flex;
  gap: 16px;
}

.detail-actions .btn {
  flex: 1;
}

/* Profile Page */
.profile-container {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 32px;
}

.profile-sidebar {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  height: fit-content;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 32px;
  font-weight: 700;
  margin: 0 auto 16px;
}

.profile-name {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.profile-email {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

.profile-tier {
  text-align: center;
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  margin: 0 auto;
  display: block;
  width: fit-content;
}

.profile-tier.normal {
  background: #dfe6e9;
  color: var(--text-secondary);
}

.profile-tier.silver {
  background: linear-gradient(135deg, #b2bec3, #dfe6e9);
  color: #636e72;
}

.profile-tier.gold {
  background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
  color: #d63031;
}

.profile-content {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.profile-section {
  margin-bottom: 32px;
}

.profile-section:last-child {
  margin-bottom: 0;
}

.profile-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* Orders */
.order-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.order-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.order-id {
  font-weight: 600;
  color: var(--primary);
}

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

.order-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.order-status.pending {
  background: #ffeaa7;
  color: #d63031;
}

.order-status.paid {
  background: #55efc4;
  color: #00b894;
}

.order-status.shipped {
  background: #74b9ff;
  color: #0984e3;
}

.order-status.completed {
  background: #dfe6e9;
  color: #636e72;
}

.order-items {
  margin-bottom: 12px;
}

.order-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

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

.order-item-name {
  flex: 1;
  color: var(--text-secondary);
}

.order-item-qty {
  color: var(--text-secondary);
}

.order-item-price {
  font-weight: 500;
}

.order-total {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  text-align: right;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--primary);
  color: white;
  padding: 16px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--accent);
}

.toast.error {
  background: var(--highlight);
}

/* Footer */
footer {
  background: var(--primary);
  color: white;
  padding: 40px 24px;
  margin-top: 60px;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-content p {
  opacity: 0.7;
  font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .nav-container {
    flex-wrap: wrap;
  }
  
  .nav-links {
    order: 3;
    width: 100%;
    justify-content: center;
    padding-top: 16px;
    border-top: 1px solid var(--border);
  }
  
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .cart-container {
    grid-template-columns: 1fr;
  }
  
  .cart-summary {
    position: static;
  }
  
  .product-detail-container {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .profile-container {
    grid-template-columns: 1fr;
  }
  
  .profile-sidebar {
    text-align: center;
  }
}

/* Auth Required Message */
.auth-required {
  text-align: center;
  padding: 60px 20px;
}

.auth-required svg {
  width: 64px;
  height: 64px;
  fill: var(--text-secondary);
  opacity: 0.5;
  margin-bottom: 16px;
}

.auth-required h3 {
  color: var(--primary);
  margin-bottom: 8px;
}

.auth-required p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Loading */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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

/* Modal */
.modal {
  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;
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal textarea {
  resize: vertical;
  min-height: 100px;
}

/* Notice */
.notice-bar {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.notice-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.notice-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.notice-icon.info {
  fill: var(--accent);
}

.notice-icon.warning {
  fill: #fdcb6e;
}

.notice-icon.error {
  fill: var(--highlight);
}

.notice-content {
  flex: 1;
}

.notice-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.notice-text {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Ticket Card */
.ticket-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ticket-id {
  font-weight: 600;
  color: var(--primary);
}

.ticket-type {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.ticket-subject {
  font-weight: 500;
  margin-bottom: 8px;
}

.ticket-content {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}

.ticket-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.ticket-status.pending {
  background: #ffeaa7;
  color: #d63031;
}

.ticket-status.processing {
  background: #74b9ff;
  color: #0984e3;
}

.ticket-status.resolved {
  background: #55efc4;
  color: #00b894;
}

.ticket-reply {
  margin-top: 12px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.ticket-reply-label {
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 4px;
}