@import url('font-inter.css');
:root {
  --primarycolor: #1984bc;
  --primarycolorhover: #094361;
  --btnice:#D8EBFA;
  --btnnicetext:#21475b;
}

body{
    margin: 0;
    padding: 0;
    border-spacing: 0;
    font-family: 'Inter', sans-serif;
}

*, ::after, ::before{
    box-sizing: border-box;
}


/*------custom-scroll-bar - from w3schools.com------------------*/
/* width */
::-webkit-scrollbar {
    width: 5px;
  }
  
  /* Track */
  ::-webkit-scrollbar-track {
    background: #fd7d1c; 
  }
   
  /* Handle */
  ::-webkit-scrollbar-thumb {
    background: #888; 
    border-radius: 12px;
  }
  
  /* Handle on hover */
  ::-webkit-scrollbar-thumb:hover {
    background: #555; 
  }





.input-text{
    border-radius: 4px;
    border: 0.5px solid rgb(226, 226, 226);
    padding: 10px;
    width: 92%;
    transition: 0.2s;
    outline: none;
}

.input-text{
    border: 1px solid #e9ecef;
    font-size: 14px;
    line-height: 26px;
    background-color: #fff;
    display: block;
    width: 100%;
    padding: .375rem .75rem;
    font-weight: 300;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-clip: padding-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: .25rem;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}

.input-text:hover{
    background-color: rgb(250, 250, 250);
    transition: 0.2s;
    outline: none;
}

.input-text:focus{
    border: 1px solid rgb(10,118,216);
    transition: 0.2s;
}

.input-text::placeholder{
    font-family: 'Inter', sans-serif;
}



/* -----------Buttons---------------*/
.btn{
    cursor: pointer;
    padding: 8px 20px;
    outline: none;
    text-decoration: none;
    font-size: 15px;
    letter-spacing: 0.5px;
    transition: all 0.3s;
    border-radius: 5px;
    font-family: 'Inter', sans-serif;
}


.btn:hover{
    background-color: var(--primarycolorhover);
    box-shadow: none;
    transition: all 0.5s;
    font-family: 'Inter', sans-serif;

}


.btn-primary{
    background-color: var(--primarycolor) ;
    border: 1px solid var(--primarycolor) ;
    color: #fff ;
    box-shadow: 0 3px 5px 0 rgba(57,108,240,0.3);
}

.btn-primary-soft{
    background-color: #D8EBFA ;
    /*border: 1px solid rgba(57,108,240,0.1) ;*/    color: #1969AA;
    font-weight: 500;
    font-size: 16px;
    border: none;
    /*box-shadow: 0 3px 5px 0 rgba(57,108,240,0.3)*/
}


.btn-primary-soft:hover{
    background-color: var(--primarycolor) ;
    /*border: 1px solid rgba(57,108,240,0.1) ;*/
    color: #fff ;
    box-shadow: 0 3px 5px 0 rgba(57,108,240,0.3);
}


.btn-in-text{
    font-size: 15px;
    letter-spacing: 0.5px;
}

.non-style-link:link, .non-style-link:visited, .non-style-link:hover, .non-style-link:active{
    text-decoration: none;
    color: rgb(43, 43, 43);
}




.btn-label{
    margin-left: 10px;
    padding: 12px 12px;
    outline: none;
    text-decoration: none;
    font-size: 15px;
    letter-spacing: 0.5px;
    transition: all 0.3s;
    border-radius: 5px;
    background-color: #f0f0f073;
    border: 1px solid rgba(57,108,240,0.1) ;
    font-family: 'Inter', sans-serif;
}


.sub-table{
    border: 1px solid #ebebeb;
    border-radius: 8px;
    
}

.filter-container{
  width: 92.5%;
  border: 1px solid #ebebeb;
  border-radius: 8px;
  margin-bottom: 20px;
  border-spacing: 0;
  padding: 0;
}

.filter-container-items{
  margin-top: 7.5px;
  margin-left: 20px;


}
.table-headin{
    font-size: 16px;
    font-weight: 500;
    padding: 10px;
    border-bottom: 3px solid var(--primarycolor);
}

