/**
 * Admin Page Styles - 키라시스터 주문 시스템
 */

/* Admin Main */
.admin-main {
  padding-bottom: 3rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: var(--transition);
  white-space: nowrap;
}

.tab:hover {
  color: var(--color-text);
  background: var(--color-bg-input);
}

.tab.active {
  color: var(--color-primary);
  background: rgba(255, 0, 80, 0.1);
}

.tab i {
  font-size: 1rem;
}

/* Tab Content */
.tab-content {
  display: none;
}

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

/* Dashboard Cards */
.dashboard-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.dashboard-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.2);
}

.dashboard-card .card-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dashboard-card .card-header h3 i {
  color: var(--color-primary);
}

.dashboard-card .card-link {
  font-size: 0.8125rem;
  color: var(--color-secondary);
}

.dashboard-card .card-body {
  padding: 1.25rem;
}

/* YouTube Status Card */
.youtube-status-card .card-header h3 i {
  color: #ff0000;
}

.youtube-status {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.youtube-status .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
}

.youtube-status .status-badge.connected {
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}

.youtube-status .status-badge.disconnected {
  background: rgba(239, 68, 68, 0.2);
  color: var(--color-danger);
}

.youtube-status .status-badge.live {
  background: rgba(255, 0, 0, 0.2);
  color: #ff0000;
}

.youtube-status .broadcast-title {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md);
  background: rgba(255, 0, 80, 0.2);
  color: var(--color-primary);
  font-size: 1.25rem;
}

.stat-icon.revenue {
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}

.stat-icon.pending {
  background: rgba(245, 158, 11, 0.2);
  color: var(--color-warning);
}

.stat-icon.total {
  background: rgba(99, 102, 241, 0.2);
  color: var(--color-secondary);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* Recent Orders List */
.recent-orders-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.recent-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--color-bg-input);
  border-radius: var(--radius-md);
}

.recent-order-item .order-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.recent-order-item .order-buyer {
  font-weight: 500;
}

.recent-order-item .order-product {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.recent-order-item .order-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.recent-order-item .order-price {
  font-weight: 600;
  color: var(--color-primary);
}

.recent-order-item .order-time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Loading Spinner */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem;
  color: var(--color-text-muted);
}

.loading-spinner i {
  color: var(--color-primary);
}

/* Orders Toolbar */
.orders-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.toolbar-left .input {
  width: 160px;
}

/* Checkbox Cell */
.checkbox-cell {
  width: 40px;
  text-align: center;
}

.checkbox-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Tables */
.products-table-wrapper,
.orders-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.products-table,
.orders-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

.products-table th,
.products-table td,
.orders-table th,
.orders-table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.products-table th,
.orders-table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  background: rgba(0, 0, 0, 0.2);
}

.products-table tbody tr:last-child td,
.orders-table tbody tr:last-child td {
  border-bottom: none;
}

.products-table tbody tr:hover,
.orders-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.orders-table tbody td,
.products-table tbody td {
  font-size: 0.8rem;
}

.loading-row td {
  text-align: center;
  padding: 2rem;
  color: var(--color-text-muted);
}

.loading-row i {
  margin-right: 0.5rem;
  color: var(--color-primary);
}

/* Table Cell Content */
.table-image {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--color-bg-darker);
}

.table-image.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 1.25rem;
}

.table-price {
  font-weight: 600;
  color: var(--color-primary);
}

.table-stock {
  font-weight: 500;
}

.table-stock.low {
  color: var(--color-warning);
}

.table-stock.out {
  color: var(--color-danger);
}

.table-status {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
}

.table-status.active {
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}

.table-status.inactive {
  background: rgba(239, 68, 68, 0.2);
  color: var(--color-danger);
}

.table-status.pending {
  background: rgba(245, 158, 11, 0.2);
  color: var(--color-warning);
}

.table-status.confirmed {
  background: rgba(99, 102, 241, 0.2);
  color: var(--color-secondary);
}

.table-status.completed {
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}

.table-status.shipped {
  background: rgba(79, 70, 229, 0.2);
  color: #4f46e5;
}

.table-status.cancelled {
  background: rgba(239, 68, 68, 0.2);
  color: var(--color-danger);
}

/* Source badges */
.table-source {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.table-source.source-web {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.table-source.source-chat {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.products-table td,
.orders-table td {
  vertical-align: middle;
}

.table-actions .btn-icon {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.8125rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.pagination .page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.75rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--color-text);
  cursor: pointer;
  transition: var(--transition);
}

.pagination .page-btn:hover {
  background: var(--color-bg-input);
  border-color: var(--color-primary);
}

.pagination .page-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

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

/* Form Row */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Image Upload */
.image-upload {
  position: relative;
}

.image-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 150px;
  background: var(--color-bg-input);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: var(--transition);
  overflow: hidden;
}

.image-preview:hover {
  border-color: var(--color-primary);
}

.image-preview i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.image-preview p {
  font-size: 0.875rem;
}

.image-preview.has-image {
  padding: 0;
}

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

/* Settings */
.settings-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--color-border);
}

.settings-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-card h3 i {
  color: var(--color-primary);
}

.settings-card h3 .fab.fa-youtube {
  color: #ff0000;
}

.settings-description {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.api-key-display {
  display: flex;
  gap: 0.5rem;
}

.api-key-display input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: monospace;
}

.user-info p {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.user-info strong {
  color: var(--color-text-muted);
  margin-right: 0.5rem;
}

/* YouTube Settings */
.youtube-settings-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.youtube-settings-actions .btn {
  min-width: 140px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--color-text-muted);
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .tabs {
    gap: 0.25rem;
  }

  .tab {
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
  }

  .tab i {
    font-size: 0.875rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .section-header .btn {
    width: 100%;
  }

  .orders-toolbar {
    flex-direction: column;
  }

  .toolbar-left,
  .toolbar-right {
    width: 100%;
    flex-wrap: wrap;
  }

  .toolbar-left .input,
  .toolbar-left .select,
  .toolbar-right .select {
    flex: 1;
    min-width: 120px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .api-key-display {
    flex-wrap: wrap;
  }

  .api-key-display input {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .api-key-display .btn-icon {
    flex: 1;
  }

  .youtube-settings-actions {
    flex-direction: column;
  }

  .youtube-settings-actions .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
