/* ─── NODOSIT Responsive ─── */

/* ── < 1024px: tablet & mobile ── */
@media (max-width: 1023px) {
  main#mainContent { margin-left: 0 !important; }
  #sidebar.open { transform: translateX(0) !important; }
  #sidebar { width: 100% !important; max-width: 320px; }
  .sidebar-text { display: inline !important; }

  .page-title { font-size: 1.125rem !important; }
  .page-subtitle { display: none !important; }

  .resp-stack { flex-direction: column !important; }
  .resp-full { width: 100% !important; }
  .resp-hidden { display: none !important; }

  .stat-card { padding: 1rem !important; }
  .stat-card .stat-value { font-size: 1.5rem !important; }
  .stat-card .stat-label { font-size: 0.65rem !important; }
  .stat-card.h-fixed { height: auto !important; min-height: 5rem !important; }
  [class*="h-"][class*="lg:h-"] { height: auto !important; }
  .h-56, .h-64, .h-52, .h-48 { height: auto !important; min-height: 4.5rem !important; }

  .table-wrap { margin: 0 -1rem !important; border-radius: 0 !important; }
  .table-wrap table { font-size: 0.75rem !important; }
  .table-wrap th, .table-wrap td { padding: 0.5rem 0.4rem !important; white-space: nowrap; }
  .table-wrap.no-scrollbar::-webkit-scrollbar { display: block !important; width: 10px; height: 10px; }
  .table-wrap.no-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
  .table-wrap.no-scrollbar::-webkit-scrollbar-thumb:hover { border-width: 0px; }
  .table-wrap.no-scrollbar { -ms-overflow-style: auto !important; scrollbar-width: auto !important; }

  .modal-box { max-width: 95% !important; margin: 1rem !important; padding: 1.25rem !important; }
  .modal-box form { max-height: 70vh; overflow-y: auto; }
  .modal-box table { font-size: 0.7rem !important; }
  .modal-box th, .modal-box td { padding: 0.35rem 0.3rem !important; }

  .resp-grid-2 { grid-template-columns: 1fr !important; }
  .resp-grid-3 { grid-template-columns: 1fr !important; }
  .resp-grid-4 { grid-template-columns: repeat(2, 1fr) !important; }

  .btn-text { display: none !important; }
  button.btn-icon-only { padding: 0.5rem !important; }

  .drawer-panel { width: 100% !important; max-width: 100% !important; }
  .drawer-panel .p-6 { padding: 1rem !important; }
  .drawer-panel .p-8 { padding: 1rem !important; }

  header .flex.gap-4 { gap: 0.5rem !important; }
  header .flex.items-center.gap-2 { gap: 0.25rem !important; }

  .min-w-\[700px\] { min-width: 0 !important; }
}

/* ── < 640px: phone ── */
@media (max-width: 639px) {
  .resp-grid-4 { grid-template-columns: 1fr !important; }
  .resp-grid-2-sm { grid-template-columns: 1fr !important; }

  .stat-card .stat-value { font-size: 1.25rem !important; }
  .stat-card .stat-icon { width: 2.5rem !important; height: 2.5rem !important; font-size: 1.25rem !important; }

  .table-wrap table { font-size: 0.65rem !important; }
  .table-wrap th, .table-wrap td { padding: 0.3rem 0.25rem !important; }

  .modal-box { padding: 0.75rem !important; margin: 0.5rem !important; max-width: 98% !important; }
  .modal-box h3 { font-size: 0.95rem !important; }
  .modal-box form { max-height: 80vh; }

  .resp-stack-xs { flex-direction: column !important; align-items: stretch !important; }
  .resp-stack-xs > * { width: 100% !important; }
  .resp-inline-xs { display: flex !important; gap: 0.5rem; align-items: center; }

  .filter-bar { flex-direction: column !important; gap: 0.5rem !important; }
  .filter-bar > * { width: 100% !important; }

  button, .btn, [class*="px-"][class*="py-"] { min-height: 2.5rem; }

  .header-actions .btn-text + .material-symbols-outlined { margin: 0 !important; }

  .p-4 { padding: 0.75rem !important; }
  .p-6 { padding: 1rem !important; }
  .p-8 { padding: 1.25rem !important; }
  .px-4 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
  .px-6 { padding-left: 1rem !important; padding-right: 1rem !important; }
  .px-8 { padding-left: 1.25rem !important; padding-right: 1.25rem !important; }

  .gap-6 { gap: 1rem !important; }
  .gap-4 { gap: 0.75rem !important; }

  .text-\[10px\] { font-size: 9px !important; }
  .text-\[11px\] { font-size: 10px !important; }
  .text-\[12px\] { font-size: 11px !important; }
}

/* ── < 768px: small tablet / large phone (calendar) ── */
@media (max-width: 767px) {
  .fc-toolbar { flex-direction: column !important; gap: 0.75rem !important; }
  .fc-toolbar-title { font-size: 1.1rem !important; }
  .fc-button { padding: 6px 10px !important; font-size: 0.75rem !important; }

  .drawer-panel .content-area { padding: 1rem !important; }
}

/* ── touch devices: prevent iOS zoom on inputs ── */
@media (hover: none) and (pointer: coarse) {
  .resp-touch { min-height: 2.75rem; }
  select, input, textarea, button { font-size: 16px !important; }
}

/* ── print ── */
@media print {
  .no-print { display: none !important; }
}

/* ── Breadcrumbs ── */
.breadcrumbs { font-size: 10px; }
.breadcrumbs a { transition: color 0.2s; }

/* ── Sidebar Favorites & Recent ── */
#favSection, #recentSection { transition: opacity 0.2s; }
.sidebar.collapsed #favSection,
.sidebar.collapsed #recentSection { opacity: 0; pointer-events: none; }

