/* ─────────────────────────────────────────────────────────────
 * ESTILOS DEL PANEL DE ADMINISTRACIÓN - CLARO VENDEDOR EJECUTIVO
 * Subdominio: adminclaro.sistemasv.com
 * ───────────────────────────────────────────────────────────── */

:root {
  --color-primary: #d9272e;
  --color-primary-dark: #b91c1c;
  --color-primary-light: #fee2e2;
  --color-bg-dark: #0f172a;
  --color-bg-card: #1e293b;
  --color-border: #334155;
  --color-text-main: #f8fafc;
  --color-text-muted: #94a3b8;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-info: #38bdf8;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--color-bg-dark);
  color: var(--color-text-main);
  min-height: 100vh;
  font-size: 14px;
}

/* ── PANTALLA DE LOGIN ─────────────────────────────────────── */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  background: radial-gradient(circle at top, #1e293b 0%, #0f172a 100%);
}

.auth-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 36px 30px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-logo {
  width: 90px;
  margin-bottom: 12px;
}

.auth-badge {
  display: inline-block;
  background: rgba(217, 39, 46, 0.15);
  color: #f87171;
  border: 1px solid rgba(217, 39, 46, 0.3);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.auth-header h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}

.auth-header p {
  color: var(--color-text-muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.auth-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-footer {
  margin-top: 24px;
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ── FORMULARIOS Y CONTROLES ───────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  background: #0f172a;
  border: 1px solid var(--color-border);
  color: white;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(217, 39, 46, 0.2);
}

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

.form-subtitle {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-info);
  margin-top: 14px;
  margin-bottom: 6px;
  font-weight: 800;
}

/* ── BOTONES ───────────────────────────────────────────────── */
.btn-primary {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #334155;
  color: white;
  border: 1px solid #475569;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #475569;
}

.btn-publish {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
  transition: all 0.2s;
}

.btn-publish:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-block {
  width: 100%;
}

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

.btn-icon:hover {
  color: white;
  border-color: #64748b;
}

.btn-small {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  background: #334155;
  color: white;
  border: none;
  cursor: pointer;
}

/* ── LAYOUT PRINCIPAL DEL DASHBOARD ────────────────────────── */
.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background: #0b1120;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

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

.brand-logo {
  width: 36px;
  height: auto;
}

.brand-text strong {
  display: block;
  font-size: 14px;
  color: white;
}

.brand-text span {
  font-size: 11px;
  color: var(--color-text-muted);
}

.sidebar-nav {
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 15px;
}

.nav-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: white;
  background: var(--color-primary);
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-info);
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-details span {
  font-size: 12px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.user-details small {
  font-size: 10px;
  color: var(--color-text-muted);
}

.btn-logout {
  background: transparent;
  border: none;
  color: #f87171;
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ── CONTENIDO PRINCIPAL ───────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-dark);
  overflow-x: hidden;
}

