/* ============================================================
   INFORURAL - CSS RESPONSIVE COMPLETO
   Optimizado para celular y notebook
   Compatible con Oracle APEX 24.1 + Universal Theme
   ============================================================ */

/* ===== VARIABLES DE COLOR ===== */
:root {
  --ir-verde-oscuro: #3d5028;
  --ir-verde: #6b8e4e;
  --ir-verde-claro: #8fb368;
  --ir-verde-pasto: #c8d9a8;
  --ir-tierra: #8b5a2b;
  --ir-tierra-clara: #a8784a;
  --ir-tierra-oscura: #5a3a1e;
  --ir-crema: #faf6ed;
  --ir-amarillo: #e8a93d;
  --ir-rojo: #c8442a;
  --ir-gris-fondo: #f5f5f0;
  --ir-sombra: 0 2px 8px rgba(61, 80, 40, 0.08);
  --ir-sombra-hover: 0 4px 16px rgba(61, 80, 40, 0.15);
}

/* ============================================================
   1. ESTILO GLOBAL Y TIPOGRAFÍA
   ============================================================ */

body {
  background-color: var(--ir-gris-fondo) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3, h4, .t-Region-title {
  color: var(--ir-verde-oscuro) !important;
  font-weight: 700;
}

/* ============================================================
   2. HEADER (NAVBAR SUPERIOR)
   ============================================================ */

.t-Header {
  background: linear-gradient(135deg, var(--ir-verde-oscuro) 0%, var(--ir-verde) 100%) !important;
  border-bottom: 3px solid var(--ir-tierra) !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important;
}

.t-Header-logo {
  padding: 8px 15px !important;
}

.t-Header-logo a {
  color: white !important;
  font-weight: 700 !important;
  font-size: 1.3em !important;
}

/* ============================================================
   3. MENÚ LATERAL (NAV TREE)
   ============================================================ */

.t-TreeNav,
.t-Body-nav {
  background-color: #2c3a1d !important;
}

.a-TreeView-content {
  color: #e8e8e8 !important;
  transition: all 0.2s ease;
}

.a-TreeView-content:hover {
  background-color: var(--ir-verde) !important;
  color: white !important;
}

.a-TreeView-node.is-selected > .a-TreeView-content,
.a-TreeView-content.is-current {
  background-color: var(--ir-verde) !important;
  color: white !important;
  border-left: 4px solid var(--ir-amarillo) !important;
}

/* ============================================================
   4. CARDS / TARJETAS (Iconos principales)
   ============================================================ */
 /* ============================================================
   4. CARDS / TARJETAS (región "Cards" = .a-CardView)
   ============================================================ */

/* La tarjeta en sí (sirve para el template viejo t-Card y la región Cards) */
.t-Card,
.t-Cards-item,
.a-CardView {
  border-radius: 12px !important;
  border: 1px solid #e0e0d8 !important;
  box-shadow: var(--ir-sombra) !important;
  transition: all 0.25s ease !important;
  overflow: hidden;
}

.t-Card:hover,
.t-Cards-item:hover,
.a-CardView:hover {
  transform: translateY(-3px) !important;
  box-shadow: var(--ir-sombra-hover) !important;
  border-color: var(--ir-verde-claro) !important;
}

/* ⭐ FIX DE ÍCONOS: el tema pide la fuente "Font APEX", pero en este
   servidor las fuentes se llaman "Font APEX Small/Large". Esto lo corrige. */
.a-CardView-icon::before {
  font-family: "Font APEX Large", "Font APEX Small" !important;
}

/* (OPCIONAL) Si querés que TODOS los círculos sean verde InfoRural,
   en vez de los colores u-color-N que pones en el SQL, descomentá: */
/*
.a-CardView-icon {
  background-color: var(--ir-verde) !important;
  color: #fff !important;
}
*/
/* ============================================================
   5. REGIÓN DE FILTROS (Colapsable y compacta)
   ============================================================ */

.t-Region--filters,
.t-Region[id*="filter"] {
  background-color: white !important;
  border-radius: 10px !important;
  border: 1px solid #e0e0d8 !important;
  margin-bottom: 15px !important;
}

/* En celular, los filtros se compactan */
@media (max-width: 768px) {
  .t-Region--filters .t-Form-fieldContainer {
    margin-bottom: 8px !important;
  }
}

/* ============================================================
   6. BOTONES
   ============================================================ */

.t-Button--hot {
  background-color: var(--ir-verde) !important;
  border-color: var(--ir-verde) !important;
  color: white !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  transition: all 0.2s ease !important;
}

.t-Button--hot:hover {
  background-color: var(--ir-verde-oscuro) !important;
  border-color: var(--ir-verde-oscuro) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(61, 80, 40, 0.2);
}

.t-Button {
  border-radius: 8px !important;
  font-weight: 500 !important;
}

/* ============================================================
   7. CAMPOS DE FORMULARIO
   ============================================================ */

.apex-item-text:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: var(--ir-verde) !important;
  box-shadow: 0 0 0 3px rgba(107, 142, 78, 0.15) !important;
  outline: none !important;
}

/* ============================================================
   8. REPORTES / TABLAS
   ============================================================ */

.a-IRR-table thead th,
.t-Report-report thead th,
.a-GV-table thead th {
  background-color: var(--ir-verde-oscuro) !important;
  color: white !important;
  font-weight: 600 !important;
}

.a-IRR-table tbody tr:hover,
.t-Report-report tbody tr:hover {
  background-color: var(--ir-verde-pasto) !important;
}

