/* ==========================================================================
   🔑 ESTILOS DE ADMINISTRACIÓN - PURO SABOR
   ========================================================================== */

/* --- 🚪 PANTALLA DE LOGIN --- */
.admin-login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: var(--bg-primary);
  padding: 20px;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
}

.login-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 30px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}

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

.login-logo {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.login-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
}

.login-header p {
  font-size: 11px;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 4px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

.input-with-icon input,
.form-control {
  width: 100%;
  padding: 14px 16px 14px 46px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: var(--transition-fast);
}

.form-control-no-icon {
  padding-left: 16px !important;
}

.input-with-icon input:focus,
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(230, 126, 34, 0.1);
  background: rgba(0, 0, 0, 0.4);
}

.btn-login {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: var(--text-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(230, 126, 34, 0.2);
  transition: var(--transition-fast);
}

.btn-login:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 16px rgba(230, 126, 34, 0.35);
}

.alert-box {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 24px;
  line-height: 1.4;
}

.alert-box.error {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.2);
  color: var(--danger);
}

.alert-box.success {
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.2);
  color: var(--success);
}

.login-footer {
  text-align: center;
  margin-top: 25px;
}

.back-to-menu {
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
  transition: var(--transition-fast);
}

.back-to-menu:hover {
  color: var(--primary);
}


/* --- 📊 PANEL DE CONTROL (DASHBOARD) --- */

.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--bg-primary);
}

/*  Sidebar Lateral */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 30px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  font-size: 24px;
}

.sidebar-brand h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 800;
}

.sidebar-user {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.01);
}

.user-info-name {
  font-weight: 700;
  font-size: 14px;
}

.user-info-role {
  font-size: 11px;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 1px;
}

.sidebar-menu {
  padding: 24px 16px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.menu-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.menu-item.active {
  background: rgba(230, 126, 34, 0.1);
  color: var(--primary);
}

.sidebar-footer {
  padding: 20px 16px;
  border-top: 1px solid var(--border-color);
}

.btn-logout {
  width: 100%;
  padding: 12px;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(231, 76, 60, 0.05);
}

/* Área Principal de Contenido */
.main-content {
  flex-grow: 1;
  padding: 40px;
  overflow-y: auto;
  max-width: calc(100% - 260px);
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 35px;
}

.dashboard-title h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 800;
}

.dashboard-title p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 2px;
}

.btn-primary {
  padding: 12px 24px;
  background: var(--primary);
  color: var(--text-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(230, 126, 34, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 16px rgba(230, 126, 34, 0.35);
}

.btn-primary svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* KPI Cards de Estadísticas */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.kpi-info-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-info-value {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 800;
  margin-top: 6px;
}

.kpi-icon {
  font-size: 36px;
  opacity: 0.6;
}

/* 📦 TABLA DE DATOS CRUD */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.table-header-bar {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.table-header-bar h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
}

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

.table-search {
  max-width: 260px;
  position: relative;
}

.table-search input {
  padding: 8px 12px 8px 36px !important;
}

.table-search .search-icon {
  left: 12px !important;
  font-size: 14px !important;
}

.table-select {
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.table-select:focus {
  border-color: var(--primary);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: rgba(255, 255, 255, 0.02);
  padding: 16px 24px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 16px 24px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

/* Celdas específicas */
.cell-image {
  width: 60px;
}

.cell-image img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.cell-name {
  font-weight: 700;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-desc {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-category {
  font-weight: 600;
  color: var(--primary);
}

.cell-price {
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: var(--secondary);
}

.cell-stock {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stock-input {
  width: 50px;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  text-align: center;
  font-weight: 700;
  border-radius: 4px;
}

.btn-stock-save {
  background: var(--primary);
  border: none;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-stock-save:hover {
  background: var(--primary-hover);
}

/* Custom CSS Switch (Toggle) */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

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

.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--text-muted);
  transition: .3s;
  border-radius: 22px;
}

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

input:checked + .slider-toggle {
  background-color: var(--success);
}

input:checked + .slider-toggle:before {
  transform: translateX(20px);
}

/* Acciones en Tabla */
.btn-action-group {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-icon.btn-edit:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-icon.btn-delete:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}


/* --- 📝 DIÁLOGOS Y MODALES ADMIN --- */

.admin-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.admin-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.admin-modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-modal-overlay.open .admin-modal-content {
  transform: scale(1);
}

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

.admin-modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.admin-modal-body {
  padding: 24px;
}

.admin-modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-secondary {
  padding: 10px 20px;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

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

.image-upload-wrapper {
  display: flex;
  gap: 16px;
  align-items: center;
}

.image-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-color);
  background: rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.file-input-custom {
  position: relative;
  overflow: hidden;
  display: inline-block;
}

.btn-file {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
  transition: var(--transition-fast);
}

.btn-file:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.file-input-custom input[type=file] {
  font-size: 100px;
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  cursor: pointer;
}

/* ==========================================================================
   📱 MEDIA QUERIES DASHBOARD
   ========================================================================== */

@media (max-width: 992px) {
  .dashboard-wrapper {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .sidebar-menu {
    flex-direction: row;
    overflow-x: auto;
    padding: 10px 20px;
    white-space: nowrap;
    scrollbar-width: none;
  }
  
  .sidebar-menu::-webkit-scrollbar {
    display: none;
  }
  
  .sidebar-brand,
  .sidebar-user,
  .sidebar-footer {
    display: none;
  }
  
  .main-content {
    max-width: 100%;
    padding: 20px;
  }
}

@media (max-width: 580px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  td, th {
    padding: 12px 16px;
  }
  
  .cell-desc {
    display: none;
  }
}
