/* ============================================================
   🔰 CIBIN · IMSS — Estilos globales optimizados
   Versión final compacta tipo APP para móvil
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

/* ------------------------------
   RESET + BASE
------------------------------ */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Poppins', Arial, sans-serif;
  overflow-x: hidden;
}

/* Evita zoom automático de iPhone */
html, body, input, select, textarea, button {
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}

/* ------------------------------
   🌄 FONDO GENERAL
------------------------------ */
.page-bg {
  min-height: 100vh;
  background: linear-gradient(rgba(30,41,59,0.85), rgba(15,23,42,0.9)),
              url("{{ url_for('static', filename='fondo_cibin.jpg') }}")
              center/cover fixed no-repeat;
  padding: 1.5rem;
  color: #f1f5f9;
}

/* ------------------------------
   🔝 TOPBAR INSTITUCIONAL CIBIN
   (Versión unificada)
------------------------------ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #006341;
  color: #fff;
  padding: .65rem .9rem;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  gap: .6rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.logo {
  width: 48px;
  height: 48px;
  background: #fff;
  border-radius: 8px;
  padding: .35rem;
  object-fit: contain;
}

.titles h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.subtitle {
  margin: 0;
  font-size: .78rem;
  opacity: .9;
}

.badge {
  background: #0f766e;
  padding: .3rem .65rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
}

/* ------------------------------
   📱 MÓVIL — Topbar compacta
------------------------------ */
@media (max-width: 600px) {

  .topbar {
    padding: .55rem .7rem !important;
    border-radius: 10px !important;
    gap: .5rem !important;
  }

  .logo {
    width: 42px !important;
    height: 42px !important;
    padding: .25rem !important;
  }

  .titles h1 {
    font-size: 1rem !important;
  }

  .subtitle {
    font-size: .68rem !important;
  }

  .badge {
    font-size: .6rem !important;
    padding: .25rem .5rem !important;
  }
}

/* ------------------------------
   📦 CONTENEDOR PRINCIPAL
------------------------------ */
.container {
  width: 98vw;
  max-width: 1300px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* móvil */
@media (max-width: 600px) {
  .container {
    width: 100% !important;
    padding: .7rem .9rem !important;
  }
}

/* ------------------------------
   🔲 CARDS (Tarjetas)
------------------------------ */
.card {
  background: #eaf1f7;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 1rem 1rem 1.2rem;
  width: 100%;
  box-shadow: 0 8px 20px rgba(0,0,0,.08);
  margin-bottom: 1rem;
}

.card h2, .card h3 {
  margin-top: 0;
  color: #0f766e;
}

/* móvil */
@media (max-width: 600px) {
  .card {
    padding: .85rem !important;
    border-radius: 12px !important;
  }
  .card h2, .card h3 {
    font-size: 1.05rem !important;
    text-align: center;
  }
}

/* ------------------------------
   📄 CAMPOS DE FORMULARIO
------------------------------ */
.field { display: flex; flex-direction: column; gap: .35rem; }

label {
  font-weight: 600;
  font-size: .92rem;
  color: #0b3b2e;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
textarea,
select {
  background-color: #ffffff;
  color: #1e293b;
  border: 1.5px solid #94a3b8;
  border-radius: 10px;
  padding: .55rem .75rem;
  width: 100%;
  font-size: .95rem;
  font-weight: 500;
}

input:disabled {
  background: #f1f5f9;
  color: #334155;
}

/* móvil */
@media (max-width: 600px) {
  input, select, textarea {
    font-size: 15px !important;
    padding: .55rem .7rem !important;
  }
}

/* archivos */
input[type="file"] {
  background-color: #ffffff;
  color: #1e293b;
  border: 2px solid #0f766e;
  border-radius: 10px;
  padding: 8px;
  font-weight: 600;
  cursor: pointer;
}

/* ------------------------------
   🔘 BOTONES
------------------------------ */
.btn {
  background-color: #0f766e;
  color: #ffffff;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: .55rem 1rem;
  cursor: pointer;
  transition: transform .06s ease, box-shadow .15s ease;
  text-decoration: none;
}

.btn:hover {
  background-color: #0d9488;
  box-shadow: 0 4px 12px rgba(0,0,0,0.20);
}

/* móvil */
@media (max-width: 600px) {
  .btn {
    width: 100%;
    font-size: .9rem !important;
    padding: .6rem !important;
  }
}

/* ------------------------------
   🔘 Navegación global
------------------------------ */
.nav-buttons {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-bottom: 1rem;
}

@media (max-width: 600px) {
  .nav-buttons {
    flex-direction: column;
    width: 100%;
    gap: .45rem;
  }
}

/* ------------------------------
   🧩 GRID GENERAL
------------------------------ */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem;
}

@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr !important; }
}

/* ------------------------------
   🧾 TABLAS (DataTables)
------------------------------ */
#tablaBienes_wrapper {
  width: 100% !important;
}

#tablaBienes {
  width: 100% !important;
  table-layout: auto;
  font-size: .84rem;
}

