/* Reset y estilos base */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: #1a1a2e; }

body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

/* Navbar */
.navbar {
  background: #1a1a2e;
  color: white;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px 20px;
}

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-container { width: 100%; max-width: 400px; padding: 20px; }

.login-box {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.login-box h1 {
  text-align: center;
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 8px;
  letter-spacing: 3px;
  color: #1a1a2e;
}

.login-box .subtitle {
  text-align: center;
  color: #888;
  margin-bottom: 30px;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  background: #3498db;
  color: white;
  text-decoration: none;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.95rem;
}
.btn:hover { background: #2980b9; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.btn-primary { background: #3498db; }
.btn-primary:hover { background: #2980b9; }
.btn-secondary { background: #7f8c8d; }
.btn-secondary:hover { background: #636e72; }
.btn-success { background: #27ae60; }
.btn-success:hover { background: #229954; }
.btn-danger { background: #e74c3c; }
.btn-danger:hover { background: #c0392b; }
.btn-warning { background: #f59e0b; color: #1a1000; }
.btn-warning:hover { background: #d97706; color: #1a1000; }
.btn-warning:disabled { background: #f59e0b; color: #1a1000; opacity: .8; cursor: default; }
.btn-small { padding: 6px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; text-align: center; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #2c3e50; }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3498db;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.optional { color: #999; font-size: 0.85rem; font-weight: normal; }
.form-actions { display: flex; gap: 12px; margin-top: 20px; }
.no-image-text { color: #bbb; font-size: 0.9rem; padding: 8px 0; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 20px; }
.alert-error   { background: #fee; color: #c00; border: 1px solid #fcc; }
.alert-success { background: #efe; color: #060; border: 1px solid #cfc; }

/* Dashboard */
.header-section {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 30px;
}
.header-section h2 { font-size: 2rem; font-weight: 900; color: #2c3e50; }

/* Catálogos/Propuestas grid */
.catalogos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.catalogo-card {
  background: white;
  padding: 22px 25px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  transition: transform 0.3s, box-shadow 0.3s;
  border-top: 4px solid #1a1a2e;
}
.catalogo-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.catalogo-brand-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #fff;
  background: #1a1a2e;
  padding: 3px 10px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.catalogo-header h3 {
  font-size: 1.5rem;
  font-weight: 900;
  color: #1a1a2e;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.catalogo-stats {
  display: flex;
  gap: 15px;
  margin: 10px 0;
  font-size: 0.85rem;
  color: #7f8c8d;
}

.catalogo-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 8px 0 12px;
}
.catalogo-meta small { color: #aaa; font-size: 0.8rem; }

/* URL única en dashboard card */
.url-publica {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0f4ff;
  border: 1px solid #d0d9ff;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.url-label { font-size: 0.75rem; font-weight: 700; color: #555; white-space: nowrap; }
.url-input {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  font-family: monospace;
  color: #444;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 2px 0;
}
.url-input:focus { outline: none; }
.btn-copy-url {
  background: #3498db;
  color: white;
  border: none;
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.btn-copy-url:hover { background: #2980b9; }

.catalogo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.empty-state p { color: #7f8c8d; font-size: 1.1rem; }

/* Panel */
.panel {
  background: white;
  padding: 28px 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 25px;
}
.panel h3 {
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 18px;
  color: #2c3e50;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.panel-header h3 { margin-bottom: 0; }
.panel-intro {
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 20px;
  color: #555;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Panel URL en editor */
.panel-url {
  border-top: 4px solid #27ae60;
}
.url-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}
.url-section-header h3 { margin-bottom: 4px; }
.url-section-header p { color: #888; font-size: 0.9rem; }
.url-display-box {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #f0fff4;
  border: 2px solid #27ae60;
  border-radius: 8px;
  padding: 12px 16px;
}
.url-display-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: monospace;
  font-size: 0.9rem;
  color: #333;
  padding: 0;
  cursor: pointer;
}
.url-display-input:focus { outline: none; }

/* Page title */
.page-title {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 8px;
  color: #2c3e50;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 0.85rem;
  color: #999;
  margin-bottom: 20px;
}
.breadcrumb a { color: #3498db; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* Nombre preview en crear-propuesta */
.nombre-preview {
  padding: 12px 16px;
  background: #f0f4ff;
  border: 1px dashed #667eea;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 0.95rem;
  color: #555;
}
.nombre-preview strong { color: #1a1a2e; font-size: 1.1rem; }

/* Image preview */
.image-preview { margin: 10px 0; max-width: 350px; }
.image-preview img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Tipos list (renamed from tematicas-list) */
.tematicas-list { display: flex; flex-direction: column; gap: 12px; }

.tematica-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 14px 16px;
  background: #f8f9fa;
  border-radius: 8px;
  transition: background 0.2s;
}
.tematica-item:hover { background: #e9ecef; }

.tematica-thumb {
  width: 70px;
  height: 55px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.tematica-thumb.no-image { background: #ddd; }

.tematica-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tematica-info strong { font-size: 1.05rem; color: #2c3e50; }
.tematica-info small  { color: #7f8c8d; font-size: 0.88rem; }

.tematica-actions { display: flex; gap: 8px; flex-shrink: 0; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  background: #3498db;
  color: white;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed #ccc;
  border-radius: 10px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 20px;
  color: #888;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: #3498db;
  background: #f0f8ff;
  color: #3498db;
}
.drop-zone-icon { font-size: 2.5rem; margin-bottom: 10px; }
.drop-zone p { font-size: 1rem; margin-bottom: 5px; }
.drop-zone small { font-size: 0.82rem; }

/* Productos grid */
.productos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
}

.producto-item {
  position: relative;
  background: white;
  border-radius: 8px;
  overflow: visible;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s;
}
.producto-item:hover { transform: scale(1.03); }
.producto-item img { width: 100%; height: auto; display: block; border-radius: 8px 8px 0 0; }

.producto-nombre {
  padding: 6px 10px;
  font-size: 0.78rem;
  color: #666;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #f8f9fa;
  border-top: 1px solid #eee;
}

.producto-actions {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  background: #fff;
  border-top: 1px solid #eee;
  border-radius: 0 0 8px 8px;
}

.colores-badge {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: #27ae60;
  color: white;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}

/* Color check labels */
.color-check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 14px;
  background: white;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: all 0.2s;
}
.color-check-label input[type="checkbox"] {
  width: 18px; height: 18px; cursor: pointer;
}
.color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid #000;
  flex-shrink: 0;
}
.color-check-label span { font-size: 0.9rem; font-weight: 500; }

/* Section blocks */
.section-block { padding: 18px 0; border-bottom: 1px solid #f0f0f0; }
.section-block:last-child { border-bottom: none; }
.section-block h3 { font-size: 1.1rem; margin-bottom: 6px; }
.section-desc { color: #888; font-size: 0.88rem; margin-bottom: 12px; }

/* Responsive */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .catalogos-grid { grid-template-columns: 1fr; }
  .catalogo-actions { flex-wrap: wrap; }
  .tematica-item { flex-wrap: wrap; }
  .tematica-actions { width: 100%; justify-content: flex-end; }
  .url-display-box { flex-direction: column; align-items: stretch; }
  .url-section-header { flex-direction: column; gap: 12px; }
  .productos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

.tematica-item.draggable,
.producto-item.draggable { cursor: grab; }

.producto-item .drag-handle {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
}

.tematica-item.dragging,
.producto-item.dragging { opacity: 0.6; }

/* ============================================================
   Sector cards (dashboard)
   ============================================================ */
.sectores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.sector-card {
  position: relative;
  height: 280px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: transform 0.3s, box-shadow 0.3s;
  text-decoration: none;
  display: block;
}
.sector-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}

.sector-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #1a1a2e;
  transition: transform 0.4s;
}
.sector-card:hover .sector-bg { transform: scale(1.04); }

.sector-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 60%, rgba(0,0,0,0.1) 100%);
}

.sector-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 18px 20px;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sector-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}

.sector-nombre {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.25;
  word-break: break-word;
}

.sector-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  gap: 8px;
}

.sector-count {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.75);
}

.sector-footer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-acceder {
  display: inline-block;
  padding: 7px 16px;
  background: white;
  color: #1a1a2e;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}
.sector-card:hover .btn-acceder {
  background: #3498db;
  color: white;
}

.btn-sector-action {
  padding: 5px 9px;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  opacity: 0.75;
  transition: opacity 0.2s;
}
.btn-sector-action:hover { opacity: 1; }
.btn-sector-edit   { background: rgba(255,255,255,0.85); color: #333; }
.btn-sector-delete { background: rgba(231,76,60,0.85);   color: white; }

/* Modal */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:200; align-items:center; justify-content:center; }
.modal-overlay.active { display:flex; }
.modal { background:white; border-radius:12px; padding:32px; max-width:400px; width:90%; text-align:center; box-shadow:0 20px 60px rgba(0,0,0,0.2); }
.modal h3 { font-size:1.3rem; font-weight:900; margin-bottom:8px; color:#2c3e50; }
.modal p  { color:#7f8c8d; font-size:0.95rem; margin-bottom:24px; }
.modal-actions { display:flex; gap:12px; justify-content:center; }