.abc{
  width: 100%;
  height: 550px;
  overflow: auto;
}





        
.overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    transition: opacity 500ms;
    opacity: 1;
  }
  .overlay:target {
    visibility: visible;
    opacity: 1;
    
  }
  
  .popup {
    margin: 70px auto;
    padding: 20px;
    background: #fff;
    border-radius: 5px;
    width: 50%;
    position: relative;
    transition: all 5s ease-in-out;
  }
  
  .popup h2 {
    margin-top: 0;
    color: #333;
  }
  .popup .close {
    position: absolute;
    top: 20px;
    right: 30px;
    transition: all 200ms;
    font-size: 30px;
    font-weight: bold;
    text-decoration: none;
    color: #333;
  }
  .popup .close:hover {
    color: var(--primarycolorhover);
  }
  .popup .content {
    max-height: 30%;
    overflow: auto;
  }
  
  @media screen and (max-width: 700px){
    .box{
      width: 70%;
    }
    .popup{
      width: 70%;
    }
  }


input[type=search] {
    background-image: url('../img/search.svg');
    background-position: 10px 50%;
    background-repeat: no-repeat;
    transition: 0.5s;
    padding: 8px 20px 8px 40px;
}

input[type=search]:focus {
    transition: 0.5s;
}

.box {
  width: 120px;
  height: 30px;
  border: 1px solid #e9ecef;
  font-size: 14px;
  color: #212529;
  background-color: #fff;
  line-height: 26px;
  font-weight: 300;
  border-radius: .25rem;
  padding: .375rem .75rem;
  line-height: 1.5;
  width: 100%;
  background-clip: padding-box;
  transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}



.btn-primary-gray{
  background-color: #fff;
  border: 2px solid #c9cbce9f;
  color: #212529d0;
  box-shadow: 0 3px 5px 0 rgba(95, 95, 97, 0.3);
}



.btn-primary-gray:hover{
  background-color: #5185ffa9;
  box-shadow: 0 3px 5px 0 rgba(95, 95, 97, 0.3);
}



.button-icon{
  
  background-position: 10px 50%;
  background-repeat: no-repeat;
  transition: 0.5s;
  padding: 8px 20px 8px 40px;
}



.menu-btn{
  padding:6px;
  color: #3b3b3b;
  background-position: 30% 50%;
  background-repeat: no-repeat;
  transition: 0.5s;
  
}

.menu-text{
  padding-left: 40%;
  font-weight: 500;
  font-size: 16px;
  
}


.menu-active{
  color: var(--primarycolor);
  border-right: 7px solid var(--primarycolor);
  background-color: var();
}

.menu-btn:hover{
  background-color: var(--btnice);
  color: var(--primarycolor);
}

.non-style-link-menu:link, .non-style-link-menu:visited,  .non-style-link-menu:active{
  text-decoration: none;
  color: #3b3b3b;
}
.non-style-link-menu:hover{
  text-decoration: none;
  color: var(--primarycolor);
}

.non-style-link-menu-active:link, .non-style-link-menu-active:visited,  .non-style-link-menu-active:active{
  text-decoration: none;
  color: var(--primarycolor);
}



.menu-icon-dashbord{
  background-image: url('../img/icons/dashboard.svg');
}


.menu-icon-doctor{
  background-image: url('../img/icons/doctors.svg');
}
.menu-icon-schedule{
  background-image: url('../img/icons/schedule.svg');
}
.menu-icon-appoinment{
  background-image: url('../img/icons/book.svg');
}
.menu-icon-patient{
  background-image: url('../img/icons/patients.svg');
}
.menu-icon-settings{
  background-image: url('../img/icons/settings.svg');
}

.menu-icon-session{
  background-image: url('../img/icons/session.svg');
}
.menu-icon-home{
  background-image: url('../img/icons/home.svg');
}



.menu-icon-dashbord:hover,.menu-icon-dashbord-active{
  color: var(--primarycolor);

  background-image: url('../img/icons/dashboard-hover.svg');
}


