/* 基础样式 */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
  box-sizing: border-box; /* 确保内边距包含在宽度内 */
}

@media (min-width: 640px) {
  .container {
    max-width: 640px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 768px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 1024px;
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }
}

/* 通用浏览器兼容性设置 */
* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* 侧边栏样式 */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 16rem;
  z-index: 30;
  overflow-y: auto;
  background-color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
  /* 滚动条样式优化 */
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: rgba(156, 163, 175, 0.5) transparent; /* Firefox */
}

/* 自定义滚动条样式 - Chrome和Safari */
#sidebar::-webkit-scrollbar {
  width: 6px;
}

#sidebar::-webkit-scrollbar-track {
  background: transparent;
}

#sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.5);
  border-radius: 3px;
}

/* 主内容区域样式 */
.sidebar-open {
  margin-left: 16rem;
  width: calc(100% - 16rem);
  position: relative;
  z-index: 5;
  -webkit-transition: margin-left 0.3s ease, width 0.3s ease;
  -moz-transition: margin-left 0.3s ease, width 0.3s ease;
  -o-transition: margin-left 0.3s ease, width 0.3s ease;
  transition: margin-left 0.3s ease, width 0.3s ease;
}

/* 确保主内容区域在小屏幕上正确显示 */
@media (max-width: 768px) {
  #sidebar {
    -webkit-transform: translateX(-100%);
    -moz-transform: translateX(-100%);
    -ms-transform: translateX(-100%);
    -o-transform: translateX(-100%);
    transform: translateX(-100%);
    -webkit-transition: transform 0.3s ease-in-out;
    -moz-transition: transform 0.3s ease-in-out;
    -o-transition: transform 0.3s ease-in-out;
    transition: transform 0.3s ease-in-out;
  }
  
  #sidebar.active {
    -webkit-transform: translateX(0);
    -moz-transform: translateX(0);
    -ms-transform: translateX(0);
    -o-transform: translateX(0);
    transform: translateX(0);
  }
  
  .sidebar-open {
    margin-left: 0;
    width: 100%;
  }
  
  /* 当侧边栏激活时的遮罩层 */
  #sidebarOverlay.active {
    display: block !important;
  }
}

/* 针对不同浏览器的修复 */
/* IE 10+ 特定修复 */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  .sidebar-open {
    margin-left: 16rem;
    width: calc(100% - 16rem);
  }
  
  @media (max-width: 768px) {
    .sidebar-open {
      margin-left: 0;
      width: 100%;
    }
  }
}

/* Safari特定修复 */
@supports (-webkit-overflow-scrolling: touch) {
  #sidebar {
    -webkit-overflow-scrolling: touch;
  }
}

/* Firefox特定修复 */
@-moz-document url-prefix() {
  #sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
  }
}

/* 移动设备特定样式，提高触摸体验 */
@media (hover: none) and (pointer: coarse) {
  #sidebar a, 
  #sidebar button {
    padding: 0.75rem 1rem; /* 增大触摸区域 */
  }
}

/* 玻璃卡片效果 */
.glass-card {
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.glass-card:hover {
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.1), 0 3px 6px rgba(0, 0, 0, 0.05);
  -webkit-transform: translateY(-2px);
  -moz-transform: translateY(-2px);
  -ms-transform: translateY(-2px);
  -o-transform: translateY(-2px);
  transform: translateY(-2px);
}

/* 对于不支持backdrop-filter的浏览器的替代方案 */
@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
  .glass-card {
    background: rgba(255, 255, 255, 0.98);
  }
}

/* 间距 */
.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}

