/* ============================================
   HILORE V2 — Dark Mode UI
   Inspirado en VoxFlow (voxflow.me)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Fondo */
  --bg-primary: #000000;
  --bg-sidebar: #000000;
  --bg-card: #0A0A0A;
  --bg-input: #111111;
  --bg-input-readonly: #0D0D0D;
  --bg-hover: rgba(255, 255, 255, 0.04);
  --bg-hover-strong: rgba(255, 255, 255, 0.02);

  /* Texto — todo texto legible es blanco; el gris queda solo para
     placeholders de inputs, íconos decorativos y el número de versión */
  --text-primary: #ffffff;
  --text-secondary: #ffffff;
  --text-tertiary: #888888;
  --text-placeholder: #444444;
  --text-version: #333333;

  /* Acento — verde lima VoxFlow */
  --accent: #BEFF00;
  --accent-hover: #D4FF40;
  --accent-text-on: #000000;
  --accent-soft: rgba(190, 255, 0, 0.08);
  --accent-soft-strong: rgba(190, 255, 0, 0.15);

  /* Estados */
  --danger: #FF4444;
  --danger-soft: rgba(255, 68, 68, 0.08);
  --success: #00CC66;
  --success-soft: rgba(0, 204, 102, 0.08);
  --warning: #FFAA00;

  /* Bordes */
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --input-border: rgba(255, 255, 255, 0.10);

  /* Otros */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-login: 0 20px 60px rgba(0, 0, 0, 0.5);
  --transition: all 0.15s ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

::selection {
  background: rgba(190, 255, 0, 0.3);
  color: #ffffff;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ---- LOGIN ---- */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-login);
}

.login-logo {
  position: relative;
  text-align: center;
  margin-bottom: 28px;
}

.login-logo::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  background: rgba(190, 255, 0, 0.1);
  box-shadow: 0 0 80px 40px rgba(190, 255, 0, 0.08);
  border-radius: 50%;
  z-index: 0;
}

.login-logo h1 {
  position: relative;
  z-index: 1;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-primary);
}

.login-logo span {
  color: var(--accent);
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 32px;
}

.login-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 11px;
  color: var(--text-version);
}

.version-indicator {
  display: block;
  font-size: 11px;
  color: var(--text-version);
}

.sidebar-footer .version-indicator {
  font-size: 10px;
  margin-top: 2px;
}

/* ---- FORM ELEMENTS ---- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft-strong);
}

.form-group input::placeholder {
  color: var(--text-placeholder);
}

.form-group input[readonly] {
  background: var(--bg-input-readonly);
  color: var(--text-secondary);
}

/* Input con ícono flotante (mostrar/ocultar, copiar) */
.input-group {
  position: relative;
}

.input-group input {
  padding-right: 42px;
}

.input-icon-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.input-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

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

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text-on);
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-block {
  width: 100%;
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-hover);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.login-error {
  background: var(--danger-soft);
  border: 1px solid rgba(255, 68, 68, 0.3);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
  display: none;
}

/* ---- APP LAYOUT ---- */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

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

.sidebar-header {
  padding: 24px 20px 16px;
}

.sidebar-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.sidebar-header h1 span {
  color: var(--accent);
}

.sidebar-comercio {
  padding: 0 20px 16px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.sidebar-comercio strong {
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 8px 16px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  transition: var(--transition);
  margin: 0 0 2px;
}

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

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  opacity: 0.9;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: var(--accent-text-on);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--text-primary);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar-logout:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.sidebar-logout svg {
  width: 16px;
  height: 16px;
}

/* Main content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-header {
  height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.main-header h2 {
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-search {
  position: relative;
  width: 200px;
}

.header-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.header-search input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--bg-input);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.header-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft-strong);
}

.header-search input::placeholder {
  color: var(--text-placeholder);
}

.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.header-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.header-icon-btn svg {
  width: 18px;
  height: 18px;
}

.header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  flex-shrink: 0;
}

.main-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: var(--border-hover);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.card-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* Status indicator */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}

.status-dot.green { background: var(--success); }
.status-dot.yellow { background: var(--warning); }
.status-dot.red { background: var(--danger); }
.status-dot.gray { background: var(--text-tertiary); }

/* Connection status banner */
.connection-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  font-size: 13px;
  border-left: 3px solid transparent;
}

.connection-card.connected {
  background: var(--success-soft);
  border-left-color: var(--success);
}

.connection-card.disconnected {
  background: var(--danger-soft);
  border-left-color: var(--danger);
}

/* Toast notifications */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  transform: translateX(120%);
  transition: transform 0.3s ease;
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  background: var(--success);
  color: #fff;
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

/* ---- VISTA: Empty states ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-panel {
  animation: fadeInUp 0.2s ease;
}

.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-tertiary);
}

.coming-soon .empty-icon {
  width: 48px;
  height: 48px;
  color: #333333;
  margin-bottom: 16px;
}

.coming-soon h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.coming-soon p {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 300px;
  margin-bottom: 20px;
}

.coming-soon .btn {
  margin-top: 4px;
}

/* Table row hover (uso futuro en Contactos/Campañas) */
.row-hover:hover {
  background: var(--bg-hover-strong);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: left 0.3s ease;
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
  }

  .sidebar-overlay.show {
    display: block;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .header-search,
  .header-icon-btn.header-notif {
    display: none;
  }

  .main-header {
    padding: 0 16px;
  }

  .main-header h2 {
    font-size: 16px;
  }

  .main-body {
    padding: 16px;
  }

  .card {
    padding: 16px;
  }

  .login-container {
    padding: 16px;
  }

  .login-card {
    padding: 24px;
  }
}
