/* 管理后台样式 */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f5f7fa;
  color: #1f2937;
}

/* 登录页面 */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 8px;
}

.login-header p {
  color: #6b7280;
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.form-group input,
.form-group select {
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
}

.login-btn {
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.error-message {
  color: #ef4444;
  font-size: 14px;
  text-align: center;
  padding: 8px;
  background: #fef2f2;
  border-radius: 6px;
}

/* 主界面 */
.main-page {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: 240px;
  background: white;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #6b7280;
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: #f9fafb;
  color: #667eea;
}

.nav-item.active {
  background: #f3f4f6;
  color: #667eea;
  border-left-color: #667eea;
  font-weight: 600;
}

.nav-item svg {
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
  position: relative;
  overflow: hidden;
}

.logout-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.logout-btn:hover::before {
  left: 100%;
}

.logout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #5568d3 0%, #6a3d91 100%);
}

.logout-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.logout-btn svg {
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.logout-btn:hover svg {
  transform: translateX(2px);
}

/* 主内容区 */
.main-content {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
}

.main-header {
  background: white;
  padding: 20px 32px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.main-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #1f2937;
}

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

.admin-name {
  color: #6b7280;
  font-size: 14px;
}

.content-area {
  flex: 1;
  padding: 0;
  overflow: hidden;
  position: relative;
}

.content-area iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.page-content {
  display: none;
}

.page-content.active {
  display: block;
}

/* 页面头部 */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.header-buttons {
  display: flex;
  gap: 12px;
}

/* 按钮 */
.btn-primary {
  padding: 10px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  padding: 10px 20px;
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-danger {
  padding: 6px 12px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-edit {
  padding: 6px 12px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-edit:hover {
  background: #5568d3;
}

/* 表格 */
.table-container {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

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

.data-table thead {
  background: #f9fafb;
}

.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
}

.data-table td {
  padding: 14px 16px;
  font-size: 13px;
  color: #1f2937;
  border-bottom: 1px solid #f3f4f6;
}

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

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.loading-text {
  text-align: center;
  color: #6b7280;
  padding: 40px !important;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

/* 弹窗 */
.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: white;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.modal-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* 素材管理页面（网盘形式） */
.store-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: white;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
}

.store-breadcrumb {
  display: flex;
  align-items: center;
  flex: 1;
  overflow-x: auto;
  gap: 8px;
}

.store-breadcrumb .breadcrumb-item {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  color: #666;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  background: none;
  border: none;
}

.store-breadcrumb .breadcrumb-item:hover {
  background: #f0f0f0;
  color: #333;
}

.store-breadcrumb .breadcrumb-item.active {
  color: #333;
  font-weight: 500;
  background: #f0f0f0;
}

.store-breadcrumb .breadcrumb-separator {
  color: #999;
  margin: 0 4px;
}

.store-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.btn-new-folder {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-new-folder:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-new-folder:active {
  transform: translateY(0);
}

.btn-upload {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-upload:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-upload:active {
  transform: translateY(0);
}

.btn-upload svg {
  flex-shrink: 0;
}

.search-box {
  display: flex;
  align-items: center;
  position: relative;
  background: #f5f5f5;
  border-radius: 20px;
  padding: 0 12px;
  transition: all 0.2s;
}

.search-box:focus-within {
  background: white;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.search-icon {
  color: #999;
  flex-shrink: 0;
}

.search-box input {
  width: 180px;
  padding: 8px 8px;
  border: none;
  background: transparent;
  font-size: 14px;
  outline: none;
  color: #333;
}

.search-box input::placeholder {
  color: #999;
}

.search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}

.search-clear:hover {
  color: #666;
}

.store-file-list-container {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: white;
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 8px;
}

.file-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: calc((100% - 32px) / 3);
  min-width: 120px;
  max-width: 180px;
  padding: 16px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
  position: relative;
}

.file-item:hover {
  background: #f5f5f5;
}

.file-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 140px;
  aspect-ratio: 1;
  margin: 0 auto 8px;
}

.file-icon svg {
  width: 60%;
  height: 60%;
}

.file-icon.folder-icon {
  color: #ffc107;
}

.file-thumbnail {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 140px;
  aspect-ratio: 1;
  margin: 0 auto 8px;
  border-radius: 6px;
  overflow: hidden;
  background-color: #ffffff;
  background-image: 
    linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
    linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  border: 1px solid #e5e5e5;
  position: relative;
}

.file-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.file-name {
  width: 100%;
  font-size: 13px;
  text-align: center;
  word-break: break-all;
  color: #333;
  line-height: 1.4;
  max-height: 2.8em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: text;
}

.file-name:hover {
  background: rgba(24, 144, 255, 0.1);
}

/* 重命名输入框 */
.rename-input {
  width: 100%;
  font-size: 13px;
  text-align: center;
  padding: 2px 4px;
  border: 1px solid #1890ff;
  border-radius: 4px;
  outline: none;
  background: white;
}

.empty-state {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: #999;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.empty-state.show {
  display: flex;
}

.empty-state svg {
  margin-bottom: 24px;
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 8px;
}

.loading {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  z-index: 20;
}

.loading.show {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #1890ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading p {
  margin-top: 16px;
  color: #666;
  font-size: 14px;
}

.loading-text {
  text-align: center;
  color: #6b7280;
  padding: 40px;
  width: 100%;
}

/* 定价管理页面 */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  padding: 8px;
}

.pricing-item {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.2s;
}

.pricing-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.pricing-preview {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background-color: #ffffff;
  background-image: 
    linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
    linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  border: 1px solid #e5e5e5;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pricing-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.no-preview {
  color: #999;
  font-size: 14px;
  padding: 20px;
}

.pricing-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pricing-name {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  text-align: center;
}

.pricing-category {
  font-size: 12px;
  color: #6b7280;
  text-align: center;
}

.pricing-price-input {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.pricing-price-input label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.price-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.price-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 上传进度和预览 */
.upload-progress-container {
  margin-top: 16px;
  padding: 16px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
}

.upload-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.upload-progress-header span:first-child {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
}

.upload-progress-header span:last-child {
  font-size: 14px;
  font-weight: 600;
  color: #667eea;
}

.upload-progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e5e5;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.upload-progress-fill {
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  transition: width 0.3s;
  border-radius: 4px;
}

.upload-progress-text {
  font-size: 12px;
  color: #6b7280;
  text-align: center;
}

.upload-success-preview {
  margin-top: 16px;
  padding: 16px;
  background: #f0fdf4;
  border-radius: 8px;
  border: 1px solid #86efac;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #16a34a;
}

.preview-image-container {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: white;
  border: 1px solid #e5e5e5;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.preview-loading {
  color: #6b7280;
  font-size: 14px;
}