.py-3 {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mr-2 {
  margin-right: 0.5rem;
}

.space-x-4 > * + * {
  margin-left: 1rem;
}

/* 布局 */
.flex {
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
}

.flex-1 {
  -webkit-box-flex: 1;
  -ms-flex: 1 1 0%;
  -webkit-flex: 1 1 0%;
  flex: 1 1 0%;
}

.flex-col {
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  -webkit-flex-direction: column;
  flex-direction: column;
}

.flex-shrink-0 {
  -ms-flex-negative: 0;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.items-center {
  -webkit-box-align: center;
  -ms-flex-align: center;
  -webkit-align-items: center;
  align-items: center;
}

.justify-between {
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
}

.w-64 {
  width: 16rem;
}

.h-8 {
  height: 2rem;
}

.min-h-screen {
  min-height: 100vh;
}

/* 颜色 */
.bg-white {
  background-color: white;
}

.bg-gray-100 {
  background-color: #f3f4f6;
}

.text-gray-600 {
  color: #4b5563;
}

.text-gray-800 {
  color: #1f2937;
}

.text-gray-700 {
  color: #374151;
}

.text-white {
  color: white;
}

.hover\:text-gray-900:hover {
  color: #111827;
}

.hover\:bg-gray-100:hover {
  background-color: #f3f4f6;
}

/* 边框与阴影 */
.shadow-sm {
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.shadow-md {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.border-b {
  border-bottom-width: 1px;
}

.border-transparent {
  border-color: transparent;
}

.border-l-2 {
  border-left-width: 2px;
}

.border-gray-200 {
  border-color: #e5e7eb;
}

.rounded-md {
  border-radius: 0.375rem;
}

/* 文本样式 */
.font-semibold {
  font-weight: 600;
}

.font-medium {
  font-weight: 500;
}

.text-lg {
  font-size: 1.125rem;
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-2xl {
  font-size: 1.5rem;
}

.uppercase {
  text-transform: uppercase;
}

.tracking-wider {
  letter-spacing: 0.05em;
}

/* 杂项 */
.z-10 {
  z-index: 10;
}

.overflow-y-auto {
  overflow-y: auto;
}

.whitespace-nowrap {
  white-space: nowrap;
}

.transition-colors {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

.duration-150 {
  transition-duration: 150ms;
}

/* 品牌特定样式 */
.brand-btn {
  background-color: var(--brand-color, #3b82f6);
  color: white;
}

.brand-btn:hover {
  opacity: 0.9;
}

.brand-bg-light {
  background-color: var(--brand-color-light, rgba(59, 130, 246, 0.2));
}

.brand-border {
  border-color: var(--brand-color, #3b82f6);
}

.brand-text {
  color: var(--brand-color, #3b82f6);
}

.sidebar-link.active {
  background-color: var(--brand-color-light, rgba(59, 130, 246, 0.2));
  border-left-color: var(--brand-color, #3b82f6);
}

/* 表格样式 */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th, .table td {
  padding: 0.75rem 1rem;
  text-align: left;
}

.table th {
  font-weight: 500;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.table td {
  border-bottom: 1px solid #e5e7eb;
}

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

/* 添加一些临时logo样式 */
.logo-placeholder {
  width: 100px;
  height: 40px;
  background-color: #f3f4f6;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 0.75rem;
}

/* 模态框样式 */
.modal-container {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 999;
  display: flex;
  align-items: center; /* 改回居中对齐 */
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  padding: 1rem;
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 28rem;
  margin: auto;
  background-color: #ffffff;
  border-radius: 0.75rem;
  padding: 1.5rem;
  overflow-y: auto; /* 允许内容滚动 */
  max-height: calc(100vh - 2rem); /* 限制最大高度 */
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 品牌选择区域样式 */
.brands-selection {
  height: 150px; /* 增加品牌选择区域高度 */
  min-height: 150px;
  overflow-y: scroll; /* 强制显示滚动条 */
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 0.75rem;
  margin-bottom: 1rem;
  scrollbar-width: 8px; /* 增加滚动条宽度 */
  scrollbar-color: rgba(59, 130, 246, 0.6) rgba(243, 244, 246, 0.1);
}

.brands-selection::-webkit-scrollbar {
  width: 8px;
}

.brands-selection::-webkit-scrollbar-track {
  background: rgba(243, 244, 246, 0.1);
  border-radius: 4px;
}

.brands-selection::-webkit-scrollbar-thumb {
  background-color: rgba(59, 130, 246, 0.6);
  border-radius: 4px;
  border: 1px solid rgba(243, 244, 246, 0.1);
}

/* 对于较小的屏幕 */
@media (max-height: 700px) {
  .modal-container {
    align-items: flex-start;
    padding-top: 0.5rem;
  }
  
  .modal-content {
    margin: 0.5rem auto 2rem;
    max-height: calc(100vh - 1rem);
  }
  
  .brands-selection {
    height: 100px;
    min-height: 100px;
  }
  
  /* 表单紧凑布局 */
  .modal-content .mb-3 {
    margin-bottom: 0.5rem !important;
  }
  
  .modal-content input,
  .modal-content select,
  .modal-content textarea {
    padding: 0.375rem 0.75rem !important;
  }
}

/* 图片放大功能样式 */
.clickable-image {
  transition: opacity 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.clickable-image:hover {
  transform: scale(1.02);
}

/* 图片放大模态框样式 */
#imageModal {
  z-index: 9999;
}

#imageModal .modal-container {
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(4px);
}

#imageModal .modal-content {
  background-color: transparent;
  box-shadow: none;
  padding: 0;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 0;
}

#imageModal .modal-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

#imageModal .image-caption {
  color: white;
  text-align: center;
  margin-top: 1rem;
  font-size: 1rem;
  font-weight: 500;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* 模态框导航按钮 */
.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: bold;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.modal-nav:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.modal-nav.prev {
  left: -60px;
}

.modal-nav.next {
  right: -60px;
}

/* 关闭按钮 */
.modal-close {
  position: absolute;
  top: -50px;
  right: -10px;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: bold;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.modal-close:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* 响应式设计 */
@media (max-width: 768px) {
  #imageModal .modal-content {
    max-width: 95vw;
    max-height: 95vh;
    margin: 2.5vh auto;
  }
  
  #imageModal .modal-image {
    max-height: 70vh;
  }
  
  .modal-nav {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  
  .modal-nav.prev {
    left: 10px;
  }
  
  .modal-nav.next {
    right: 10px;
  }
  
  .modal-close {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }
  
  #imageModal .image-caption {
    font-size: 0.9rem;
    margin-top: 0.5rem;
  }
}

@media (max-width: 480px) {
  #imageModal .modal-image {
    max-height: 60vh;
  }
  
  .modal-nav {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  
  #imageModal .image-caption {
    font-size: 0.8rem;
  }
}
