/* Dashboard - Estilo Factiliza */
#dashboard-app {
  --dash-primary: #7c3aed;
  --dash-primary-dark: #6d28d9;
}

/* Sidebar claro */
#dashboard-app .sidebar {
  width: 240px;
  background: white;
  color: #1e293b;
  border-right: 1px solid #e2e8f0;
  box-shadow: 2px 0 12px rgba(0,0,0,0.04);
  padding: 1.5rem 1rem;
  flex-shrink: 0;
  transition: width 0.25s ease;
  overflow: hidden;
  position: relative;
}

/* Estado colapsado - solo iconos */
#dashboard-app .sidebar.collapsed {
  width: 72px;
  padding: 1.5rem 0.75rem;
}

#dashboard-app .sidebar.collapsed .logo-text,
#dashboard-app .sidebar.collapsed .nav-label,
#dashboard-app .sidebar.collapsed .sidebar-toggle {
  display: none;
}

#dashboard-app .sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0.65rem;
}

/* Hover expande cuando está colapsado */
#dashboard-app .sidebar.collapsed:hover {
  width: 240px;
  padding: 1.5rem 1rem;
}

#dashboard-app .sidebar.collapsed:hover .logo-text,
#dashboard-app .sidebar.collapsed:hover .nav-label {
  display: block;
}

#dashboard-app .sidebar.collapsed:hover .sidebar-toggle {
  display: flex;
}

#dashboard-app .sidebar.collapsed:hover .nav-item {
  justify-content: flex-start;
  padding: 0.65rem 1rem;
}

#dashboard-app .sidebar.collapsed .logo {
  justify-content: center;
}

#dashboard-app .sidebar.collapsed:hover .logo {
  justify-content: flex-start;
}

#dashboard-app .logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

#dashboard-app .sidebar .sidebar-close {
  margin-left: auto;
}

#dashboard-app .logo-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: linear-gradient(135deg, var(--dash-primary) 0%, var(--dash-primary-dark) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  color: white;
}

#dashboard-app .logo-text {
  font-weight: 700;
  color: var(--dash-primary);
  transition: opacity 0.2s;
}

#dashboard-app .sidebar-toggle {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border: 2px solid #e2e8f0;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #94a3b8;
  transition: all 0.2s;
}

/* Activo (sidebar expandido) = azul/morado */
#dashboard-app .sidebar:not(.collapsed) .sidebar-toggle {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

/* Desactivado (sidebar colapsado) = sin color */
#dashboard-app .sidebar.collapsed .sidebar-toggle,
#dashboard-app .sidebar.collapsed:hover .sidebar-toggle {
  background: transparent;
  border-color: #e2e8f0;
  color: #94a3b8;
}

#dashboard-app .sidebar-toggle:hover {
  border-color: var(--dash-primary);
  opacity: 0.9;
}

#dashboard-app .sidebar-close {
  display: none;
}

#dashboard-app .header-menu-btn {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

#dashboard-app .nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #6b7280;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-weight: 500;
  text-decoration: none;
}

#dashboard-app .nav-icon {
  font-size: 1.1rem;
  min-width: 1.25rem;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#dashboard-app .nav-icon i {
  font-size: inherit;
}

#dashboard-app .nav-label {
  white-space: nowrap;
  transition: opacity 0.2s;
}

#dashboard-app .nav-item:hover {
  background: #f3f4f6;
  color: #4b5563;
}

#dashboard-app .nav-item.active {
  background: var(--dash-primary);
  color: white;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
}

/* Header - cuadro rectangular blanco flotante */
#dashboard-app .main {
  padding: 1rem 1.5rem;
  gap: 1rem;
}

#dashboard-app .header {
  background: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  margin-bottom: 0;
  flex-shrink: 0;
}

#dashboard-app .user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#dashboard-app .user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dash-primary) 0%, var(--dash-primary-dark) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  position: relative;
  border: 2px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

#dashboard-app .user-avatar::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid white;
}

#dashboard-app .user-details {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
}

#dashboard-app .user-details .name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
}

#dashboard-app .user-details .email {
  font-size: 0.8rem;
  color: #64748b;
}

#dashboard-app .user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

/* Dropdown perfil usuario */
#dashboard-app .user-profile-dropdown {
  position: relative;
}

#dashboard-app .user-profile-trigger {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.2s;
}

#dashboard-app .user-profile-trigger:hover {
  background: #f8fafc;
}

#dashboard-app .user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 200px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  border: 1px solid #e2e8f0;
  padding: 0.5rem;
  z-index: 100;
}

#dashboard-app .user-dropdown.open {
  display: block;
}

#dashboard-app .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 1rem;
  border: none;
  background: none;
  font-size: 0.9rem;
  color: #475569;
  text-decoration: none;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
  text-align: left;
}

#dashboard-app .dropdown-item:hover {
  background: #f8fafc;
}

#dashboard-app .dropdown-icon {
  font-size: 1rem;
  width: 1.1rem;
  text-align: center;
  opacity: 0.8;
}

#dashboard-app .dropdown-icon i {
  font-size: inherit;
}

#dashboard-app .btn-logout {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: white;
  color: #64748b;
  font-weight: 500;
}

#dashboard-app .btn-logout:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

#dashboard-app .btn-admin {
  color: var(--dash-primary);
  font-weight: 600;
  font-size: 0.85rem;
}

/* Content area */
#dashboard-app #content {
  background: #f8fafc;
  padding: 1.5rem;
  border-radius: 12px;
}

/* Cards separadas - estilo Factiliza (espaciado entre cada una) */
#dashboard-app .cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 1200px;
}

#dashboard-app .card {
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  border: 1px solid #e2e8f0;
  padding: 1.5rem;
}

#dashboard-app .card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 1rem;
}

