/* ========================================
   DRIFT — Admin Panel Styles
   ======================================== */

/* === Admin Layout === */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* === Sidebar === */
.admin-sidebar {
  width: 250px;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
}

.sidebar-logo {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo svg {
  height: 28px;
  width: auto;
}

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  font-size: 14px;
  color: var(--silver);
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.03);
  color: var(--white);
}

.sidebar-nav a.active {
  background: rgba(255,255,255,0.06);
  color: var(--white);
  border-left-color: var(--accent);
}

.sidebar-nav a .icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-nav a.logout {
  margin-top: auto;
  color: var(--red);
  border-top: 1px solid var(--border);
}

.sidebar-nav a.logout:hover {
  background: rgba(204,34,0,0.1);
}

/* === Main Content === */
.admin-main {
  flex: 1;
  margin-left: 250px;
  padding: 32px;
  min-height: 100vh;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.admin-header h1 {
  font-size: 36px;
}

/* === Stats Cards === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  transition: border-color 0.3s ease;
}

.stat-card:hover {
  border-color: var(--muted);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* === Admin Tables === */
.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--void);
  position: sticky;
  top: 0;
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--silver);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.admin-table .table-image {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--surface);
}

.admin-table .actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.admin-table .actions button {
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--silver);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-table .actions button:hover {
  border-color: var(--white);
  color: var(--white);
}

.admin-table .actions .delete-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

/* Checkbox in table */
.admin-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* === Admin Toolbar === */
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.admin-toolbar .search-input {
  max-width: 280px;
  padding: 10px 16px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.admin-toolbar .filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* === Admin Forms === */
.admin-form {
  max-width: 600px;
}

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

.admin-form .form-section {
  background: var(--void);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 24px;
}

.admin-form .form-section h4 {
  font-size: 16px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* === Stock Grid === */
.stock-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.stock-grid .form-group {
  margin-bottom: 0;
}

.stock-grid label {
  font-size: 11px !important;
  text-align: center;
}

.stock-grid input {
  text-align: center;
  padding: 8px;
}

/* === Color Swatches Editor === */
.color-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.color-editor-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.color-editor-item input[type="color"] {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  cursor: pointer;
  background: none;
}

.color-editor-item input[type="text"] {
  width: 100px;
  padding: 6px 8px;
  font-size: 12px;
}

.color-editor-item .color-img-url {
  width: 180px;
  padding: 6px 8px;
  font-size: 12px;
}

.color-editor-item .remove-color {
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}

.color-editor-item .remove-color:hover {
  color: var(--red);
}

/* === Image URL Editor === */
.image-urls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-url-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.image-url-row input {
  flex: 1;
}

.image-url-row .preview {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--surface);
  flex-shrink: 0;
}

.image-url-row .remove-img {
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
}

.image-url-row .remove-img:hover {
  color: var(--red);
}

/* === Alert Cards === */
.alert-card {
  background: rgba(204,34,0,0.08);
  border: 1px solid rgba(204,34,0,0.2);
  border-radius: 4px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.alert-card h5 {
  color: var(--red);
  font-size: 14px;
  margin-bottom: 8px;
}

.alert-card ul {
  font-size: 13px;
  color: var(--silver);
}

.alert-card li {
  padding: 4px 0;
  list-style: disc inside;
}

/* === Quick Links === */
.quick-links {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.quick-links a {
  padding: 10px 20px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--silver);
  transition: all 0.2s ease;
}

.quick-links a:hover {
  border-color: var(--white);
  color: var(--white);
}

/* === Order Detail Expand === */
.order-detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  margin: 8px 0;
  display: none;
}

.order-detail-card.open {
  display: block;
}

.order-detail-card .detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.order-detail-card h5 {
  font-size: 13px;
  margin-bottom: 8px;
}

.order-detail-card p {
  font-size: 13px;
  line-height: 1.6;
}

/* === Bulk Actions === */
.bulk-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 16px;
  display: none;
}

.bulk-actions.visible {
  display: flex;
}

.bulk-actions span {
  font-size: 13px;
  color: var(--silver);
}

/* === Admin Login === */
.admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--void);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 48px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-modal);
}

.login-card svg {
  margin-bottom: 24px;
}

.login-card h3 {
  font-size: 24px;
  margin-bottom: 8px;
}

.login-card p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 32px;
}

.login-card .form-group {
  text-align: left;
}

.login-card .error {
  color: var(--red);
  font-size: 13px;
  margin-top: 8px;
  display: none;
}

/* === Admin Modal === */
.admin-modal {
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
}

.admin-modal .modal-body {
  max-height: calc(90vh - 140px);
  overflow-y: auto;
}

/* === Tags Checkboxes === */
.tag-checks {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.tag-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--silver);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

.tag-checks input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* === Status Select === */
.status-select {
  padding: 4px 24px 4px 8px;
  font-size: 11px;
  min-width: auto;
  width: auto;
  border: 1px solid var(--border);
}

/* === Date Range === */
.date-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-range input[type="date"] {
  padding: 8px 12px;
  font-size: 12px;
  max-width: 160px;
}

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

/* === Mobile Sidebar Drawer === */
.admin-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--white);
  cursor: pointer;
  padding: 8px;
}

.admin-menu-toggle:hover {
  color: var(--accent);
}

.admin-sidebar-backdrop {
  visibility: hidden;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.admin-sidebar-backdrop.open {
  visibility: visible;
  opacity: 1;
}

@media (max-width: 768px) {
  .admin-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .admin-layout {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 200;
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
    margin-bottom: 0;
    padding: 16px;
    min-width: 0;
    width: 100%;
    overflow-x: hidden;
  }

  .admin-header h1 {
    font-size: 28px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px 12px;
  }

  .stat-value {
    font-size: 28px;
  }

  .order-detail-card .detail-grid {
    grid-template-columns: 1fr;
  }

  .stock-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-toolbar .search-input {
    max-width: none;
  }
}
