/* ==========================================================================
   CARTELERA DIGITAL IETS - PANEL DE ADMINISTRACIÓN (/admin)
   Diseño institucional moderno, limpio, accesible y responsivo
   ========================================================================== */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', var(--font-main);
  
  --bg-app: #08111e;
  --bg-surface: #0f1f33;
  --bg-surface-elevated: #152b45;
  --bg-surface-hover: #1c3656;
  
  --brand-primary: #00b4d8;
  --brand-teal: #00a896;
  --brand-accent: #00e5ff;
  --brand-danger: #ef4444;
  --brand-danger-bg: rgba(239, 68, 68, 0.15);
  --brand-success: #10b981;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: var(--brand-primary);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(0, 180, 216, 0.25);
}

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

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Superior */
.admin-navbar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
}

.navbar-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}

.navbar-logo {
  height: 38px;
  width: auto;
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--brand-primary);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Botones y Elementos UI */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-teal));
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 180, 216, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 180, 216, 0.5);
}

.btn-secondary {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background-color: var(--brand-danger-bg);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.btn-danger:hover {
  background-color: var(--brand-danger);
  color: #fff;
}

.btn-icon-only {
  padding: 0.5rem;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

/* Layout Principal */
.admin-container {
  max-width: 1400px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 2rem;
  flex: 1;
}

@media (max-width: 1024px) {
  .admin-container {
    grid-template-columns: 1fr;
  }
}

/* Tarjetas y Contenedores */
.admin-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.card-header h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--brand-primary);
  font-weight: 600;
}

/* Formularios */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-input, .form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2);
}

/* Slider de Tiempos */
.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.range-slider {
  flex: 1;
  accent-color: var(--brand-primary);
  height: 6px;
  cursor: pointer;
}

.slider-val {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--brand-accent);
  min-width: 48px;
  text-align: right;
}

.btn-preset {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-preset:hover, .btn-preset.active {
  background: rgba(0, 180, 216, 0.2);
  color: var(--brand-accent);
  border-color: var(--brand-primary);
}

/* Zona de Carga Drag & Drop */
.dropzone {
  border: 2px dashed rgba(0, 180, 216, 0.35);
  border-radius: var(--radius-md);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: rgba(0, 180, 216, 0.03);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--brand-accent);
  background: rgba(0, 180, 216, 0.08);
  transform: translateY(-2px);
}

.dropzone-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  color: var(--brand-primary);
}

.dropzone-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.dropzone-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.dropzone-tags {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dropzone-tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* Barra de progreso de extracción */
.processing-box {
  margin-top: 1rem;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: none;
}

.processing-bar-outer {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0.5rem 0;
}

.processing-bar-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  transition: width 0.2s ease;
}

/* Cuadrícula de Diapositivas */
.slides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.slide-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}

.slide-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 180, 216, 0.4);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.slide-thumb-container {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #000;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.slide-thumb-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.slide-badge-num {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.slide-footer {
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}

.slide-nav-btns {
  display: flex;
  gap: 0.25rem;
}

.btn-tool {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-tool:hover {
  background: var(--bg-surface-hover);
  color: #fff;
}

.btn-tool.btn-del:hover {
  background: var(--brand-danger-bg);
  color: var(--brand-danger);
}

/* Modal de Autenticación PIN */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 14, 23, 0.85);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  max-width: 440px;
  width: 100%;
  padding: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  max-width: 260px;
  margin: 1.5rem auto;
}

.pin-key {
  height: 54px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pin-key:hover {
  background: var(--bg-surface-hover);
  border-color: var(--brand-primary);
  color: var(--brand-accent);
}

.pin-key:active {
  transform: scale(0.95);
}

/* Modal de Vista Previa de Diapositiva */
.preview-modal-box {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  padding: 0.5rem;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.preview-modal-img {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  margin: 0 auto;
}

/* Toast de Notificación */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--brand-primary);
  border-radius: var(--radius-sm);
  padding: 1rem 1.5rem;
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  min-width: 320px;
  animation: slideInToast 0.3s ease;
}

.toast.success { border-left-color: var(--brand-success); }
.toast.error { border-left-color: var(--brand-danger); }

@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