/* Token card - botón Copiar estilo outline */
#dashboard-app .btn-copy {
  background: white;
  border: 1px solid #e2e8f0;
  color: #475569;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

#dashboard-app .btn-copy:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* Documentación oficial - outline morado */
#dashboard-app .btn-doc {
  background: white;
  border: 2px solid var(--dash-primary);
  color: var(--dash-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
}

#dashboard-app .btn-doc:hover {
  background: #f5f3ff;
  border-color: var(--dash-primary-dark);
  color: var(--dash-primary-dark);
}

/* Token box */
#dashboard-app .token-box code {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.8rem;
}

/* Botones primarios morados */
#dashboard-app .btn-primary {
  background: var(--dash-primary);
}

#dashboard-app .btn-primary:hover {
  background: var(--dash-primary-dark);
}

#dashboard-app .progress {
  background: linear-gradient(90deg, #22c55e 0%, var(--dash-primary) 100%);
}

/* Tablas - scroll horizontal cuando el contenido no cabe */
#dashboard-app .table-container {
  border-radius: 12px;
  overflow-x: auto;
  overflow-y: visible;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

#dashboard-app .table-container::-webkit-scrollbar {
  height: 8px;
}

#dashboard-app .table-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

#dashboard-app .table-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

#dashboard-app .table-container .table {
  min-width: 720px;
}

/* Formulario Enviar Mensajes - Estilo Factiliza */
#dashboard-app .send-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  max-width: 680px;
}

#dashboard-app .send-card-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem 1.75rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
}

#dashboard-app .send-card-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  background: linear-gradient(135deg, var(--dash-primary) 0%, var(--dash-primary-dark) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}

#dashboard-app .send-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 0.25rem;
}

#dashboard-app .send-card-subtitle {
  font-size: 0.9rem;
  color: #64748b;
  margin: 0;
}

#dashboard-app .send-form {
  padding: 1.75rem 1.75rem 2rem;
  border-radius: 0;
  box-shadow: none;
  border: none;
  max-width: 100%;
  background: white;
}

#dashboard-app .send-form-group {
  margin-bottom: 1.5rem;
}

#dashboard-app .form-label-with-icon {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: #334155;
  margin-bottom: 0.5rem;
}

#dashboard-app .form-label-with-icon i {
  font-size: 0.95rem;
  color: var(--dash-primary);
  opacity: 0.9;
}

#dashboard-app .send-form .form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#dashboard-app .send-form .form-control:hover {
  border-color: #cbd5e1;
}

#dashboard-app .send-form .form-control:focus {
  outline: none;
  border-color: var(--dash-primary);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

#dashboard-app .send-form .form-control::placeholder {
  color: #94a3b8;
}

#dashboard-app .send-form .form-control-textarea {
  min-height: 90px;
  resize: vertical;
}

#dashboard-app .send-form .phone-input {
  display: flex;
  gap: 0.75rem;
}

#dashboard-app .send-form .phone-input .form-control-select {
  width: 130px;
  flex-shrink: 0;
}

#dashboard-app .send-form .phone-input .form-control {
  flex: 1;
}

#dashboard-app .attach-zone {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

#dashboard-app .btn-attach-elegant {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: white;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

#dashboard-app .btn-attach-elegant:hover {
  border-color: var(--dash-primary);
  color: var(--dash-primary);
  background: #faf5ff;
}

#dashboard-app .btn-attach-elegant i {
  font-size: 1rem;
}

#dashboard-app .file-name-display {
  font-size: 0.85rem;
  color: #64748b;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#dashboard-app .btn-send-elegant {
  width: 100%;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--dash-primary) 0%, var(--dash-primary-dark) 100%);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
  transition: transform 0.15s, box-shadow 0.2s;
}

#dashboard-app .btn-send-elegant:hover {
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.45);
  transform: translateY(-1px);
}

#dashboard-app .btn-send-elegant:active {
  transform: translateY(0);
}

/* Modal Mejorar Suscripción */
.modal-upgrade-content {
  max-width: 920px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem 2rem;
}

.modal-upgrade-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.modal-upgrade-header h3 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e293b;
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background 0.2s, color 0.2s;
}

.modal-close-btn:hover {
  background: #e2e8f0;
  color: #475569;
}

.modal-upgrade-subtitle {
  color: #64748b;
  font-size: 0.95rem;
  margin: 0 0 0.25rem;
  text-align: center;
}

.modal-upgrade-note {
  color: #94a3b8;
  font-size: 0.8rem;
  margin: 0 0 1.5rem;
  text-align: center;
}

.upgrade-plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 1rem;
}

.upgrade-plan-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.upgrade-plan-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.upgrade-plan-popular {
  border-color: #3b82f6;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
}

.upgrade-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #3b82f6;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

.upgrade-plan-card h4 {
  margin: 1rem 0 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1e293b;
}

.upgrade-price {
  font-size: 1.75rem;
  font-weight: 800;
  color: #3b82f6;
  margin-bottom: 1rem;
}

.upgrade-price span {
  font-size: 0.95rem;
  font-weight: 500;
  color: #64748b;
}

.upgrade-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  flex: 1;
  text-align: left;
  width: 100%;
}

.upgrade-features li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.9rem;
  color: #475569;
}

.upgrade-features li i {
  color: #22c55e;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.btn-upgrade-select {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: white;
  color: #64748b;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-upgrade-select:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.btn-upgrade-select.btn-primary {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.btn-upgrade-select.btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.upgrade-plans-loading {
  text-align: center;
  padding: 2rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.upgrade-no-plans {
  text-align: center;
  padding: 2rem;
  color: #64748b;
}

@media (max-width: 768px) {
  .upgrade-plans {
    grid-template-columns: 1fr;
  }
}