.menu-icon-doctor:hover,.menu-icon-doctor-active{
  color: var(--primarycolor);
  background-image: url('../img/icons/doctors-hover.svg');
}
.menu-icon-schedule:hover,.menu-icon-schedule-active{
  color: var(--primarycolor);
  
  background-image: url('../img/icons/schedule-hover.svg');
}
.menu-icon-appoinment:hover,.menu-icon-appoinment-active{
  color: var(--primarycolor);
  
  background-image: url('../img/icons/book-hover.svg');
}
.menu-icon-patient:hover,.menu-icon-patient-active{
  color: var(--primarycolor);
  
  background-image: url('../img/icons/patients-hover.svg');
}

.menu-icon-settings:hover,.menu-icon-settings-active{
  color: var(--primarycolor);
  
  background-image: url('../img/icons/settings-iceblue.svg');
}

.menu-icon-session:hover,.menu-icon-session-active{
  color: var(--primarycolor);
  
  background-image: url('../img/icons/session-iceblue.svg');
}
.menu-icon-home:hover,.menu-icon-home-active{
  color: var(--primarycolor);
  
  background-image: url('../img/icons/home-iceblue.svg');
}





.btn-icon-back{
  background-image: url('../img/icons/back-iceblue.svg');
  background-position: 18px 50%;
  background-repeat: no-repeat;
  transition: 0.5s;
  padding: 8px 20px 8px 40px;
}

.btn-icon-back:hover{
  background-image: url('../img/icons/back-white.svg');
}


.btn-edit{
  background-image: url('../img/icons/edit-iceblue.svg');
}
.btn-edit:hover{
  background-image: url('../img/icons/edit-white.svg');
}

.btn-view{
  background-image: url('../img/icons/view-iceblue.svg');
}
.btn-view:hover{
  background-image: url('../img/icons/view-white.svg');
}

.btn-delete{
  background-image: url('../img/icons/delete-iceblue.svg');
}
.btn-delete:hover{
  background-image: url('../img/icons/delete-white.svg');
}

.btn-filter{
  background-image: url('../img/icons/filter-iceblue.svg');
  background-position: 15px 50%;
}
.btn-filter:hover{
  background-image: url('../img/icons/filter-white.svg');
}




.dashboard-items{
  
  border: 2px solid #c9cbce9f;
  border-radius: 7px;
  color: var(--primarycolor);
  /*background-color: #d8ebfa25 ;*/
  /*box-shadow: 0 3px 5px 0 rgba(95, 95, 97, 0.3);*/
}


.h1-dashboard{
  margin: 0;
  padding: 0;
  font-size: 25px;
  font-weight: 600;
  line-height: 0;
  padding-top: 20px;
}

.h3-dashboard{
  margin: 0;
  padding: 0;
  font-size: 20px;
  font-weight: 500;
  color: #212529e3;
}

.dashboard-icons{
  background-color: rgba(184, 184, 184, 0.247);
  padding-top: 30px;
  padding-bottom: 30px;
  border-radius: 7px;
  margin-left: 40px;
  margin-right: 0px;
  
}
.dashboard-icons-setting{
  background-color: rgba(184, 184, 184, 0.247);
  padding-top: 30px;
  padding-bottom: 30px;
  border-radius: 7px;
  margin-left: 5px;
  margin-right: 20px;
  
}

.setting-tabs:hover{
  background-color: #d6d6d657;
}


.doctor-header{
  background-image: url(../img/b8.jpg);
  color: rgba(0, 0, 0, 0.87);
  background-size: 100%;
  background-repeat: no-repeat;
  padding: 20px;
  padding-left: 35px;
}

.patient-header{
  background-image: url(../img/b3.jpg);
}

.search-items{
  padding:20px;
  margin:10px;
  width:95%;
  display: flex;
  padding-left:0;
  padding-left: 30px;
  box-sizing: border-box;
  line-height: 1.5;
  box-shadow: 0 3px 5px 0 rgba(95, 95, 97, 0.068);
}