/* TABLAS RESPONSIVE EN CELULAR */
@media (max-width: 640px) {
  .a-IRR-table,
  .t-Report-report {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}

/* ============================================================
   9. GRÁFICOS Y CHARTS
   ============================================================ */

.t-Region:has(.oj-chart),
.t-Region--chart {
  background-color: white !important;
  border-radius: 12px !important;
  box-shadow: var(--ir-sombra) !important;
  padding: 15px !important;
}

/* En celular los gráficos ocupan ancho completo */
@media (max-width: 768px) {
  .oj-chart {
    width: 100% !important;
    height: auto !important;
    min-height: 250px;
  }
}

/* ============================================================
   10. ESTABLECIMIENTO BAR (banner superior con CM)
   ============================================================ */

[id*="establecimiento"],
.t-Region--alert {
  background-color: var(--ir-verde-pasto) !important;
  border-left: 4px solid var(--ir-verde) !important;
  border-radius: 8px !important;
  padding: 10px 15px !important;
}

/* ============================================================
   11. 📱 RESPONSIVE PARA CELULAR - MUY IMPORTANTE
   ============================================================ */

/* Pantallas hasta 768px (tablets y celulares) */
@media (max-width: 768px) {
  
  /* Reducir padding general */
  .t-Body-content,
  .t-Body-main {
    padding: 8px !important;
  }
  
  /* Cards en grid de 2 columnas en celular */
  .t-Cards.t-Cards--cols {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  
  /* Texto de cards más chico */
  .t-Card-title {
    font-size: 0.9em !important;
  }
  
  /* Header más compacto */
  .t-Header {
    padding: 5px 10px !important;
  }
  
  /* Ocultar texto largo del header en celular */
  .t-Header-logo a span {
    display: none;
  }
  
  /* Botones más grandes y fáciles de tocar */
  .t-Button {
    min-height: 44px !important;
    padding: 10px 20px !important;
    font-size: 1em !important;
  }
  
  /* Inputs más grandes para no errar al tocar */
  input, select, textarea {
    min-height: 44px !important;
    font-size: 16px !important; /* Evita el zoom automático en iOS */
  }
  
  /* Regiones con menos margin */
  .t-Region {
    margin-bottom: 10px !important;
  }
  
  /* Títulos más compactos */
  .t-Region-title {
    font-size: 1.1em !important;
  }
}

/* Pantallas muy chicas (celulares antiguos, hasta 480px) */
@media (max-width: 480px) {
  
  /* Cards en 1 columna en pantallas muy chicas */
  .t-Cards.t-Cards--cols {
    grid-template-columns: 1fr !important;
  }
  
  /* Cards más pequeñas */
  .t-Card {
    padding: 12px !important;
  }
  
  /* Filtros apilados */
  .t-Form-fieldContainer {
    width: 100% !important;
    margin-right: 0 !important;
  }
}

/* ============================================================
   12. 💻 NOTEBOOK Y DESKTOP - OPTIMIZACIONES
   ============================================================ */

@media (min-width: 1024px) {
  
  /* Cards más espaciadas en pantallas grandes */
  .t-Cards.t-Cards--cols {
    gap: 16px !important;
  }
  
  /* Contenedor con max-width para no expandirse demasiado */
  .t-Body-contentInner {
    max-width: 1600px;
    margin: 0 auto;
  }
}

/* ============================================================
   13. SCROLL PERSONALIZADO
   ============================================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--ir-crema);
}

::-webkit-scrollbar-thumb {
  background: var(--ir-verde);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ir-verde-oscuro);
}

/* ============================================================
   14. ALERTAS Y NOTIFICACIONES
   ============================================================ */

.t-Alert--success {
  background-color: var(--ir-verde-pasto) !important;
  border-color: var(--ir-verde) !important;
  color: var(--ir-verde-oscuro) !important;
}

.t-Alert--warning {
  background-color: #fff3d4 !important;
  border-color: var(--ir-amarillo) !important;
  color: #8b6914 !important;
}

.t-Alert--danger {
  background-color: #fde4de !important;
  border-color: var(--ir-rojo) !important;
}

/* ============================================================
   15. LINKS
   ============================================================ */

a {
  color: var(--ir-verde-oscuro);
  transition: color 0.2s ease;
}

a:hover {
  color: var(--ir-tierra);
}

/* ============================================================
   16. BREADCRUMBS Y NAVEGACIÓN
   ============================================================ */

.t-Breadcrumb-item a {
  color: var(--ir-verde-oscuro) !important;
}

.t-Breadcrumb-item--current .t-Breadcrumb-label {
  color: var(--ir-tierra) !important;
  font-weight: 600;
}

/* ============================================================
   17. DARK MODE EN HEADER DEL DEV (cuando estás editando)
   ============================================================ */

/* Asegurar que la barra de desarrollo de APEX no rompa el diseño */
#apexDevToolbar {
  background-color: rgba(45, 58, 29, 0.95) !important;
}

/* ============================================================
   18. TOQUES FINALES DE IDENTIDAD RURAL
   ============================================================ */

/* Animación sutil al cargar páginas */
.t-Body-content {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Selección de texto en color InfoRural */
::selection {
  background-color: var(--ir-verde-pasto);
  color: var(--ir-verde-oscuro);
}

/* ============================================================
   TÍTULOS DE REGIÓN - Estilo InfoRural (barrita amarilla)
   ============================================================ */
.t-Region-header .t-Region-title {
  color: var(--ir-verde-oscuro) !important;   /* verde oscuro */
  font-size: 1.3rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.2px !important;
  padding-left: 12px !important;
  border-left: 5px solid var(--ir-amarillo) !important;  /* barrita amarilla */
  line-height: 1.25 !important;
}

/* Un poco de aire alrededor del encabezado */
.t-Region-header {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  margin-bottom: 6px !important;
  border-bottom: 1px solid #ece9e0 !important;  /* línea sutil debajo */
}