/* ==========================================================================
   SMARTBERRY ONE — SISTEMA DE DISEÑO Y EXPERIENCIA MÓVIL (MOBILE-FIRST)
   Diseñado específicamente para smartphones (iOS / Android) y tablets.
   ========================================================================== */

/* ── REGLAS GLOBALES MÓVILES Y ANTI-ZOOM ── */
@media (max-width: 768px) {
  /* Evitar zoom molesto en iOS Safari al hacer focus en inputs */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="number"],
  input[type="date"],
  select,
  textarea,
  .form-control,
  .form-select {
    font-size: 16px !important;
    min-height: 48px !important;
    border-radius: 10px !important;
    touch-action: manipulation;
  }

  /* Microinteracciones táctiles nativas */
  button,
  .btn,
  .portal-link,
  .smart-action-tile,
  .smart-kpi-chip,
  a {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  button:active,
  .btn:active,
  .smart-action-tile:active {
    transform: scale(0.975);
    transition: transform 0.1s ease;
  }

  /* Scroll horizontal suave para contenedores táctiles */
  .smart-scroll-x {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 10px;
    padding-bottom: 6px;
  }
  .smart-scroll-x::-webkit-scrollbar {
    display: none;
  }
  .smart-scroll-x > * {
    scroll-snap-align: start;
    flex-shrink: 0;
  }
}

/* ── EMBLEMA Y LOGO DESTACADO PARA LOGINS Y HOME (BRAND SHOWCASE) ── */
.brand-logo-showcase {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 16px 28px 14px;
  border-radius: 22px;
  box-shadow: 0 12px 32px rgba(12, 53, 106, 0.14), 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1.5px solid #eef2f7;
  margin-bottom: 20px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-logo-showcase:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(12, 53, 106, 0.18), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.brand-logo-showcase img {
  height: 72px;
  max-width: 250px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(12, 53, 106, 0.16));
  display: block;
}

.brand-logo-showcase .brand-pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 12px;
  border-radius: 100px;
  margin-top: 8px;
}

