/* =========================================================================
   PERFECT ESCORTS · PROVIDER PANEL UI (LAYOUT FIX & RESPONSIVE)
   Archivo: /provider/assets/css/provider.css
   Versión: 2.4 (Header Overlap Fix REAL)
   ========================================================================= */

/* ======================
   1) TOKENS & VARIABLES
   ====================== */
:root {
  /* Colores */
  --provider-bg-0: #050304;
  --provider-bg-1: #0f0d0e;
  --provider-bg-2: #151214;
  --provider-bg-3: #1a1618;
  --provider-gold-1: #F6D46B;
  --provider-gold-2: #C6A85A;
  --provider-gold-3: #B48A3A;
  --provider-pending: #ffc107;
  --provider-confirmed: #28a745;
  --provider-cancelled: #dc3545;
  --provider-completed: #17a2b8;
  --provider-txt: #f2f2f2;
  --provider-txt-dim: #cfcfd2;
  --provider-muted: #9d9da3;
  --provider-line: rgba(246, 212, 107, .15);
  --provider-line-soft: rgba(255, 255, 255, .08);
  --provider-glass: rgba(15, 13, 14, .85);
  --provider-glass-2: rgba(15, 13, 14, .95);
  --provider-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

  /* Dimensiones Críticas */
  --sidebar-width: 280px;
  --header-height: 80px;
  --border-radius: 12px;

  /* Safe Areas (iOS) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* Z-Index Layers (Jerarquía Visual) - CORREGIDO 2026-01-09 */
  --z-sidebar: 1050;
  --z-overlay: 1040;
  --z-header: 1030;
  --z-content: 1;
  --z-dropdown: 1150;  /* Debe ser > overlay para que dropdowns sean visibles */
}

/* ======================
   2) RESET & BASE
   ====================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
  /* Prevenir scroll horizontal fantasma */
}

body.provider-panel {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(246, 212, 107, 0.08), transparent 40%),
    linear-gradient(135deg, var(--provider-bg-0), var(--provider-bg-3));
  color: var(--provider-txt);
  font-size: 14px;
  line-height: 1.5;
  padding-bottom: var(--safe-bottom);

  /* 🔥 FIX REAL: todo el contenido comienza por debajo del header fijo */
  padding-top: calc(var(--header-height) + var(--safe-top) + 16px);
}

a {
  text-decoration: none;
  color: inherit;
  transition: 0.2s;
}

ul {
  list-style: none;
}

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

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

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

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

/* ======================
   3) ESTRUCTURA DEL LAYOUT (GENERAL)
   ====================== */

/* Contenedor Global */
.provider-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Sidebar (Menú Lateral) */
.provider-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--provider-bg-1);
  border-right: 1px solid var(--provider-line);
  z-index: var(--z-sidebar);
  overflow-y: auto;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  /* Móvil por defecto: Oculto a la izquierda */
  transform: translateX(-100%);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* Topbar (Header Superior) */
.provider-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  /* En móvil ocupa todo el ancho */
  height: calc(var(--header-height) + var(--safe-top));
  background: var(--provider-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--provider-line);
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--safe-top) 20px 0 20px;
  transition: left 0.3s ease, width 0.3s ease;
}

/* Contenedor Principal (opcional si lo usas en header.php) */
.provider-main {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;

  /* OJO: ya empujamos en body, aquí dejamos margen suave por si existe */
  padding-top: 16px;

  margin-left: 0;
  /* Móvil por defecto */
  transition: margin-left 0.3s ease, width 0.3s ease;
}

/* Contenido Interno */
.provider-content {
  flex: 1;
  padding: 0 20px 20px 20px;
  padding-left: max(20px, var(--safe-left));
  padding-right: max(20px, var(--safe-right));
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Footer */
.provider-footer {
  margin-top: auto;
  padding: 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
  border-top: 1px solid var(--provider-line-soft);
  background: var(--provider-bg-0);
  text-align: center;
  font-size: 0.85rem;
  color: var(--provider-muted);
}

/* ======================
   4) LOGICA DESKTOP (>= 992px)
   ====================== */
@media (min-width: 992px) {

  /* Sidebar siempre visible y fijo */
  .provider-sidebar {
    transform: translateX(0);
  }

  /* En desktop el contenido se corre a la derecha del sidebar */
  body.provider-panel {
    padding-left: var(--sidebar-width);
  }

  .provider-topbar {
    left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
  }

  .provider-main {
    margin-left: 0;
    /* ya usamos padding-left en body */
    width: 100%;
  }

  .provider-sidebar-toggle {
    display: none;
    /* Ocultar botón hamburguesa en desktop */
  }
}

/* ======================
   5) COMPONENTES INTERNOS
   ====================== */

/* --- Sidebar Components --- */
.provider-sidebar-header {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid var(--provider-line-soft);
  position: relative;
}

.provider-sidebar-logo img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--provider-gold-1);
  object-fit: cover;
  margin-bottom: 10px;
}

