/* ==========================================================================
   GRUPO BARRA — Panel de Administración
   Estilos CSS (Dark Professional Theme)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg-dark: #0A0A0F;
  --bg-surface: #111118;
  --bg-card: #16161F;
  --bg-card-hover: #1C1C28;
  --bg-input: #1A1A25;

  --gold-primary: #D4AF37;
  --gold-secondary: #F2D06B;
  --gold-glow: rgba(212, 175, 55, 0.3);

  --cyan-accent: #38BDF8;
  --green-accent: #22C55E;
  --red-accent: #EF4444;
  --orange-accent: #F97316;

  --text-main: #F1F1F1;
  --text-muted: #8B8B9E;
  --text-dim: #555566;

  --border: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(212, 175, 55, 0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
}

body {
  min-height: 100vh;
}

::selection {
  background: var(--gold-primary);
  color: #000;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: rgba(212, 175, 55, 0.25); border-radius: var(--radius-full); }

/* ==========================================================================
   LOGIN SCREEN
   ========================================================================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #1A1520 0%, #0A0A0F 70%);
  padding: 24px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.6);
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo-img {
  height: 80px;
  width: auto;
  margin-bottom: 16px;
  filter: grayscale(1) brightness(0.8);
  mix-blend-mode: screen;
}

.login-logo h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.login-logo h1 span {
  color: var(--gold-primary);
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 4px;
}

.login-error {
  color: var(--red-accent);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 16px;
  min-height: 20px;
}

/* ==========================================================================
   FORM ELEMENTS
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  flex: 1;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.admin-input {
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.admin-input:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.admin-input::placeholder {
  color: var(--text-dim);
}

.admin-select {
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238B8B9E' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.admin-select:focus {
  outline: none;
  border-color: var(--gold-primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.category-input-group {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.category-input-group .admin-select,
.category-input-group .admin-input {
  flex: 1;
}

.btn-toggle-custom-cat {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-toggle-custom-cat:hover {
  border-color: var(--gold-primary);
  color: var(--gold-primary);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn-admin-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-secondary) 100%);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-admin-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--gold-glow);
}

.btn-admin-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-admin-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-admin-outline:hover {
  border-color: var(--gold-primary);
  color: var(--gold-primary);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-size: 0.9rem;
}

.btn-icon:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-main);
}

.btn-icon.btn-edit:hover { color: var(--cyan-accent); }
.btn-icon.btn-delete:hover { color: var(--red-accent); }

/* ==========================================================================
   TOP BAR
   ========================================================================== */
.admin-topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-left h2 i {
  color: var(--gold-primary);
}

.topbar-left h2 span {
  color: var(--text-muted);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-user {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================================================
   ADMIN CONTAINER & STATS
   ========================================================================== */
.admin-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-2px);
}

.stat-card-icon {
  width: 52px;
  height: 52px;
  background: rgba(212, 175, 55, 0.1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--gold-primary);
  flex-shrink: 0;
}

.stat-card-number {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

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

/* ==========================================================================
   ACTION BAR
   ========================================================================== */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.action-left {
  display: flex;
  gap: 12px;
  flex: 1;
  max-width: 600px;
}

.action-right {
  display: flex;
  gap: 12px;
}

.search-box {
  position: relative;
  flex: 1;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.search-box .admin-input {
  padding-left: 40px;
}

/* ==========================================================================
   TABLE
   ========================================================================== */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

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

.admin-table thead {
  background: rgba(255,255,255,0.03);
}

.admin-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}

.admin-table tbody tr {
  transition: background var(--transition);
}

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

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

.admin-table-sm td, .admin-table-sm th {
  padding: 8px 12px;
  font-size: 0.8rem;
}

.table-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
}

.table-product-name {
  font-weight: 600;
  color: var(--text-main);
}

.table-tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(212, 175, 55, 0.1);
  color: var(--gold-primary);
  border: 1px solid rgba(212, 175, 55, 0.2);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.status-badge.active {
  background: rgba(34, 197, 94, 0.1);
  color: var(--green-accent);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-badge.inactive {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red-accent);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.table-actions {
  display: flex;
  gap: 4px;
}

.table-empty, .table-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.table-empty i, .table-loading i {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--gold-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.page-btn {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
}

.page-btn:hover, .page-btn.active {
  border-color: var(--gold-primary);
  color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.08);
}

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition);
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 28px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ==========================================================================
   IMAGE UPLOAD ZONE
   ========================================================================== */
.image-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-upload-zone:hover, .image-upload-zone.dragover {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.03);
}

.upload-placeholder i {
  font-size: 2.5rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.upload-placeholder p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.upload-placeholder span {
  color: var(--gold-primary);
  text-decoration: underline;
}

.upload-placeholder small {
  color: var(--text-dim);
  display: block;
  margin-top: 6px;
}

.upload-preview {
  max-width: 200px;
  max-height: 200px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   CSV IMPORT
   ========================================================================== */
.csv-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.csv-upload-zone:hover {
  border-color: var(--gold-primary);
}

.csv-upload-zone i {
  font-size: 2.5rem;
  color: var(--green-accent);
  margin-bottom: 12px;
}

.csv-upload-zone p {
  color: var(--text-muted);
}

.csv-upload-zone span {
  color: var(--gold-primary);
}

.csv-instructions {
  margin-bottom: 24px;
}

.csv-instructions h4 {
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.csv-example {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--cyan-accent);
  margin-bottom: 12px;
  overflow-x: auto;
}

.csv-instructions p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.csv-preview {
  margin: 24px 0;
}

.csv-preview h4 {
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.csv-preview-table-wrap {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-primary), var(--gold-secondary));
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.3s ease;
}

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

@media (max-width: 768px) {
  .admin-container {
    padding: 16px;
  }

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

  .action-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .action-left, .action-right {
    max-width: 100%;
  }

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

  .admin-topbar {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .table-wrapper {
    overflow-x: auto;
  }

  .admin-table {
    min-width: 700px;
  }

  .modal-card {
    max-width: 100%;
  }
}
