/* ==========================================================
   GlobPay - Panel del Vendedor (Estilos de Pantalla Inicio)
   dashboard.css
   
   Estructura visual oficial fiel a la maqueta de referencia:
   - Composición, espacios, tarjetas, tipografía y acentos turquesa.
   - 4 indicadores comerciales protegidos multi-tienda.
   - Accesos rápidos conectados con funciones existentes.
   - Lista o estado vacío honesto de últimos pedidos.
   - Responsividad adaptada para anchos 360px, 390px, 430px y escritorio.
   ========================================================== */

/* Lienzo Principal de la App */
.dashboard-canvas {
  flex-grow: 1;
  background-color: #F7F9FA;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: #111827;
  overflow-y: auto;
  min-width: 0;
  width: 100%;
}

/* ----------------------------------------------------------
   BARRA SUPERIOR DE LA APLICACIÓN GLOBPAY
   ---------------------------------------------------------- */
.globpay-app-topbar {
  background-color: #ffffff;
  border-bottom: 1px solid #E5E7EB;
  height: 52px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 100%;
}

.globpay-app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.globpay-topbar-icon {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  object-fit: contain;
}

.globpay-topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  letter-spacing: -0.2px;
}

.globpay-app-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.globpay-icon-btn {
  background: transparent;
  border: none;
  color: #6B7280;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.globpay-icon-btn:hover {
  background-color: #F3F4F6;
  color: #111827;
}

/* ----------------------------------------------------------
   CONTENEDOR CENTRAL DE PÁGINA
   ---------------------------------------------------------- */
.dashboard-main-content {
  max-width: 1060px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 28px 60px 28px;
  box-sizing: border-box;
}

/* Encabezado de la Pantalla Inicio */
.dashboard-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-header-titles {
  display: flex;
  flex-direction: column;
}

.dashboard-page-title {
  font-size: 26px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 4px 0;
  letter-spacing: -0.4px;
}

.dashboard-page-subtitle {
  font-size: 14px;
  color: #6B7280;
  margin: 0;
}

.store-context-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #4B5563;
  background-color: #EBF7F6;
  border: 1px solid #BEECE7;
  border-radius: 12px;
  padding: 3px 10px;
  width: fit-content;
}

.store-context-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #0BB6B5;
}

/* Botón "Ver mi formulario" (Estilo Polaris Button) */
.btn-view-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #ffffff;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: #1F2937;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-view-form:hover {
  background-color: #F9FAFB;
  border-color: #9CA3AF;
  color: #111827;
}

/* ----------------------------------------------------------
   BANNER DE VISTA DE ESTRUCTURA / AVISO DE SIMULACIÓN
   ---------------------------------------------------------- */
.dashboard-structure-banner {
  background-color: #E8F8F5;
  border: 1px solid #B4EFE6;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #087877;
}

.banner-info-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: #0BB6B5;
}

.banner-text {
  font-weight: 500;
}

/* ----------------------------------------------------------
   ESTILO BASE DE TARJETAS
   ---------------------------------------------------------- */
.dashboard-card {
  background-color: #ffffff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  margin-bottom: 20px;
  box-sizing: border-box;
}

/* ----------------------------------------------------------
   TARJETA 1: ESTADO DE TU TIENDA
   ---------------------------------------------------------- */
.status-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-card-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.store-status-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Estados Honestos */
.store-status-badge.in_preparation {
  background-color: #F3F4F6;
  border: 1px solid #E5E7EB;
  color: #374151;
}

.store-status-badge.pending_configuration {
  background-color: #FEF3C7;
  border: 1px solid #FDE68A;
  color: #92400E;
}

.store-status-badge.sales_active {
  background-color: #D1FAE5;
  border: 1px solid #A7F3D0;
  color: #065F46;
}

.status-card-desc {
  font-size: 13.5px;
  color: #4B5563;
  margin: 6px 0 10px 0;
}

.status-card-link {
  color: #087877;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease;
}

.status-card-link:hover {
  color: #05504f;
  text-decoration: underline;
}

/* ----------------------------------------------------------
   CUATRO INDICADORES (GRID DE 4 COLUMNAS)
   ---------------------------------------------------------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  background-color: #ffffff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 104px;
  box-sizing: border-box;
}

.metric-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.metric-icon {
  width: 20px;
  height: 20px;
  color: #374151;
  flex-shrink: 0;
}

.metric-label {
  font-size: 13.5px;
  font-weight: 600;
  color: #1F2937;
  line-height: 1.2;
}

.metric-value-row {
  margin-top: 14px;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.5px;
  line-height: 1;
}

.metric-subnote {
  font-size: 11px;
  color: #9CA3AF;
  margin-top: 4px;
}

.metric-error {
  font-size: 11px;
  color: #DC2626;
  margin-top: 4px;
}

/* ----------------------------------------------------------
   TARJETA 2: ACCESOS RÁPIDOS
   ---------------------------------------------------------- */