/* Variantes temáticas de píldoras de módulo */
.brand-pill-tag.fruta { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.brand-pill-tag.exportadora { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.brand-pill-tag.materiales { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.brand-pill-tag.calidad { background: #fefce8; color: #a16207; border: 1px solid #fef08a; }
.brand-pill-tag.productor { background: #fdf2f8; color: #be185d; border: 1px solid #fbcfe8; }
.brand-pill-tag.estadistica { background: #faf5ff; color: #7e22ce; border: 1px solid #e9d5ff; }
.brand-pill-tag.general { background: #f1f5f9; color: #0c356a; border: 1px solid #cbd5e1; }

/* ── TARJETAS EJECUTIVAS PARA EL PORTAL DE INICIO (HOME PORTAL CARDS) ── */
.smart-portal-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.smart-portal-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px 18px;
  text-decoration: none !important;
  color: #1e293b;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.smart-portal-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 5px;
  background: transparent;
  transition: background 0.2s ease;
}

.smart-portal-card.card-fruta::before { background: #10b981; }
.smart-portal-card.card-expo::before { background: #2563eb; }
.smart-portal-card.card-prod::before { background: #e11d48; }

.smart-portal-card:hover,
.smart-portal-card:focus {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(12, 53, 106, 0.12);
  border-color: #0c356a;
  color: #0c356a;
}

.smart-portal-card:active {
  transform: scale(0.985);
}

.smart-portal-card .card-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.smart-portal-card.card-fruta .card-icon-box {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
}

.smart-portal-card.card-expo .card-icon-box {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
}

.smart-portal-card.card-prod .card-icon-box {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #ffffff;
}

.smart-portal-card .card-body-text {
  flex: 1;
}

.smart-portal-card .card-body-text strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 2px;
}

.smart-portal-card .card-body-text small {
  display: block;
  font-size: 12px;
  color: #64748b;
  line-height: 1.35;
}

.smart-portal-card .card-action-pill {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.smart-portal-card:hover .card-action-pill {
  background: #0c356a;
  color: #ffffff;
  transform: translateX(3px);
}

/* ── ENCABEZADO DE APP MÓVIL (MOBILE APP BAR) ── */
.smart-mobile-bar {
  background: linear-gradient(135deg, #071e3d 0%, #0c356a 55%, #1e3a8a 100%);
  color: #ffffff;
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 10px 28px rgba(7, 30, 61, 0.22);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.smart-mobile-bar::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(94, 184, 122, 0.2) 0%, rgba(147, 197, 253, 0.1) 50%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.smart-mobile-bar .app-tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #93c5fd;
  display: inline-block;
}

.smart-mobile-bar .user-name {
  font-size: 19px;
  font-weight: 800;
  margin: 2px 0 0;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.smart-mobile-bar .env-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.smart-mobile-bar .env-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-weight: 600;
  font-size: 11.5px;
}

/* ── COMPONENTES DEL HEADER DE DASHBOARD MÓVIL ── */
.app-logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.status-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.35);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.4);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* ── GRID DE ACCESOS RÁPIDOS TÁCTILES (ACTION TILES) ── */
.smart-action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.smart-action-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px 12px 14px;
  text-decoration: none !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 115px;
  position: relative;
  overflow: hidden;
}

.smart-action-tile::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: transparent;
}

.smart-action-tile.tile-blue::before { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.smart-action-tile.tile-amber::before { background: linear-gradient(90deg, #d97706, #fbbf24); }
.smart-action-tile.tile-red::before { background: linear-gradient(90deg, #dc2626, #f87171); }
.smart-action-tile.tile-green::before { background: linear-gradient(90deg, #16a34a, #4ade80); }
.smart-action-tile.tile-purple::before { background: linear-gradient(90deg, #7c3aed, #a78bfa); }

.smart-action-tile:hover,
.smart-action-tile:focus {
  border-color: #0c356a;
  box-shadow: 0 8px 24px rgba(12, 53, 106, 0.12);
  transform: translateY(-2px);
  color: #0c356a;
}

.smart-action-tile:active {
  transform: scale(0.975);
}

.smart-action-tile .tile-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.tile-blue .tile-icon { background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%); color: #0284c7; }
.tile-amber .tile-icon { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); color: #d97706; }
.tile-red .tile-icon { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%); color: #dc2626; }
.tile-green .tile-icon { background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%); color: #15803d; }
.tile-purple .tile-icon { background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%); color: #7c3aed; }
.tile-indigo .tile-icon { background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%); color: #4338ca; }

.smart-action-tile .tile-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  margin-bottom: 4px;
}

.smart-action-tile .tile-subtitle {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  display: inline-block;
}

.tile-blue .tile-subtitle { background: #f0f9ff; color: #0284c7; }
.tile-amber .tile-subtitle { background: #fffbeb; color: #b45309; }
.tile-red .tile-subtitle { background: #fef2f2; color: #b91c1c; }
.tile-green .tile-subtitle { background: #f0fdf4; color: #15803d; }
.tile-purple .tile-subtitle { background: #faf5ff; color: #6b21a8; }
.tile-indigo .tile-subtitle { background: #eef2ff; color: #4338ca; }

/* ── TARJETAS Y CHIPS KPI MÓVILES ── */
.smart-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.smart-kpi-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px 14px 12px;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
  position: relative;
  overflow: hidden;
}

.smart-kpi-card .kpi-lbl {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.smart-kpi-card .kpi-val {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: -0.02em;
}

.smart-kpi-card .kpi-sub {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  margin-top: 3px;
}

.smart-kpi-card .kpi-sub {
  font-size: 10.5px;
  color: #94a7c8;
  margin-top: 2px;
}

/* ── SEMÁFORO DE OPERACIONES PENDIENTES ── */
.smart-pending-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.smart-pending-card .card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.smart-pending-card .card-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.smart-pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  text-decoration: none !important;
  color: #1e293b;
  margin-bottom: 6px;
  border: 1px solid #f1f5f9;
  font-size: 12.5px;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.smart-pending-item:last-child {
  margin-bottom: 0;
}

.smart-pending-item:hover,
.smart-pending-item:active {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.smart-pending-item .badge-pill {
  min-width: 26px;
  height: 22px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  padding: 0 8px;
}

/* ── ESTILOS MÓVILES PARA LOGIN Y ACCESO ── */
@media (max-width: 768px) {
  .smart-login-page {
    background: #f4f6f8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
  }

  .smart-login-mobile-top {
    background: linear-gradient(180deg, #0c356a 0%, #122044 100%);
    padding: 24px 20px 28px;
    text-align: center;
    color: #ffffff;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    box-shadow: 0 8px 24px rgba(12, 53, 106, 0.18);
    position: relative;
  }

  .smart-login-mobile-top img {
    height: 52px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
    margin-bottom: 8px;
  }

  .smart-login-mobile-top .tagline {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #5eb87a;
    margin: 0;
  }

  .smart-login-mobile-top .subtitle {
    font-size: 12.5px;
    color: #cbd5e1;
    margin-top: 4px;
  }

  .smart-login-container {
    padding: 0 16px;
    margin-top: -16px;
    position: relative;
    z-index: 10;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }

  .smart-login-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 24px 20px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
  }

  .smart-login-card .form-title {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
  }

  .smart-login-card .form-subtitle {
    font-size: 12.5px;
    color: #64748b;
    margin-bottom: 18px;
  }

  /* Píldoras selectoras de módulo táctiles */
  .smart-module-pills {
    display: flex;
    gap: 6px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 18px;
  }

  .smart-module-pill {
    flex: 1;
    text-align: center;
    padding: 9px 4px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    border: none;
    background: transparent;
    transition: all 0.2s ease;
  }

  .smart-module-pill.active {
    background: #ffffff;
    color: #0c356a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  }

  .smart-input-group {
    margin-bottom: 14px;
    position: relative;
  }

  .smart-input-group label {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
    display: block;
  }

  .smart-input-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    background: #ffffff;
    padding: 0 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
  }

  .smart-input-wrap:focus-within {
    border-color: #0c356a;
    box-shadow: 0 0 0 3px rgba(12, 53, 106, 0.12);
  }

  .smart-input-wrap i.lead-icon {
    font-size: 1.1rem;
    color: #94a3b8;
    margin-right: 10px;
  }

  .smart-input-wrap input {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 13px 0 !important;
    width: 100%;
    background: transparent;
    font-size: 16px !important;
    color: #0f172a;
  }

  .smart-input-wrap .btn-toggle-eye {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    padding: 0;
    cursor: pointer;
    line-height: 1;
  }

  .smart-btn-primary {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0c356a 0%, #1e3a8a 100%);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    border: none;
    box-shadow: 0 4px 14px rgba(12, 53, 106, 0.25);
    margin-top: 6px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  .smart-btn-primary:active {
    background: #072146;
  }

  /* Portal Links en index.php */
  .smart-portal-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    text-decoration: none !important;
    color: #0f172a;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  }

  .smart-portal-link:hover,
  .smart-portal-link:active {
    border-color: #0c356a;
    box-shadow: 0 4px 14px rgba(12, 53, 106, 0.1);
  }

  .smart-portal-link .icon-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
  }

  .smart-portal-link .txt strong {
    font-size: 14px;
    font-weight: 700;
    display: block;
    color: #0f172a;
  }

  .smart-portal-link .txt small {
    font-size: 12px;
    color: #64748b;
  }

  .smart-portal-link .chevron {
    margin-left: auto;
    color: #94a3b8;
  }
}
