/* =============================================
   panel.css — Layout y componentes compartidos
   por TODOS los paneles (admin y cliente)
   Requiere: style.css cargado antes
   ============================================= */

/* ── Dashboard wrapper ── */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.page {
  display: block;
  min-height: 100vh;
  background: transparent;
}

/* ── Main content ── */
.main_content,
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px 36px;
  overflow-x: hidden;
  min-width: 0;
}

/* ── Top Header ── */
.top_header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top_header h1 {
  font-family: var(--font-head);
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin: 0;
  line-height: 1.2;
}

.top_header p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

/* También aplica cuando h1 va directo en main_content o content sin top_header */
.main_content > h1,
.content > h1 {
  font-family: var(--font-head);
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin: 0;
}

/* ── Panel (caja blanca con título) ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: visible;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.panel h3 {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.panel > *:not(h3):not(.table-responsive) {
  padding: 24px 28px;
}

/* ── Table responsive dentro de panel ── */
.panel .table-responsive {
  margin: 0;
  padding: 0;
  overflow-x: auto;
  width: 100%;
  display: block;
  -webkit-overflow-scrolling: touch;
}

.panel .table-responsive .table {
  margin: 0;
  padding: 0 24px;
  width: 100%;
  min-width: 100%;
  table-layout: auto;
}

/* ── Tabla ── */
.table {
  margin: 0;
  table-layout: auto;
}

.table thead th {
  vertical-align: middle;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-main);
  background: var(--bg);
  border-color: var(--border);
  padding: 12px 16px;
  white-space: nowrap;
}

.table tbody td {
  color: var(--text-main);
  vertical-align: middle;
  border-color: var(--border);
  padding: 12px 16px;
  font-size: 0.85rem;
}

/* ── Tabla con scroll visible ── */
.table-scroll {
  position: relative;
}

.table-scroll::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(to right, transparent, rgba(0,0,0,0.02));
  pointer-events: none;
}

.table tbody tr:hover > * { background-color: var(--bg); }

.table .fa-download {
  color: var(--primary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: opacity 0.15s;
}

.table .fa-download:hover { opacity: 0.6; }

/* ── Badges de estado ── */
.status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.status.pending   { background: var(--status-red-bg);    color: var(--status-red); }
.status.process   { background: var(--status-orange-bg); color: var(--status-orange); }
.status.signed    { background: var(--status-green-bg);  color: var(--status-green); }
.status.cancelled { background: var(--status-pink-bg);   color: var(--status-pink); }

/* ── Cards de estadísticas ── */
.cards_container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border) !important;
  border-radius: 18px !important;
  box-shadow: var(--shadow) !important;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: default;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md) !important;
}

.card > div:last-child { flex: 1; }

.card h2 {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  margin: 0;
}

.card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 4px 0 0;
  font-weight: 500;
}

.card span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  display: inline-block;
  margin-top: 8px;
  transition: opacity 0.2s;
}

.card span:hover { opacity: 0.75; }

/* ── Íconos de colores en cards ── */
.card_icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.card_icon.red    { background: var(--status-red-bg);    color: var(--status-red); }
.card_icon.orange { background: var(--status-orange-bg); color: var(--status-orange); }
.card_icon.green  { background: var(--status-green-bg);  color: var(--status-green); }
.card_icon.pink   { background: var(--status-pink-bg);   color: var(--status-pink); }

/* ── Content grid (columnas izq/der) ── */
.content_grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.left_section,
.right_section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Campana de notificaciones (base compartida) ── */
.notification_container {
  position: relative;
  flex-shrink: 0;
}

.notification,
.notificacion {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: box-shadow 0.2s;
}

.notification:hover,
.notificacion:hover { box-shadow: var(--shadow-md); }

.notification span,
.notificacion span {
  position: absolute;
  top: 3px;
  right: 3px;
  font-size: 0.6rem;
  padding: 2px 5px;
  line-height: 1;
  background: var(--status-red) !important;
  color: #fff !important;
  border: 2px solid var(--bg);
  border-radius: 10px;
}

/* ── Dropdown de notificaciones (base compartida) ── */
.notification_box {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  overflow: hidden;
}

.notification_box h4 {
  font-family: var(--font-head);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.notification_item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  text-decoration: none;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.notification_item:last-child { border-bottom: none; }
.notification_item:hover { background: var(--bg); }

.notification_item strong {
  font-size: 0.83rem;
  font-weight: 600;
  display: block;
  line-height: 1.3;
}

.notification_item p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 2px 0 0;
}