.provider-logo-text {
  font-family: 'Libre Bodoni', serif;
  color: var(--provider-gold-1);
  font-size: 1.2rem;
  margin: 0;
}

.provider-sidebar-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  color: var(--provider-txt);
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
  /* Solo visible en móvil al abrir */
}

.provider-nav {
  padding: 20px 10px;
  flex: 1;
}

.provider-nav-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--provider-muted);
  margin: 15px 10px 5px;
  letter-spacing: 1px;
}

.provider-nav-item {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  border-radius: 8px;
  color: var(--provider-txt-dim);
  font-weight: 500;
  margin-bottom: 2px;
}

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

.provider-nav-item.active {
  background: linear-gradient(90deg, rgba(246, 212, 107, 0.15), transparent);
  border-left: 3px solid var(--provider-gold-1);
  color: var(--provider-gold-1);
}

.provider-nav-item i {
  width: 24px;
  text-align: center;
  margin-right: 10px;
}

.provider-sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--provider-line-soft);
  font-size: 0.8rem;
  text-align: center;
  color: var(--provider-muted);
}

/* --- Topbar Components --- */
.provider-topbar-left,
.provider-topbar-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.provider-sidebar-toggle {
  background: none;
  border: none;
  color: var(--provider-gold-1);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px;
}

/* --- User Dropdown --- */
.provider-user-dropdown {
  position: relative;
  margin-left: 15px;
}

.provider-user-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--provider-line-soft);
  padding: 4px 12px 4px 4px;
  border-radius: 50px;
  cursor: pointer;
  color: var(--provider-txt);
  transition: all 0.2s ease;
  height: 42px;
  max-width: 200px;
  overflow: hidden;
}

.provider-user-btn:hover,
.provider-user-dropdown.active .provider-user-btn {
  background: rgba(246, 212, 107, 0.08);
  border-color: var(--provider-gold-1);
}

.provider-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--provider-gold-1);
  object-fit: cover;
  flex-shrink: 0;
}

.provider-user-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--provider-gold-3);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
}

.provider-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  line-height: 1.1;
  margin-right: 5px;
  min-width: 0;
  flex: 1;
}

.provider-user-info h4 {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0;
  color: var(--provider-txt);
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.provider-user-info p {
  font-size: 0.65rem;
  margin: 0;
  color: var(--provider-gold-1);
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.provider-user-btn i.fa-chevron-down {
  font-size: 0.7rem;
  color: var(--provider-muted);
  transition: transform 0.3s;
  flex-shrink: 0;
}

.provider-user-dropdown.active .provider-user-btn i.fa-chevron-down {
  transform: rotate(180deg);
}

.provider-user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 220px;
  background: #151214;
  border: 1px solid var(--provider-line);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: var(--z-dropdown);
}

.provider-user-dropdown.active .provider-user-menu {
  display: flex;
  animation: menuFadeIn 0.2s ease forwards;
}

@keyframes menuFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.provider-user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--provider-txt-dim);
  font-size: 0.85rem;
  text-decoration: none;
  transition: 0.2s;
}

.provider-user-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.provider-user-menu-item i {
  width: 16px;
  text-align: center;
  color: var(--provider-gold-1);
}

.provider-user-menu-item.text-danger:hover {
  background: rgba(220, 53, 69, 0.15);
  color: #ff6b6b;
}

/* --- Dashboard Widgets --- */
.provider-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.provider-stat-card {
  background: var(--provider-glass);
  border: 1px solid var(--provider-line-soft);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  position: relative;
  overflow: hidden;
}

.provider-stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
}

/* Colores de estado */
.warning .provider-stat-icon {
  color: var(--provider-pending);
  background: rgba(255, 193, 7, 0.1);
}

.completed .provider-stat-icon {
  color: var(--provider-confirmed);
  background: rgba(40, 167, 69, 0.1);
}

.primary .provider-stat-icon {
  color: var(--provider-completed);
  background: rgba(23, 162, 184, 0.1);
}