.h1-search{
  margin: 0;
  padding: 0;
  font-size: 23px;
  font-weight: 600;
  padding-top: 20px;
  padding-bottom: 10px;
}

.h3-search{
  margin: 0;
  padding: 0;
  font-size: 15px;
  font-weight: 500;
  color: #212529e3;
  
}

.h4-search{
  margin: 0;
  padding: 0;
  font-size: 13px;
  font-weight: 400;
  color: #212529e3;
}

.btn-book{
  background-image: url('../img/icons/book-balck.svg');
  background-position: 68% 50%;
  background-repeat: no-repeat;
  transition: 0.5s;
}

/* =========================================================
   ADD-ON RESPONSIVE (no rompe tu CSS actual)
   Pégalo al final de css/main.css
   ========================================================= */

/* Previene scroll horizontal accidental en móviles */
html, body { overflow-x: hidden; }

/* Imágenes y svgs fluidos */
img, svg, video { max-width: 100%; height: auto; }

/* ---------- Tablas: que NO partan letras y permitan scroll ---------- */
.sub-table, .dashboard-items, .table-wrap, .table-container {
  position: relative;
}

.sub-table .table-responsive,
.dashboard-items .table-responsive,
.table-wrap, .table-container {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1024px) {
  /* Evita que los encabezados se apilen letra por letra */
  table th, table td {
    white-space: nowrap;
    word-break: keep-all;
  }
  /* Si tu tabla queda apretada, fuerza un ancho mínimo */
  table { min-width: 640px; }
}

/* ---------- Menú lateral (paciente/admin) ---------- */
@media (max-width: 992px) {
  .menu {
    width: 100% !important;
    border-right: 0;
    border-bottom: 1px solid #ebebeb;
    box-shadow: none;
  }

  /* Contenido debajo del menú ocupa todo el ancho */
  .dash-body { width: 100% !important; }

  /* Botones/links del menú en una fila scrollable si no caben */
  .menu-container,
  .menu table { width: 100%; }

  .menu a,
  .menu .menu-btn,
  .menu .non-style-link-menu {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    white-space: nowrap;              /* no partir texto del menú */
    text-decoration: none;
  }

  /* Píldora azul de activo centrada y sin “romper” */
  .menu-active,
  .non-style-link-menu-active {
    color: var(--primarycolor);
    background-color: var(--btnice);
    border-right: 0;                  /* evita borde grueso vertical en móvil */
    border-radius: 8px;
  }
}

/* ---------- Formularios / Inputs ---------- */
@media (max-width: 768px) {

  /* Input de búsqueda con icono: que no se corte */
  input[type="search"] {
    width: 100%;
    background-position: 10px 50%;
    padding-left: 40px;
  }

  /* Campos e inputs a 100% */
  .input-text, .box, select, textarea {
    width: 100% !important;
  }

  /* Botones principales a 100% cuando están en formularios */
  .btn, .btn-primary, .btn-primary-soft, .btn-primary-gray {
    min-height: 44px;                 /* target accesible */
    touch-action: manipulation;
  }

  /* Bloques de búsqueda/filtros en columna */
  .search-items, .filter-container-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding-left: 0;
    margin: 10px 0;
  }
}

/* ---------- Tarjetas/listas (citas, doctores) ---------- */
@media (max-width: 768px) {
  .card, .doctor-card, .service-card, .dashboard-items {
    width: 100% !important;
    margin: 0 0 12px 0;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,.06);
  }

  .h1-dashboard { font-size: 22px; line-height: 1.2; }
  .h3-dashboard { font-size: 18px; }
  .h1-search { font-size: 20px; }
  .h3-search { font-size: 14px; }
  .h4-search { font-size: 13px; }
}

/* ---------- Cabeceras/hero del panel ---------- */
@media (max-width: 768px) {
  .doctor-header, .patient-header {
    background-size: cover;
    background-position: center;
    padding: 16px;
  }
}