@media (max-width: 600px) {
  table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ------------------------------
   🔔 FLASH MESSAGES
------------------------------ */
.flash-wrap { margin: 1rem auto; max-width: 1000px; }
.flash {
  padding: .8rem 1rem;
  border-radius: 10px;
  margin-bottom: .6rem;
  background: #d1e7dd;
  border: 1px solid #badbcc;
  color: #0b3b2e;
}

/* ------------------------------
   🦶 FOOTER
------------------------------ */
.footer {
  text-align: center;
  margin-top: 3rem;
  color: #e2e8f0;
  font-size: .85rem;
  opacity: .9;
}

@media (max-width: 600px) {
  .footer {
    font-size: .75rem;
    margin-top: 2rem;
  }
}



/* ============================================================
   📱 FIX DEFINITIVO PARA MÓVIL
   Compacta tarjetas, inputs y botones — tipo app IMSS
   ============================================================ */

@media (max-width: 600px) {

  /* 🔹 Tarjetas compactas */
  .card {
    width: 100% !important;
    padding: 0.9rem !important;
    border-radius: 12px !important;
    margin: 0.6rem auto !important;
    box-shadow: 0 4px 10px rgba(0,0,0,.15) !important;
  }

  .card h2,
  .card h3 {
    font-size: 1.05rem !important;
    text-align: center !important;
    margin-bottom: .5rem !important;
  }

  /* 🔹 Contenedor más delgado */
  .container {
    width: 100% !important;
    padding: 0.8rem 1rem !important;
  }

  /* 🔹 Inputs compactos */
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="date"],
  textarea,
  select {
    padding: 0.55rem 0.75rem !important;
    font-size: 15px !important;
    border-radius: 10px !important;
  }

  /* 🔹 Botones más pequeños */
  .btn {
    width: 100% !important;
    font-size: 0.9rem !important;
    padding: 0.65rem !important;
    border-radius: 10px !important;
    text-align: center !important;
  }

  /* 🔹 Nav-buttons verticales */
  .nav-buttons {
    flex-direction: column !important;
    width: 100% !important;
    gap: .4rem !important;
  }

  /* 🔹 Grids se vuelven 1 columna */
  .grid {
    grid-template-columns: 1fr !important;
    gap: .7rem !important;
  }

  /* 🔹 Reducir texto largo */
  label {
    font-size: .9rem !important;
  }

  /* 🔹 Evitar zoom automático */
  input, select, textarea {
    -webkit-text-size-adjust: 100% !important;
  }
}









/* ==========================================================
   📌 SIDEBAR ESTILO IMSS – RESPONSIVA
========================================================== */

.menu-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.6rem;
  cursor: pointer;
  margin-right: .5rem;
}

.sidebar {
  position: fixed;
  left: -260px;
  top: 0;
  width: 260px;
  height: 100%;
  background: #0f3d32;
  padding: 1.2rem;
  box-shadow: 4px 0 12px rgba(0,0,0,.2);
  transition: left .25s ease;
  z-index: 2000;
}

.sidebar.open {
  left: 0;
}

.sidebar-title {
  color: #a7f3d0;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.side-link {
  display: block;
  padding: .55rem .6rem;
  margin-bottom: .4rem;
  background: rgba(255,255,255,0.1);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  transition: background .2s;
}

.side-link:hover {
  background: rgba(255,255,255,0.25);
}

.close-btn {
  background: transparent;
  border: none;
  color: white;
  float: right;
  font-size: 1.3rem;
  cursor: pointer;
}

/* Overlay para móvil */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1500;
}

.overlay.show {
  display: block;
}

/* 🟩 Móvil */
@media (max-width: 700px) {
  .sidebar {
    width: 75%;
    max-width: 260px;
  }
}


/* ============================================================
   PANTALLA LIMPIA DEL MÓDULO — FONDO AZUL + FOTO CIBIN
============================================================ */
.landing-empty {
  width: 100%;
  min-height: 70vh;

  background:
    linear-gradient(to bottom,
      rgba(232,243,255,0.85),
      rgba(232,243,255,0.95)
    ),
    url("{{ url_for('static', filename='fondo_cibin.jpg') }}");

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  border-radius: 14px;
  box-shadow: 0 5px 12px rgba(0,0,0,.08);

  display: flex;
  justify-content: center;
  align-items: center;

  color: #1e3a5f;
  font-size: 1.2rem;
  text-align: center;
  padding: 2rem;
}


.side-separator {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.25);
  margin: 1rem 0 .8rem;
}

.home-link {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25);
  font-weight: 600;
}



/* ==============================
   Flash Message estilo APP IMSS
============================== */
.flash-container {
  margin: 1rem 0;
  display: flex;
  justify-content: center;
  width: 100%;
  animation: fadeSlideIn .4s ease;
}

.flash-message {
  background: #0f766e;
  color: white;
  padding: 0.9rem 1.2rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  max-width: 85%;
}

/* Animación */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ============================================================
   FIX — Scroll horizontal garantizado en Mis Bienes
=========================================================== */
.table-wrap {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

.table-wrap .table-bienes {
  min-width: 1000px !important;   /* Fuerza scroll */
  width: max-content !important;  /* Se adapta al contenido real */
}

.table-bienes th,
.table-bienes td {
  white-space: nowrap !important;  /* Evita que rompa renglón */
}


/* ============================================================
   📱 FIX PARA EL FORMULARIO DE ESTUDIANTES (fila .row)
   Evita que los grids de 2 y 4 columnas se amontonen en móvil
   ============================================================ */

@media (max-width: 768px) {

  /* Todas las filas del formulario se vuelven verticales */
  .row {
    display: block !important;
  }

  /* Cada bloque dentro de .row a 100% */
  .row > div {
    width: 100% !important;
    margin-bottom: 1rem !important;
  }

  /* Cualquier row que tenga un grid inline se corrige */
  .row[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* Inputs más grandes para móvil */
  .row input,
  .row textarea,
  .row select {
    width: 100% !important;
    font-size: 1rem !important;
    padding: 0.85rem !important;
    border-radius: 10px !important;
  }

  /* Botones alineados verticales */
  .actions {
    display: flex !important;
    flex-direction: column !important;
    gap: .8rem !important;
  }

  .actions .btn {
    width: 100% !important;
    padding: 1rem !important;
    border-radius: 12px !important;
    font-size: 1rem !important;
  }

  /* Vista previa de fotos más compacta */
  #previewEst div {
    width: 100px !important;
    height: 100px !important;
  }
}