.success .provider-stat-icon {
  color: #28a745;
  background: rgba(40, 167, 69, 0.1);
}

.provider-stat-content h3 {
  font-size: 1.5rem;
  margin: 0;
  font-weight: 700;
}

.provider-stat-content p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--provider-muted);
}

.provider-stat-link {
  position: absolute;
  bottom: 15px;
  right: 15px;
  font-size: 0.75rem;
  opacity: 0.6;
}

/* --- Cards Generales --- */
.provider-card {
  background: var(--provider-glass);
  border: 1px solid var(--provider-line-soft);
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  overflow: hidden;
  height: 100%;
}

.provider-card-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--provider-line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.provider-card-header h3 {
  font-size: 1.1rem;
  margin: 0;
  color: var(--provider-gold-1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.provider-card-body {
  padding: 20px;
}

/* --- Botones --- */
.provider-btn-sm {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  border: 1px solid var(--provider-line);
  background: transparent;
  color: var(--provider-txt);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.provider-btn-sm:hover {
  border-color: var(--provider-gold-1);
  color: var(--provider-gold-1);
}

.provider-btn-primary.width-100 {
  width: 100%;
  justify-content: center;
  text-align: center;
  display: block;
  padding: 10px;
  background: var(--provider-gold-3);
  color: #000;
  border: none;
  font-weight: 600;
}

.provider-btn-primary.width-100:hover {
  background: var(--provider-gold-1);
  color: #000;
}

/* --- Overlay Móvil --- */
.provider-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  z-index: var(--z-overlay);
  opacity: 0;
  visibility: hidden;
  transition: 0.3s;
}

.provider-sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ======================
   6) RESPONSIVE MOBILE (<= 991px)
   ====================== */
@media (max-width: 991px) {

  /* Sidebar Activado por clase JS */
  .provider-sidebar.active {
    transform: translateX(0);
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
  }

  .provider-sidebar-close {
    display: block;
    /* Mostrar X para cerrar */
  }

  .provider-content {
    padding: 15px;
    padding-left: max(15px, var(--safe-left));
    padding-right: max(15px, var(--safe-right));
  }

  /* Ajustes Topbar Móvil */
  .provider-user-info {
    display: none;
    /* Ocultar nombre en móvil para ahorrar espacio */
  }

  .provider-user-btn {
    padding: 4px;
    width: 42px;
    justify-content: center;
  }

  .provider-user-btn i.fa-chevron-down {
    display: none;
  }

  .provider-topbar-logo h2 {
    font-size: 1.2rem;
    margin-left: 10px;
  }

  /* Footer apilado */
  .provider-footer-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
  }

  .provider-footer-separator {
    display: none;
  }

  /* Cards responsive */
  .provider-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .provider-card-header a {
    width: 100%;
    text-align: center;
  }

  /* Notificaciones recientes lista */
  .provider-notification-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--provider-line-soft);
    color: var(--provider-txt);
  }

  .provider-notification-row:last-child {
    border-bottom: none;
  }

  .provider-notification-row .icon {
    color: var(--provider-gold-1);
    font-size: 0.8rem;
  }

  .provider-notification-row .content h5 {
    font-size: 0.9rem;
    margin: 0 0 2px 0;
  }

  .provider-notification-row .content small {
    font-size: 0.75rem;
    color: var(--provider-muted);
  }
}

/* Estilos para la card de Mi Plan */
.provider-plan-summary {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.plan-name {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--provider-gold-1);
}

.plan-status {
  font-size: 0.9rem;
  color: var(--provider-txt-dim);
  display: flex;
  align-items: center;
  gap: 10px;
}

.plan-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 5px;
}

.plan-action {
  margin-top: auto;
}

/* ======================
   7) UTILIDADES VISUALES
   ====================== */
.provider-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  display: inline-block;
}

.provider-badge.pending {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
  border: 1px solid #ffc107;
}

.provider-badge.confirmed {
  background: rgba(40, 167, 69, 0.2);
  color: #28a745;
  border: 1px solid #28a745;
}

.provider-badge.warning {
  background: rgba(255, 87, 34, 0.2);
  color: #ff5722;
  border: 1px solid #ff5722;
}

.provider-empty-state {
  text-align: center;
  padding: 30px;
  color: var(--provider-muted);
}

.provider-empty-state i {
  font-size: 2rem;
  margin-bottom: 10px;
  opacity: 0.5;
}