.quick-actions-card {
  padding-bottom: 22px;
}

.quick-actions-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 14px 0;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.quick-action-btn {
  background-color: #ffffff;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #1F2937;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.quick-action-btn:hover {
  background-color: #F9FAFB;
  border-color: #D1D5DB;
  color: #111827;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.quick-action-icon {
  width: 18px;
  height: 18px;
  color: #4B5563;
  flex-shrink: 0;
}

/* ----------------------------------------------------------
   TARJETA 3: ÚLTIMOS PEDIDOS
   ---------------------------------------------------------- */
.recent-orders-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.recent-orders-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.recent-orders-link {
  color: #087877;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.recent-orders-link:hover {
  color: #05504f;
  text-decoration: underline;
}

/* Estado Vacío Honesto */
.orders-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px 20px;
  text-align: center;
}

.empty-box-icon {
  width: 48px;
  height: 48px;
  color: #9CA3AF;
  margin-bottom: 12px;
}

.empty-state-text {
  font-size: 13.5px;
  color: #6B7280;
  margin: 0;
}

/* Tabla de Pedidos cuando existen datos comerciales */
.orders-table-wrapper {
  overflow-x: auto;
  border: 1px solid #F3F4F6;
  border-radius: 8px;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.orders-table th {
  background-color: #F9FAFB;
  color: #4B5563;
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid #E5E7EB;
  white-space: nowrap;
}

.orders-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #F3F4F6;
  color: #1F2937;
  white-space: nowrap;
}

.orders-table tr:last-child td {
  border-bottom: none;
}

.order-badge-payment {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 500;
}

.order-badge-payment.Abonado,
.order-badge-payment.partially_paid {
  background-color: #EBF8F7;
  color: #087877;
  border: 1px solid #B8EBE3;
}

.order-badge-payment.Pagado,
.order-badge-payment.paid {
  background-color: #D1FAE5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

/* ----------------------------------------------------------
   FILA INFERIOR: MI PLAN Y AYUDA
   ---------------------------------------------------------- */
.bottom-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.bottom-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background-color: #ffffff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  box-sizing: border-box;
}

.bottom-card-icon {
  width: 24px;
  height: 24px;
  color: #374151;
  flex-shrink: 0;
  margin-top: 2px;
}

.bottom-card-body {
  display: flex;
  flex-direction: column;
}

.bottom-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 4px 0;
}

.bottom-card-desc {
  font-size: 13px;
  color: #6B7280;
  margin: 0 0 10px 0;
}

.bottom-card-plan-note {
  font-size: 12px;
  color: #D97706;
  font-weight: 500;
  margin: 0 0 8px 0;
}

.bottom-card-link {
  color: #087877;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  width: fit-content;
}

.bottom-card-link:hover {
  color: #05504f;
  text-decoration: underline;
}

/* ----------------------------------------------------------
   VISTAS DE SECCIONES (ROUTING INTERNO DE VISTAS)
   ---------------------------------------------------------- */
.dashboard-section-view {
  display: none;
}

.dashboard-section-view.is-active {
  display: block;
}

.section-placeholder-card {
  background-color: #ffffff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 40px 28px;
  text-align: center;
  margin-top: 16px;
}

.section-placeholder-icon {
  width: 44px;
  height: 44px;
  color: #0BB6B5;
  margin-bottom: 14px;
}

.section-placeholder-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 8px 0;
}

.section-placeholder-msg {
  font-size: 14px;
  color: #6B7280;
  max-width: 500px;
  margin: 0 auto 20px auto;
  line-height: 1.5;
}

.btn-back-to-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #ffffff;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: #1F2937;
  text-decoration: none;
  cursor: pointer;
}

.btn-back-to-home:hover {
  background-color: #F9FAFB;
}

/* Conexiones en Vista de Sección */
.connections-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  text-align: left;
  margin: 24px 0;
}

.connection-item-box {
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 16px;
  background: #F9FAFB;
}

.connection-item-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.connection-item-desc {
  font-size: 12.5px;
  color: #6B7280;
  margin: 0;
}

/* ----------------------------------------------------------
   RESPONSIVIDAD Y ADAPTACIÓN A DISPOSITIVOS MÓVILES
   Verificación en 430px, 390px y 360px
   ---------------------------------------------------------- */

@media (max-width: 900px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-actions-grid {
    grid-template-columns: 1fr;
  }

  .bottom-cards-grid {
    grid-template-columns: 1fr;
  }

  .connections-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .dashboard-main-content {
    padding: 16px 14px 40px 14px;
  }

  .globpay-app-topbar {
    padding: 0 16px;
  }

  .dashboard-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-view-form {
    width: 100%;
    justify-content: center;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .dashboard-card {
    padding: 16px;
  }

  .quick-action-btn {
    padding: 12px 14px;
  }
}
