/* tables.css · Estilos para tablas y listas */

/* ============================================= */
/*          TABLAS                               */
/* ============================================= */
.table-wrapper{
  overflow-x:auto;
}

.table{
  width:100%;
  border-collapse:collapse;
  text-align:left;
}

.table th{
  position:sticky;
  top:0;
  background:var(--surface-muted);
  border-bottom:1px solid rgba(255,255,255,0.1);
  color:var(--text);
  font-size:11px;
  letter-spacing:.06em;
  text-transform:uppercase;
  padding:10px;
  white-space:nowrap;
  font-weight:800;
}

.table td{
  padding:12px 10px;
  border-bottom:1px solid var(--border);
  font-size:14px;
  white-space:nowrap;
  color:var(--text);
}

.table tbody tr:hover{
  background:var(--surface-muted);
}

/* ============================================= */
/*          LISTAS                               */
/* ============================================= */
.lists-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:var(--space-2);
  margin-bottom:var(--space-2);
  grid-auto-rows:auto;
}

/* Limitar altura de cards de listas */
.lists-grid .card{
  max-height:400px;
  display:flex;
  flex-direction:column;
}

.lists-grid .card .card-body{
  overflow-y:auto;
  overflow-x:hidden;
  max-height:calc(400px - 60px);
}

/* Scrollbar sutil para listas */
.lists-grid .card .card-body::-webkit-scrollbar{
  width:6px;
}

.lists-grid .card .card-body::-webkit-scrollbar-track{
  background:transparent;
}

.lists-grid .card .card-body::-webkit-scrollbar-thumb{
  background:rgba(0,0,0,0.1);
  border-radius:3px;
}

.lists-grid .card .card-body::-webkit-scrollbar-thumb:hover{
  background:rgba(0,0,0,0.2);
}

/* Firefox */
.lists-grid .card .card-body{
  scrollbar-width:thin;
  scrollbar-color:rgba(0,0,0,0.1) transparent;
}

/* ============================================= */
/*          PAGINACIÓN                           */
/* ============================================= */
.pagination-controls{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:var(--space-2);
  flex-wrap:wrap;
  padding:var(--space-2);
  background:var(--panel);
  border-radius:var(--radius-lg);
  margin-top:var(--space-2);
}

.pagination-info{
  font-size:12px;
  color:var(--muted);
  font-weight:600;
}

.pagination-buttons{
  display:flex;
  gap:8px;
}

/* ============================================= */
/*          PANEL DE SOBRESTANCIA                */
/* ============================================= */
.overstay-panel {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(16,24,40,.05);
  overflow: hidden;
  max-height: 600px;
}

.overstay-panel .panel-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 22px;
  background:var(--surface-muted);
  border-bottom:1px solid rgba(255,255,255,0.1);
  border-top-left-radius:var(--radius);
  border-top-right-radius:var(--radius);
}

.overstay-panel .panel-body {
  flex:1;
  overflow:auto;
  padding:18px 20px 22px;
  background:var(--panel);
  border-bottom-left-radius:var(--radius);
  border-bottom-right-radius:var(--radius);
}

.overstay-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface-muted);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.overstay-item:hover {
  background: var(--primary-soft);
  transform: translateX(4px);
}

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

.overstay-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--warning);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.overstay-details {
  flex: 1;
  min-width: 0;
}

.overstay-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin: 0 0 2px 0;
}

.overstay-time {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.overstay-days {
  flex-shrink: 0;
  font-weight: 800;
  font-size: 18px;
  color: var(--warning);
}

/* ============================================= */
/*          CALENDARIO DE EXPORTACIÓN            */
/* ============================================= */
.range-calendar {
  background: var(--surface-muted);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border);
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cal-month-label {
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
  text-transform: capitalize;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-grid .day {
  aspect-ratio: 1/1;
  font-size: 13px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: var(--text);
  background: white;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}

.cal-grid .day:hover:not(.disabled):not(.outside) {
  background: var(--primary-soft);
  border-color: var(--primary);
  transform: scale(1.05);
}

.cal-grid .day.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: var(--surface-muted);
}

.cal-grid .day.outside {
  opacity: 0;
  pointer-events: none;
}

.cal-grid .day.today {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.cal-grid .day.start,
.cal-grid .day.end {
  background: var(--primary) !important;
  color: #FFFFFF !important;
  border-color: var(--primary) !important;
  box-shadow: 0 2px 6px rgba(26, 46, 80, 0.2);
}

.cal-grid .day.in-range:not(.start):not(.end) {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.cal-selection-info {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 12px;
}

/* ============================================= */
/*          RESPONSIVE                           */
/* ============================================= */
@media(max-width:768px){
  .table-wrapper{
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
  }

  .table{
    font-size:12px;
    min-width:700px;
  }
  
  .table th,
  .table td{
    padding:8px 6px;
    white-space:nowrap;
  }
  
  .pagination-controls{
    padding:10px 12px;
    gap:8px;
    justify-content:center;
  }

  .pagination-info{
    display:none;
  }

  .pagination-buttons{
    gap:6px;
    flex-wrap:nowrap;
  }

  .pagination-buttons .btn{
    padding:0 8px;
    font-size:12px;
    min-width:32px;
  }

  .overstay-panel {
    max-height: 85vh;
  }

  .range-calendar {
    padding: 12px;
  }

  .cal-grid .day {
    font-size: 12px;
  }
}
