/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
}

a {
  text-decoration: none;
  color: #007bff;
}

a:hover {
  color: #0056b3;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
}

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

.btn {
  display: inline-block;
  padding: 8px 16px;
  background-color: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.btn:hover {
  background-color: #0056b3;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.875rem;
}

.btn-danger {
  background-color: #dc3545;
}

.btn-danger:hover {
  background-color: #bd2130;
}

.btn-success {
  background-color: #28a745;
}

.btn-success:hover {
  background-color: #218838;
}

.btn-warning {
  background-color: #ffc107;
  color: #212529;
}

.btn-warning:hover {
  background-color: #e0a800;
}

.btn-edit {
  background-color: #17a2b8;
}

.btn-edit:hover {
  background-color: #138496;
}

.btn-delete {
  background-color: #dc3545;
}

.btn-delete:hover {
  background-color: #bd2130;
}

.form-group {
  margin-bottom: 1rem;
}

.form-control {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 1rem;
  line-height: 1.5;
  color: #495057;
  background-color: #fff;
  border: 1px solid #ced4da;
  border-radius: 4px;
  transition: border-color 0.3s;
}

.form-control:focus {
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-3 {
  margin-top: 1rem;
}

.mb-3 {
  margin-bottom: 1rem;
}

.p-3 {
  padding: 1rem;
}

/* 导航栏 */
.navbar {
  background-color: #343a40;
  color: #fff;
  padding: 1rem 0;
}

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

.navbar-brand {
  font-size: 1.5rem;
  font-weight: bold;
  color: #fff;
}

.navbar-nav {
  display: flex;
}

.nav-item {
  margin-left: 1.5rem;
}

.nav-link {
  color: #fff;
  transition: color 0.3s;
}

.nav-link:hover {
  color: #f8f9fa;
}

.nav-link.active {
  color: #ffc107;
}

/* 首页样式 */
.hero {
  background-color: #007bff;
  color: #fff;
  padding: 3rem 0;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.categories {
  margin-bottom: 2rem;
}

.category-list {
  display: flex;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.category-item {
  padding: 0.5rem 1rem;
  margin-right: 0.5rem;
  background-color: #f1f1f1;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.3s;
}

.category-item:hover,
.category-item.active {
  background-color: #007bff;
  color: #fff;
}

.products {
  margin-bottom: 2rem;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.product-card {
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-image {
  height: 200px;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.product-card:hover .product-image img {
  transform: scale(1.05);
}

.product-info {
  padding: 1rem;
}

.product-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.product-price {
  font-size: 1.125rem;
  color: #dc3545;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.product-stock {
  font-size: 0.875rem;
  color: #6c757d;
  margin-bottom: 1rem;
}

.product-actions {
  display: flex;
  justify-content: space-between;
}

/* 订单列表 */
.orders {
  margin-bottom: 2rem;
}

.order-list {
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.order-item {
  padding: 1rem;
  border-bottom: 1px solid #e9ecef;
}

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

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

.order-id {
  font-weight: 600;
}

.order-date {
  color: #6c757d;
  font-size: 0.875rem;
}

.order-product {
  display: flex;
  margin-bottom: 0.5rem;
}

.order-product-image {
  width: 60px;
  height: 60px;
  margin-right: 1rem;
}

.order-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.order-product-info {
  flex: 1;
}

.order-product-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.order-product-price {
  color: #dc3545;
}

.order-total {
  font-weight: 600;
  text-align: right;
  margin-bottom: 0.5rem;
}

.order-status {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.875rem;
}

.status-pending {
  background-color: #ffc107;
  color: #212529;
}

.status-paid {
  background-color: #28a745;
  color: #fff;
}

.status-cancelled {
  background-color: #dc3545;
  color: #fff;
}

.status-resolved {
  background-color: #28a745;
  color: #fff;
}

/* 消息列表 */
.messages {
  margin-bottom: 2rem;
}

.message-list {
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.message-item {
  padding: 1rem;
  border-bottom: 1px solid #e9ecef;
}

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

.message-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.message-date {
  color: #6c757d;
  font-size: 0.875rem;
}

.message-content {
  margin-bottom: 0.5rem;
}

.message-reply {
  background-color: #f8f9fa;
  padding: 0.5rem;
  border-radius: 4px;
  margin-top: 0.5rem;
}

.message-reply-header {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

/* 购物车 */
.cart {
  position: fixed;
  top: 0;
  right: -300px;
  width: 300px;
  height: 100%;
  background-color: #fff;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  transition: right 0.3s;
  z-index: 1000;
}

.cart.open {
  right: 0;
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #e9ecef;
}

.cart-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.cart-close {
  cursor: pointer;
  font-size: 1.5rem;
}

.cart-items {
  max-height: calc(100% - 180px);
  overflow-y: auto;
  padding: 1rem;
}

.cart-item {
  display: flex;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e9ecef;
}

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

.cart-item-image {
  width: 60px;
  height: 60px;
  margin-right: 1rem;
}

.cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.cart-item-price {
  color: #dc3545;
  margin-bottom: 0.25rem;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
}

.cart-item-quantity button {
  width: 24px;
  height: 24px;
  background-color: #f1f1f1;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.cart-item-quantity span {
  margin: 0 0.5rem;
}

.cart-item-remove {
  color: #dc3545;
  cursor: pointer;
  margin-left: auto;
}

.cart-footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 1rem;
  border-top: 1px solid #e9ecef;
  background-color: #fff;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-weight: 600;
}

.cart-checkout {
  width: 100%;
}

/* 页脚 */
.footer {
  background-color: #343a40;
  color: #fff;
  padding: 2rem 0;
  margin-top: 2rem;
}

.footer-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.footer-section h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: #adb5bd;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: #fff;
}

.footer-bottom {
  margin-top: 2rem;
  text-align: center;
  color: #adb5bd;
  font-size: 0.875rem;
}

/* 模态框 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1001;
}

.modal-content {
  position: relative;
  background-color: #fff;
  margin: 10% auto;
  padding: 1.5rem;
  width: 90%;
  max-width: 600px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-header {
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 600;
}

.modal-body {
  margin-bottom: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.modal-footer button {
  margin-left: 0.5rem;
}

/* 产品详情模态框 */
.product-detail {
  display: flex;
  flex-wrap: wrap;
}

.product-detail-image {
  flex: 0 0 40%;
  max-width: 40%;
  padding-right: 1.5rem;
}

.product-detail-image img {
  width: 100%;
  border-radius: 8px;
}

.product-detail-info {
  flex: 0 0 60%;
  max-width: 60%;
}

.product-detail-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.product-detail-price {
  font-size: 1.25rem;
  color: #dc3545;
  margin-bottom: 1rem;
  font-weight: 600;
}

.product-detail-description {
  margin-bottom: 1.5rem;
}

.product-detail-stock {
  margin-bottom: 1rem;
  color: #6c757d;
}

.product-detail-quantity {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}

.product-detail-quantity button {
  width: 32px;
  height: 32px;
  background-color: #f1f1f1;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.product-detail-quantity span {
  margin: 0 1rem;
  font-size: 1.125rem;
}

/* 订单确认模态框 */
.order-confirm-product {
  display: flex;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e9ecef;
}

.order-confirm-image {
  width: 80px;
  height: 80px;
  margin-right: 1rem;
}

.order-confirm-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.order-confirm-info {
  flex: 1;
}

.order-confirm-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.order-confirm-price {
  color: #dc3545;
  margin-bottom: 0.25rem;
}

.order-confirm-quantity {
  color: #6c757d;
}

.order-confirm-total {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: right;
  margin-bottom: 1.5rem;
}

/* 登录/注册模态框 */
.auth-tabs {
  display: flex;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #e9ecef;
}

.auth-tab {
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.auth-tab.active {
  border-bottom-color: #007bff;
  color: #007bff;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

/* 提示框 */
.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 0.75rem 1.5rem;
  background-color: #343a40;
  color: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 1002;
}

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

.toast.success {
  background-color: #28a745;
}

.toast.error {
  background-color: #dc3545;
}

.toast.warning {
  background-color: #ffc107;
  color: #212529;
}

/* 管理后台样式 */
.admin-container {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 250px;
  background-color: #343a40;
  color: #fff;
  padding: 1.5rem 0;
  position: fixed;
  height: 100%;
  overflow-y: auto;
}

.admin-logo {
  padding: 0 1.5rem;
  margin-bottom: 2rem;
  font-size: 1.5rem;
  font-weight: bold;
}

.admin-nav {
  margin-bottom: 2rem;
}

.admin-nav a {
  display: block;
  padding: 0.75rem 1.5rem;
  color: #adb5bd;
  transition: background-color 0.3s, color 0.3s;
}

.admin-nav a:hover,
.admin-nav a.active {
  background-color: #495057;
  color: #fff;
}

.admin-nav a i {
  margin-right: 0.5rem;
  width: 20px;
  text-align: center;
}

.admin-main {
  flex: 1;
  margin-left: 250px;
  padding: 1.5rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e9ecef;
}

.admin-title {
  font-size: 1.5rem;
  font-weight: 600;
}

.admin-user {
  display: flex;
  align-items: center;
}

.admin-user-name {
  margin-right: 1rem;
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

.admin-card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.admin-card-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.admin-stat-card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  text-align: center;
}

.admin-stat-value {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.admin-stat-label {
  color: #6c757d;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
}

.admin-table th {
  background-color: #f8f9fa;
  font-weight: 600;
}

.admin-table tr:hover {
  background-color: #f8f9fa;
}

.admin-table .no-data {
  text-align: center;
  padding: 2rem;
  color: #6c757d;
}

.admin-search {
  display: flex;
  margin-bottom: 1.5rem;
}

.admin-search input {
  flex: 1;
  margin-right: 0.5rem;
}

.admin-filters {
  display: flex;
  margin-bottom: 1.5rem;
}

.admin-filters select {
  margin-right: 0.5rem;
}

.product-thumbnail {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.media-card {
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.media-image {
  height: 150px;
  overflow: hidden;
}

.media-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-info {
  padding: 1rem;
}

.media-info h4 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.media-info p {
  font-size: 0.875rem;
  color: #6c757d;
  margin-bottom: 0.25rem;
}

.media-actions {
  display: flex;
  padding: 0.5rem 1rem 1rem;
}

.media-actions button {
  flex: 1;
  margin: 0 0.25rem;
}

.settings-section {
  margin-bottom: 2rem;
}

.settings-section h3 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e9ecef;
}

#imagePreview,
#mediaPreview {
  margin-top: 1rem;
  max-width: 100%;
  max-height: 200px;
  overflow: hidden;
}

#imagePreview img,
#mediaPreview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 4px;
}

.message-text {
  background-color: #f8f9fa;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.order-detail {
  margin-bottom: 1.5rem;
}

.order-detail-header {
  margin-bottom: 1.5rem;
}

.order-detail-product {
  margin-bottom: 1.5rem;
}

.product-info {
  display: flex;
  margin-bottom: 1rem;
}

.product-info img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 1rem;
}

/* 管理员提示框 */
.admin-toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 0.75rem 1.5rem;
  background-color: #343a40;
  color: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 1002;
}

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

.admin-toast.success {
  background-color: #28a745;
}

.admin-toast.error {
  background-color: #dc3545;
}

.admin-toast.warning {
  background-color: #ffc107;
  color: #212529;
}

/* 响应式设计 */
@media (max-width: 992px) {
  .product-detail-image,
  .product-detail-info {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  .product-detail-image {
    margin-bottom: 1.5rem;
    padding-right: 0;
  }
  
  .admin-sidebar {
    width: 200px;
  }
  
  .admin-main {
    margin-left: 200px;
  }
}

@media (max-width: 768px) {
  .navbar-container {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .navbar-brand {
    margin-bottom: 1rem;
  }
  
  .navbar-nav {
    flex-direction: column;
  }
  
  .nav-item {
    margin-left: 0;
    margin-bottom: 0.5rem;
  }
  
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  
  .footer-container {
    grid-template-columns: 1fr;
  }
  
  .admin-container {
    flex-direction: column;
  }
  
  .admin-sidebar {
    width: 100%;
    position: static;
    height: auto;
    padding: 1rem 0;
  }
  
  .admin-main {
    margin-left: 0;
  }
  
  .admin-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    width: 95%;
    margin: 5% auto;
  }
  
  .cart {
    width: 100%;
    right: -100%;
  }
  
  .media-grid {
    grid-template-columns: 1fr;
  }
}

/* 打印样式 */
@media print {
  .navbar,
  .footer,
  .admin-sidebar,
  .admin-header,
  .admin-card-header button,
  .admin-search,
  .admin-filters,
  .admin-table button,
  .cart,
  .modal {
    display: none !important;
  }
  
  body {
    background-color: #fff;
  }
  
  .container,
  .admin-main {
    width: 100%;
    margin: 0;
    padding: 0;
  }
  
  .admin-card {
    box-shadow: none;
    border: 1px solid #e9ecef;
  }
  
  .admin-section {
    display: block !important;
  }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}