.top-bar {
  background: #0b1120;
  border-bottom: 1px solid var(--color-border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: none;
}

.top-bar-left h1 {
  font-size: 18px;
  font-weight: 800;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-body {
  padding: 24px;
  flex: 1;
}

/* ── KPIS Y TARJETAS ───────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.kpi-icon.blue { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.kpi-icon.green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.kpi-icon.purple { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.kpi-icon.red { background: rgba(217, 39, 46, 0.15); color: #ef4444; }

.kpi-label {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 600;
  display: block;
}

.kpi-value {
  font-size: 24px;
  font-weight: 900;
  color: white;
  display: block;
}

.kpi-sub {
  font-size: 11px;
  color: var(--color-text-muted);
}

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
}

.panel-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 12px;
}

.panel-header h3 {
  font-size: 15px;
  font-weight: 700;
}

.leads-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #0f172a;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.breakdown-item strong {
  font-size: 14px;
  color: #38bdf8;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: #0f172a;
  color: var(--color-text-muted);
  font-weight: 700;
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--color-border);
}

.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #1e293b;
  vertical-align: middle;
}

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

.phone-thumb {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: white;
  border-radius: 6px;
  padding: 2px;
}

.table-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  background: #0f172a;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  flex: 1;
  min-width: 240px;
}

.search-box input {
  background: transparent;
  border: none;
  color: white;
  padding: 9px 8px;
  font-size: 13px;
  outline: none;
  width: 100%;
}

.search-box i {
  color: var(--color-text-muted);
}

/* Badges en Tabla */
.badge-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-right: 4px;
}

.badge-pill.destacado { background: #d97706; color: white; }
.badge-pill.oferta { background: #dc2626; color: white; }
.badge-pill.piso { background: #2563eb; color: white; }
.badge-pill.pausado { background: #64748b; color: white; }
.badge-pill.activo { background: #059669; color: white; }

/* ── SWITCHES ──────────────────────────────────────────────── */
.switches-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  background: #0f172a;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.switch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.switch-item input {
  display: none;
}

.switch-slider {
  width: 36px;
  height: 20px;
  background: #334155;
  border-radius: 20px;
  position: relative;
  transition: all 0.2s;
  flex-shrink: 0;
}

.switch-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  transition: all 0.2s;
}

.switch-item input:checked + .switch-slider {
  background: var(--color-primary);
}

.switch-item input:checked + .switch-slider::before {
  transform: translateX(16px);
}

.switch-label {
  font-size: 13px;
}

/* ── UPLOADER GSMARENA ─────────────────────────────────────── */
.image-uploader-box {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  background: #0f172a;
  transition: all 0.2s;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-uploader-box:hover {
  border-color: var(--color-primary);
}

.upload-icon {
  font-size: 36px;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.uploader-content p {
  font-size: 13px;
  margin-bottom: 4px;
}

.uploader-content small {
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.4;
  display: block;
}

.uploader-preview {
  position: relative;
  width: 100%;
  height: 100%;
}

.uploader-preview img {
  max-height: 170px;
  max-width: 100%;
  object-fit: contain;
  background: white;
  border-radius: 8px;
  padding: 6px;
}

.help-box-gsmarena {
  margin-top: 12px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: #bae6fd;
}

/* ── MODAL ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-dialog {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #0b1120;
}

/* ── ALERTS & TOASTS ───────────────────────────────────────── */
.alert-box {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 8px;
}

.alert-box.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-box.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #1e293b;
  border: 1px solid #334155;
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.success { border-left: 4px solid var(--color-success); }
.toast.error { border-left: 4px solid #ef4444; }

/* ── SELECTORES COMBINADOS CON ADICIÓN RÁPIDA ─────────────── */
.select-add-group {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.select-add-group select {
  flex: 1;
  background: #0f172a;
  border: 1px solid var(--color-border);
  color: white;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: var(--transition-fast);
}

.select-add-group select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(217, 39, 46, 0.2);
}

.btn-add-quick {
  width: 36px;
  height: 36px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #38bdf8;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.btn-add-quick:hover {
  background: #38bdf8;
  color: #0f172a;
  border-color: #38bdf8;
  transform: translateY(-1px);
}

/* ── GESTOR DE ATRIBUTOS MAESTROS ──────────────────────────── */
.attr-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.attr-card {
  display: flex;
  flex-direction: column;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.attr-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #1e293b;
}

.attr-card-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}

.attr-card-header h4 i {
  color: var(--color-primary);
}

.attr-count-badge {
  background: #1e293b;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid #334155;
}

.attr-add-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.attr-add-bar input {
  flex: 1;
  background: #0f172a;
  border: 1px solid #334155;
  color: white;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.attr-add-bar input:focus {
  border-color: var(--color-primary);
  outline: none;
}

.attr-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.attr-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  transition: var(--transition-fast);
}

.attr-chip:hover {
  border-color: #64748b;
  background: #1e293b;
}

.attr-chip-delete {
  color: #94a3b8;
  cursor: pointer;
  font-size: 11px;
  transition: var(--transition-fast);
}

.attr-chip-delete:hover {
  color: #ef4444;
  transform: scale(1.2);
}

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .two-col-grid {
    grid-template-columns: 1fr;
  }
  .modal-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    height: 100vh;
    z-index: 100;
  }
  .sidebar.open {
    left: 0;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }
  .sidebar-toggle-btn {
    display: block;
  }
  .top-bar-actions span {
    display: none;
  }
  .content-body {
    padding: 16px;
  }
}