/* ---------- Popups ---------- */
@media (max-width: 700px) {
  .popup { width: 92% !important; }
}

/* ---------- Mejoras táctiles y focus ---------- */
@media (hover: none) {
  .btn:hover { background-color: var(--primarycolor); }
}
.btn:focus-visible,
.input-text:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(10,118,216,.35);
  outline-offset: 2px;
}

/* ---------- Arreglo de “botones verticales” del menú de iconos ---------- */
/* Si tienes un menú de solo iconos, que cada item sea horizontal y clicable */
.menu .btn, .menu .btn-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ===== PARCHE EXPRESS MOVIL (pegar al final de main.css) ===== */

/* 1) HERO / portada: evita desbordes y texto súper grande */
.hero, .hero-section{
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}
.hero h1, .hero-section h1{ line-height: 1.15; }
@media (max-width: 768px){
  .hero, .hero-section{ padding: 20px 16px; }
  .hero h1, .hero-section h1{ font-size: 1.8rem; }
  .hero p,  .hero-section p { font-size: 1rem; }
}

/* 2) MENÚ LATERAL en móvil: icono + texto en fila, clic full width */
@media (max-width: 768px){
  .menu{ width: 100% !important; height: auto !important; border-right: 0; }
  .dash-body{ width: 100% !important; }
  .menu a, .menu .menu-btn, .menu .non-style-link-menu{
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    white-space: nowrap;
    width: 100%;
  }
  .menu-text{ padding-left: 0; font-size: 16px; }
  .profile-container{ padding: 16px 12px; }
  .logout-btn{ width: 95%; }
}

/* 3) TABLAS RESPONSIVAS (todas): scroll x y sin “letras verticales” */
.sub-table,
table,
.table,
.dashboard-tables{
  width: 100%;
  overflow: hidden;
  border-collapse: collapse;
}

