/* ==========================================================================
   MICROSAM - Estilos del Panel de Administración (CMS / Dashboard)
   ========================================================================== */

.admin-wrapper {
  display: flex;
  min-height: calc(100vh - 120px);
}

.admin-sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
}

.admin-menu-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-menu-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  text-align: left;
}

.admin-menu-btn:hover, .admin-menu-btn.active {
  background: var(--bg-tertiary);
  color: var(--accent-cyan);
  border-left: 3px solid var(--accent-cyan);
}

.admin-content-area {
  flex: 1;
  padding: 36px 40px;
  background: var(--bg-primary);
  overflow-y: auto;
}

.admin-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 16px;
}

.admin-page-title h2 {
  font-size: 1.6rem;
}

.admin-page-title p {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.admin-tab-pane {
  display: none;
}

.admin-tab-pane.active {
  display: block;
}

/* Card Containers */
.admin-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 28px;
}

.admin-card-title {
  font-size: 1.2rem;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Form Styles */
.switch-control-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

input:checked + .slider:before {
  transform: translateX(22px);
  background-color: #ffffff;
}

/* Top Bar Color Theme Radio Options */
.theme-picker-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 10px 0 20px;
}

.theme-picker-card {
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.theme-picker-card.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.admin-table th {
  padding: 14px 16px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
}

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

.admin-table tr:hover td {
  background: var(--bg-surface);
}

.table-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-tertiary);
}

.product-row-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.status-pill.status-pendiente {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.status-pill.status-pagado {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.status-pill.status-en-envio {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-indigo);
}

.status-pill.status-cancelado {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
}

.btn-action-icon {
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.btn-action-icon:hover {
  background: var(--bg-surface);
  color: var(--accent-cyan);
}

.btn-action-icon.danger:hover {
  color: var(--accent-rose);
}

/* Authentication Screen */
.admin-login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.login-card {
  max-width: 420px;
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
  font-family: var(--font-heading);
}

.login-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
}

@media (max-width: 860px) {
  .admin-wrapper {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .admin-content-area {
    padding: 24px 16px;
  }
}

/* ==========================================================================
   CONSTRUCTOR VISUAL DE ESPECIFICACIONES & PREVIEW
   ========================================================================== */
.specs-builder-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 18px;
}

.specs-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.specs-row {
  display: grid;
  grid-template-columns: 1fr 1.3fr 42px;
  gap: 10px;
  align-items: center;
}

.specs-row .form-control {
  padding: 8px 12px;
  font-size: 0.86rem;
}

.btn-remove-spec {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(244, 63, 94, 0.12);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-remove-spec:hover {
  background: var(--accent-rose);
  color: #ffffff;
  transform: scale(1.05);
}

.crud-img-preview-box {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-focus);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.72rem;
  flex-shrink: 0;
}

.crud-img-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 600px) {
  .specs-row {
    grid-template-columns: 1fr 1fr 38px;
    gap: 6px;
  }
}

/* ==========================================================================
   GESTOR MULTIMEDIA: FOTOS MÚLTIPLES & VIDEO PREVIEW EN CMS
   ========================================================================== */
.media-upload-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 18px;
}

.crud-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.crud-media-item {
  position: relative;
  width: 100%;
  height: 88px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-subtle);
  background: var(--bg-secondary);
  overflow: hidden;
}

.crud-media-item.is-cover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.crud-media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge-cover {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 240, 255, 0.9);
  color: #07090e;
  font-size: 0.65rem;
  font-weight: 800;
  text-align: center;
  padding: 2px 0;
  text-transform: uppercase;
}

.btn-delete-thumb {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(244, 63, 94, 0.85);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  border: none;
  transition: transform var(--transition-fast);
}

.btn-delete-thumb:hover {
  transform: scale(1.15);
  background: var(--accent-rose);
}

.video-upload-wrap {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   GRIDFLOW EMBEDDED MODULE STYLES
   ========================================================================== */
#tab-gridflow.active {
  display: flex !important;
  flex-direction: column;
  height: calc(100vh - 120px);
}

.gridflow-frame-wrapper {
  flex: 1;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  min-height: 600px;
}

.gridflow-frame-wrapper iframe {
  width: 100%;
  height: 100%;
  min-height: 620px;
  border: none;
  flex: 1;
  background: transparent;
}