/* ── Kanban / Taller ── */
.kanban-col::-webkit-scrollbar { width: 10px; }
.kanban-col::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
.kanban-col::-webkit-scrollbar-thumb:hover { border-width: 0px; }
html.dark .kanban-col::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }

/* ── Scrollbar: delgado por defecto, grueso al hover ── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
html.dark ::-webkit-scrollbar-thumb { background: #475569; }
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
  border-width: 0px;
}
html.dark ::-webkit-scrollbar-thumb:hover { background: #64748b; }
/* Firefox */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
html.dark * { scrollbar-color: #475569 transparent; }

/* ── Resumen del Ticket: scroll a la izquierda ── */
#summaryContent {
  direction: rtl !important;
}
#summaryContent > *,
#summaryContent .grid,
#summaryContent .mt-8 {
  direction: ltr !important;
}

/* ── Row hover: floating action buttons (replace column) ── */
/* Hide the "Acciones" column header */
th.actions-header {
    width: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden;
    font-size: 0;
    line-height: 0;
    opacity: 0;
    pointer-events: none;
}

/* Action cell: collapsed width, floating content */
.action-cell {
    width: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: visible !important;
    position: relative;
}

/* On mobile card layout, restore action cell display */
@media (max-width: 639px) {
    .action-cell {
        width: auto !important;
        padding: 0.5rem 0 !important;
        border-top: 1px solid #e5e7eb !important;
        display: flex !important;
        justify-content: flex-start !important;
    }
    html.dark .action-cell {
        border-top-color: #27272a !important;
    }
}

/* Floating action bar */
.action-floating {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    background: #fff;
    border-radius: 12px;
    padding: 4px 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 20;
    display: inline-flex;
    gap: 2px;
    align-items: center;
    white-space: nowrap;
}
html.dark .action-floating {
    background: #1f2937;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.06);
}
tr:hover .action-floating,
tbody tr:hover .action-floating {
    opacity: 1;
    transform: translateY(-50%) scale(1);
    pointer-events: auto;
}

/* Touch devices: always show */
@media (hover: none) and (pointer: coarse) {
    .action-floating {
        opacity: 1;
        transform: translateY(-50%) scale(1);
        pointer-events: auto;
    }
    .action-cell {
        width: auto !important;
        padding: 0.5rem 0.75rem !important; /* reset for mobile card layout */
    }
}

/* ── Transition suave para sidebar-text ── */
.sidebar-text { transition: opacity 0.3s, visibility 0.3s; }
.lg\:w-\[90px\] .sidebar-text { opacity: 0; visibility: hidden; }

/* ── Responsive Tables → Cards on Mobile ── */
@media (max-width: 639px) {
    table:not([data-no-responsive]) thead {
        display: none !important;
    }

    table:not([data-no-responsive]),
    table:not([data-no-responsive]) tbody,
    table:not([data-no-responsive]) tr,
    table:not([data-no-responsive]) td {
        display: block;
        width: 100%;
    }

    table:not([data-no-responsive]) tr {
        background: white;
        border-radius: 16px;
        padding: 16px;
        margin-bottom: 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
        border: 1px solid #e5e7eb;
    }

    html.dark table:not([data-no-responsive]) tr {
        background: #18181b;
        border-color: #27272a;
        box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    }

    table:not([data-no-responsive]) td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border: none !important;
        font-size: 13px;
        gap: 8px;
    }

    table:not([data-no-responsive]) td::before {
        content: attr(data-label);
        font-size: 9px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: #9ca3af;
        flex-shrink: 0;
        min-width: 80px;
    }

    html.dark table:not([data-no-responsive]) td::before {
        color: #71717a;
    }

    table:not([data-no-responsive]) td:empty {
        display: none;
    }

    table:not([data-no-responsive]) td:last-child {
        padding-top: 8px;
        margin-top: 8px;
        border-top: 1px solid #e5e7eb !important;
        justify-content: flex-start;
        gap: 8px;
        flex-wrap: wrap;
    }

    html.dark table:not([data-no-responsive]) td:last-child {
        border-top-color: #27272a !important;
    }

    /* Hide empty rows */
    table:not([data-no-responsive]) tbody tr:empty { display: none; }

    /* Force min-width removal on mobile */
    .min-w-\[700px\], .min-w-\[600px\], .min-w-\[500px\] {
        min-width: 0 !important;
    }
}

/* Table headers: distinctas y anchas */
table thead tr {
  background: #f8f6ff !important;
}
html.dark table thead tr {
  background: #1a1a2e !important;
}
table thead th {
  padding: 1rem 0.75rem !important;
  font-size: 0.7rem !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  border-bottom: 2px solid #e5e0f0 !important;
  white-space: nowrap !important;
}
html.dark table thead th {
  border-bottom-color: #2a2a3e !important;
}

/* Desktop: table rows mas delgadas */
@media (min-width: 1024px) {
  table th, table td { padding: 0 !important; }
  table tbody tr { line-height: 1 !important; }
  table td .flex.items-center.gap-4 { gap: 0.25rem !important; }
  table td .w-10.h-10 { width: 1.5rem !important; height: 1.5rem !important; }
  table td .w-10.h-10 .text-xl { font-size: 0.875rem !important; }
  table td p { margin: 0 !important; }
  table td p.text-sm { font-size: 0.75rem !important; line-height: 1 !important; }
  table td p.text-\[10px\] { font-size: 0.625rem !important; line-height: 1 !important; }
  table td span.px-3.py-1 { padding: 0.1rem 0.5rem !important; font-size: 0.5rem !important; }
}