.table-wrap,
.sub-table .abc,
.dashboard-tables .abc{
  /* si ya tienes .abc como contenedor scrolleable, genial; si no, aplica a .table-wrap */
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

table thead th,
.table thead th,
.sub-table thead th{
  white-space: nowrap;          /* no partir palabras */
  word-break: keep-all;
  letter-spacing: 0;            /* evita separación extra */
  vertical-align: middle;
}

table td, table th,
.table td, .table th,
.sub-table td, .sub-table th{
  white-space: normal;
  word-break: normal;
  line-height: 1.3;
  padding: 10px 12px;
}

/* Anchos mínimos por columnas comunes: ajusta si quieres */
th:nth-child(1){ min-width: 60px; }
th:nth-child(2){ min-width: 140px; }
th:nth-child(3){ min-width: 120px; }
th:nth-child(4){ min-width: 100px; }
th:nth-child(5){ min-width: 100px; }
th:nth-child(6){ min-width: 120px; }

/* Botones dentro de celdas: no se apilen verticalmente */
td .btn, td .btn-primary, td .btn-primary-soft{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  min-width: 88px;
  height: auto;
  writing-mode: horizontal-tb !important; /* por si algo lo pone vertical */
}

/* 4) CORRECCIÓN DE WRITING-MODE ACCIDENTAL */
[style*="writing-mode"], .vertical-text{
  writing-mode: horizontal-tb !important;
}

/* 5) CONTENEDORES DE BLOQUES (cards/tablas) bien centrados en móvil */
@media (max-width: 768px){
  .card, .doctor-card, .service-card, .sub-table{
    border-radius: 10px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* 6) BOTÓN “AGREGAR DOCTOR” u otros que se “ponen de lado” */
.btn, .btn-primary, .btn-primary-soft{
  writing-mode: horizontal-tb !important;
  transform: none !important;
}

/* 7) Safe-area iOS: evita que algo quede pegado al borde curvo */
@supports (padding: max(0px)){
  body{
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* ====== AJUSTES EXTRA PARA iPHONE / MÓVIL (no rompen desktop) ====== */
html { -webkit-text-size-adjust: 100%; }

@media (max-width: 768px){
  /* Evita que .search-items cause desborde por padding/width */
  .search-items{
    width: 100% !important;
    margin: 10px 0 !important;
    padding: 16px 12px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
  }
  /* Íconos de dashboard sin empujar a la derecha */
  .dashboard-icons{ margin-left: 0 !important; }
  /* Contenedor scrolleable más bajo para que quepa todo */
  .abc{ height: 420px !important; }
}

/* Móviles muy pequeños (≤480px): tipografía y espacios compactos */
@media (max-width: 480px){
  .h1-dashboard{ font-size: 21px; }
  .h3-dashboard{ font-size: 16px; }
  .h1-search{ font-size: 20px; }
  .h3-search{ font-size: 14px; }
  .h4-search{ font-size: 12.5px; }
  th, td{ padding: 8px 6px; font-size: 13.5px; }
}

/* ===== PARCHE ANTI-DESBORDE iPhone (pegar al final) ===== */

/* Nunca permitir desborde horizontal */
html, body { max-width: 100%; overflow-x: hidden; }

/* Imágenes/canvas siempre fluidos */
img, svg, video, canvas { max-width: 100% !important; height: auto !important; display: block; }

/* --------- Ajustes de layout en móvil --------- */
@media (max-width: 768px){

  /* Menú y contenido a 100% (ya lo tienes, reforzamos) */
  .menu{ width:100% !important; height:auto !important; border-right:0 !important; }
  .dash-body{ width:100% !important; height:auto !important; }

  /* La tarjeta de búsqueda no debe sumar ancho extra */
  .search-items{
    width: 100% !important;
    padding: 12px !important;
    margin: 10px 0 !important;
    box-sizing: border-box !important;
  }

  /* KPI / cards en una sola columna para que no corten texto */
  .dashboard-items,
  .card, .doctor-card, .service-card{
    width: 100% !important;
    margin: 0 0 12px 0 !important;
    border-radius: 10px;
  }

  /* Íconos del dashboard: quitar márgenes que empujan el ancho */
  .dashboard-icons,
  .dashboard-icons-setting{
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Títulos más compactos y sin saltos raros */
  .h1-dashboard{ line-height: 1.2 !important; padding-top: 8px !important; }
  .h3-dashboard{ font-size: 18px !important; }

  /* Tablas: scroll-x suave (sin letras verticales) */
  .sub-table, .table, .table-wrap, .dashboard-tables, .abc{
    display:block;
    width:100% !important;
    overflow-x:auto !important;
    -webkit-overflow-scrolling:touch;
  }
  table thead th, .table thead th, .sub-table thead th{
    white-space: nowrap !important;
    word-break: keep-all !important;
    letter-spacing: 0 !important;
    vertical-align: middle !important;
  }

  /* Charts / canvas no deben fijar ancho mayor al contenedor */
  .chart, .chart-wrap{
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  /* Botones siempre horizontales (por si alguna regla los gira) */
  .btn, .btn-primary, .btn-primary-soft{
    writing-mode: horizontal-tb !important;
    transform: none !important;
    min-height: 44px;
  }

  /* Menú de texto: sin padding gigante que desborde */
  .menu-text{ padding-left: 0 !important; font-size: 16px !important; }

  /* Safe areas iOS (bordes redondeados) */
  body{
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* Si alguna clase inline fija anchuras tontas, que nunca pasen del contenedor */
*[style*="width"]{ max-width:100% !important; }

/* Quitar cualquier “writing-mode” accidental que ponga texto vertical */
[style*="writing-mode"], .vertical-text{ writing-mode: horizontal-tb !important; }

/* ===== PARCHE 2 — Anti-scroll iPhone (pegar al final de main.css y admin.css) ===== */

/* Seguridad global */
html, body { max-width: 100%; overflow-x: hidden; }
* { box-sizing: border-box; }

/* --- 1) Tablas: que el contenido largo NO empuje el ancho --- */
table { width: 100%; border-collapse: collapse; table-layout: auto; }
table thead th { white-space: nowrap; }               /* encabezados en una línea */
table td, table th { padding: 10px 12px; line-height: 1.35; }

/* Texto largo dentro de celdas (emails, teléfonos, IDs, links) */
table td, table td a, table td span {
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;                 /* rompe sin espacios */
}

/* Botones dentro de celdas: siempre horizontales */
td .btn, td .btn-primary, td .btn-primary-soft, td .btn-primary-gray {
  display: inline-flex; align-items: center; justify-content: center;
  writing-mode: horizontal-tb !important;
  transform: none !important;
  min-height: 40px;
}

/* Contenedor scroll-x amable para cualquier tabla/lista grande */
.table-wrap, .sub-table, .dashboard-tables, .abc {
  display: block; width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* --- 2) Charts/canvas: que nunca sean más anchos que el viewport --- */
canvas, .chart, .chart-wrap {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  display: block;
  overflow: hidden !important;
}

/* A veces librerías ponen un width fijo inline: anulamos */
canvas[style*="width"], .chart[style*="width"], .chart-wrap[style*="width"] {
  width: 100% !important;
}

/* --- 3) Cards/KPI/Placeholders que sumaban ancho --- */
.dashboard-items, .card, .kpi, .box, .placeholder, .skeleton {
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  overflow: hidden;
}

/* Íconos de dashboard que tenían margin-left grande en desktop */
.dashboard-icons, .dashboard-icons-setting {
  margin-left: 0 !important; margin-right: 0 !important;
  padding-left: 16px !重要; padding-right: 16px !important;
}

/* --- 4) Bloques de filtros/búsqueda: evitar que el padding supere el 100% --- */
.search-items, .filter-container, .filter-container-items {
  width: 100% !important;
  padding-left: 12px !important;
  padding-right: 12px !important;
}

/* --- 5) Menú y texto del menú en móvil: sin padding que desborde --- */
@media (max-width: 768px){
  .menu { width: 100% !important; height: auto !important; border-right: 0 !important; }
  .dash-body { width: 100% !important; height: auto !important; }
  .menu .menu-text { padding-left: 0 !important; font-size: 16px !important; }
  .menu a, .menu .menu-btn, .menu .non-style-link-menu {
    display: flex !important; align-items: center; gap: 10px;
    width: 100%; padding: 10px 14px; white-space: nowrap;
  }
}

/* --- 6) Safe areas iOS (bordes redondeados) --- */
@supports (padding: max(0px)){
  body{
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* --- 7) Última red de seguridad: si algún inline style fija un width > 100vw --- */
*[style*="width"] { max-width: 100% !important; }
[style*="writing-mode"], .vertical-text { writing-mode: horizontal-tb !important; }

/* ===== PARCHE 3 — anti-atasco de scroll en iPhone (pegar al final) ===== */

/* 0) Asegurar alto total y evitar encadenamiento de scroll */
html, body { height: 100%; }
body{
  overscroll-behavior-y: none;     /* no hacer “rebote” de la página completa */
  touch-action: pan-y;             /* prioriza scroll vertical con el dedo */
}

/* 1) El área de trabajo maneja su propio scroll sin “robar” el gesto */
.dash-body, .content, .section, .block {
  overflow-y: auto;
  overscroll-behavior-y: contain;  /* el scroll no se “fuga” al body */
  -webkit-overflow-scrolling: touch;
}

/* 2) Zonas con scroll horizontal (tablas/listas) solo aceptan pan-x */
.table-wrap, .sub-table, .dashboard-tables, .abc, .scroll, .scrolldown {
  overflow-x: auto !important;
  overflow-y: hidden;
  touch-action: pan-x;             /* evita que corten el pan vertical */
  -webkit-overflow-scrolling: touch;
}

/* 3) Evitar que cualquier ancho fijo bloquee el gesto */
*[style*="width"] { max-width: 100% !important; }

/* 4) Botones grandes que a veces “capturan” el gesto: que no bloqueen el scroll */
.btn, .btn-primary, .btn-primary-soft, .btn-primary-gray {
  touch-action: manipulation;      /* tap/click sí, pero no roban el pan */
}

/* 5) iOS + menú sticky: asegurar que no haya overflow en el ancestro */
.container { overflow: visible !important; }

/* 6) MUY IMPORTANTE: anular cualquier escala en móvil que venga de responsive.css */
@media (max-width: 600px){
  body { transform: none !important; transform-origin: initial !important; }
}

/* 7) Red de seguridad: si algo usa writing-mode raro, mantenlo horizontal */
[style*="writing-mode"], .vertical-text { writing-mode: horizontal-tb !important; }

/* ===========================
   Calendario (admin) – Tablas compactas (3 columnas)
   Pégalo al final de main.css o admin.css
   =========================== */

/* Tamaño general un poco menor */
@media (max-width: 1024px){
  .sub-table, .table, table {
    font-size: 14px;
  }
  .sub-table th, .sub-table td,
  .table th, .table td,
  table th, table td {
    padding: 8px 10px;
    line-height: 1.25;
  }
}

/* Móvil: forzamos layout de 3 columnas visibles */
@media (max-width: 768px){

  /* Todas las tablas del calendario más compactas */
  .sub-table, .table, table {
    table-layout: fixed;          /* reparte ancho por columnas */
    width: 100%;
    border-collapse: collapse;
  }

  /* Reparto de ancho: 1) Nombre Sesión, 2) Doctor, 3) Fecha y Hora */
  .sub-table thead th:nth-child(1),
  .table     thead th:nth-child(1),
  table      thead th:nth-child(1){ width: 44%; }

  .sub-table thead th:nth-child(2),
  .table     thead th:nth-child(2),
  table      thead th:nth-child(2){ width: 28%; }

  .sub-table thead th:nth-child(3),
  .table     thead th:nth-child(3),
  table      thead th:nth-child(3){ width: 28%; }

  /* Celdas en una sola línea con puntos suspensivos si no cabe */
  .sub-table td, .table td, table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Botones dentro de tablas más pequeños */
  .sub-table td .btn, .table td .btn, table td .btn {
    padding: 6px 10px;
    font-size: 14px;
    min-width: 0;
  }

  /* Tarjetas contenedoras con menos padding para que
     ‘entren’ mejor las tablas debajo de cada título */
  .card, .dashboard-items, .table-wrapper {
    padding: 12px !important;
  }
}

/* Extra-compacto (iPhone chico) */
@media (max-width: 420px){
  .sub-table, .table, table { font-size: 13px; }
  .sub-table th, .sub-table td,
  .table th, .table td,
  table th, table td { padding: 6px 8px; }
}



/* =========================================================
   MODALES MÓVIL — PARCHE (agregado por compatibilidad iOS)
   ========================================================= */

.overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  -webkit-overflow-scrolling: touch;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 12px;
  z-index: 9999;
}

.popup{
  position: relative;
  margin: 0;                     /* anula el margen grande anterior */
  width: min(92vw, 560px);       /* ancho fluido en móvil/desktop */
  max-height: calc(100vh - 96px);
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}

/* zona de scroll interna del modal */
.popup .content{
  max-height: inherit !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  padding-right: 6px;
}

/* botón cerrar accesible y siempre visible */
.popup .close{
  position: sticky;
  top: 0;
  display: inline-block;
  margin-left: auto;
  font-size: 28px;
  line-height: 1;
  padding: 12px;
  z-index: 2;
}

/* evita zoom de iOS al enfocar campos */
.popup input,
.popup select,
.popup textarea,
.popup button{
  font-size: 16px !important;
}

/* cortar textos/links largos dentro del modal */
.popup a, .popup p, .popup td, .popup div{
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ajustes small screens */
@media (max-width: 380px){
  .overlay{ padding: 16px 8px; }
  .popup{ max-height: calc(100vh - 72px); }
}

/* respetar safe-area en iPhone */
@supports (padding: max(0px)){
  .overlay{
    padding-left:  max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-top:   max(24px, env(safe-area-inset-top));
    padding-bottom:max(24px, env(safe-area-inset-bottom));
  }
}