/* ── Botones de acción en tabla (compartidos) ── */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 0.9rem;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  margin: 0 2px;
}

.action-btn:hover {
  opacity: 0.8;
  transform: scale(1.1);
}

.action-ver        { background: #EEF2FF; color: #4F6EF7; }
.action-editar     { background: #FFF8E5; color: #B07D00; }
.action-desactivar { background: #E6F9F1; color: #1A8A55; }
.action-activar    { background: #FFF0F0; color: #D7202A; }
.action-crear-pdf  { background: #fdecea; color: #dc3545; }

/* ── Botón cambiar rol en tabla ── */
.action-btn.action-rol {
    background: #F0F4FF;
    color: #6B21A8;
    border: none;
    padding: 0;
    cursor: pointer;
}

.text-center { text-align: center; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .content_grid      { grid-template-columns: 1fr; }
  .cards_container   { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .notification_box  { width: 260px; }
  
  /* Ajustar tablas en tablets */
  .table thead th {
    font-size: 0.73rem;
    padding: 10px 12px;
  }
  .table tbody td {
    font-size: 0.80rem;
    padding: 10px 12px;
  }
}

@media (max-width: 768px) {
  .main_content,
  .content {
    padding: 20px 16px;
  }
  .cards_container   { grid-template-columns: repeat(2, 1fr); }
  .top_header h1     { font-size: 1.35rem; }
  .notification_box  { right: -60px; }
  
  /* ── Paneles en móvil ── */
  .panel {
    border-radius: 8px;
    overflow: visible;
  }
  
  .panel h3 {
    padding: 16px;
    font-size: 0.95rem;
  }
  
  .panel > *:not(h3):not(.table-responsive) {

    padding: 16px;
  }
  
  /* ── Tablas en móvil ── */
  .panel .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    display: block;
    width: 100%;
  }
  
  .panel .table-responsive .table {
    margin: 0;
    padding: 0 16px;
    width: 100%;
    min-width: fit-content;
  }
  
  .table thead th {
    font-size: 0.7rem;
    padding: 8px 10px;
    white-space: nowrap;
  }
  
  .table tbody td {
    font-size: 0.75rem;
    padding: 8px 10px;
  }
  
  /* Ocultar última columna (Acciones) en tablas pequeñas - disponible con scroll */
  .table thead th:last-child,
  .table tbody td:last-child {
    min-width: 60px;
  }
  
  /* Status badges más compactos */
  .status {
    padding: 3px 8px;
    font-size: 0.65rem;
  }
  
  /* Indicador visual de scroll horizontal */
  .table-scroll {
    box-shadow: inset -20px 0 10px -10px rgba(0,0,0,0.05);
  }
}

@media (max-width: 480px) {
  .cards_container   { grid-template-columns: 1fr; }
  .main_content      { padding: 16px 12px; }
  
  /* ── Paneles ultra compactos en móvil ── */
  .panel h3 {
    padding: 12px;
    font-size: 0.9rem;
  }
  
  .panel > *:not(h3):not(.table-responsive) {
    padding: 12px;
  }
  
  /* ── Tablas ultra compactas en móvil ── */
  .panel .table-responsive {
    margin: 0;
    padding: 0;
    border-radius: 0 0 8px 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .panel .table-responsive .table {
    margin: 0;
    padding: 0 12px;
  }
  
  .table thead th {
    font-size: 0.65rem;
    padding: 6px 8px;
  }
  
  .table tbody td {
    font-size: 0.7rem;
    padding: 6px 8px;
  }
  
  /* Ocultar algunas columnas en pantallas muy pequeñas */
  /* Puedes descomentar según necesites */
  /*
  .table thead th:nth-child(3),
  .table tbody td:nth-child(3) {
    display: none;
  }
  */
  
  .status {
    padding: 2px 6px;
    font-size: 0.6rem;
  }
}

/* ==========================================
   Vista detalle usuario
========================================== */

.usuario_grid{
    display:grid;
    grid-template-columns:repeat(2, 1fr);
    gap:20px;
}

.info_card{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius);
    padding:22px;
    box-shadow:var(--shadow);
    transition:.2s;
}

.info_card:hover{
    box-shadow:var(--shadow-md);
    transform:translateY(-2px);
}

.info_card span:first-child{
    display:block;
    font-size:.85rem;
    color:var(--text-muted);
    font-weight:600;
    margin-bottom:10px;
}

.info_card strong{
    font-size:1rem;
    font-weight:700;
    color:var(--text-main);
}

@media(max-width:768px){

    .usuario_grid{
        grid-template-columns:1fr;
    }

}