/* =============================================
   🌓 Sistema de Temas — ManteIA Design System
   Basado en Shadcn/UI + Tailwind HSL variables
   ============================================= */

@custom-variant dark (&:where(.dark, .dark *));

:root {
  /* 🖤 LIGHT MODE — Fondo limpio, alto contraste */
  --background: 0 0% 100%;           /* #FFFFFF */
  --foreground: 240 10% 3.9%;        /* #09090B */

  --card: 0 0% 100%;                 /* #FFFFFF */
  --card-foreground: 240 10% 3.9%;   /* #09090B */

  --popover: 0 0% 100%;              /* #FFFFFF */
  --popover-foreground: 240 10% 3.9%;

  --primary: 221.2 83.2% 53.3%;      /* #3B82F6 */
  --primary-foreground: 210 40% 98%;

  --secondary: 240 4.8% 95.9%;       /* #F4F4F5 */
  --secondary-foreground: 240 5.9% 10%;

  --muted: 240 4.8% 95.9%;           /* #F4F4F5 */
  --muted-foreground: 240 3.8% 46.1%; /* #71717A */

  --accent: 240 4.8% 95.9%;          /* #F4F4F5 */
  --accent-foreground: 240 5.9% 10%;

  --destructive: 0 84.2% 60.2%;      /* #EF4444 */
  --destructive-foreground: 0 0% 98%;

  --border: 240 5.9% 90%;            /* #E4E4E7 */
  --input: 240 5.9% 90%;             /* #E4E4E7 */
  --ring: 221.2 83.2% 53.3%;        /* #3B82F6 */

  /* Sidebar Light */
  --sidebar-background: 0 0% 98%;
  --sidebar-foreground: 240 5.3% 26.1%;
  --sidebar-primary: 221.2 83.2% 53.3%;
  --sidebar-primary-foreground: 0 0% 98%;
  --sidebar-accent: 240 4.8% 95.9%;
  --sidebar-accent-foreground: 240 5.9% 10%;
  --sidebar-border: 220 13% 91%;
  --sidebar-ring: 221.2 83.2% 53.3%;

  --radius: 0.75rem;                 /* 12px */

  /* Tokens legacy (compatibilidad) */
  --bg-app: hsl(var(--background));
  --bg-card: hsl(var(--card));
  --border-ui: hsl(var(--border));
  --brand-primary: hsl(var(--primary));
  --sidebar-bg: hsl(240 5.9% 10%);
  --text-main: hsl(var(--foreground));
  --text-muted: hsl(var(--muted-foreground));
  --radius-2xl: 16px;
  --radius-xl: 12px;
  --transition-ui: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark {
  /* 🌙 DARK MODE — Fondo profundo, bajo brillo */
  --background: 240 10% 3.9%;        /* #09090B */
  --foreground: 0 0% 98%;            /* #FAFAFA */

  --card: 240 10% 5.9%;             /* #0E0E10 */
  --card-foreground: 0 0% 98%;

  --popover: 240 10% 5.9%;
  --popover-foreground: 0 0% 98%;

  --primary: 217.2 91.2% 59.8%;      /* #60A5FA */
  --primary-foreground: 222.2 47.4% 11.2%;

  --secondary: 240 3.7% 15.9%;       /* #27272A */
  --secondary-foreground: 0 0% 98%;

  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;  /* #A1A1AA */

  --accent: 240 3.7% 15.9%;
  --accent-foreground: 0 0% 98%;

  --destructive: 0 62.8% 30.6%;      /* rojo oscuro */
  --destructive-foreground: 0 0% 98%;

  --border: 240 3.7% 15.9%;          /* #27272A */
  --input: 240 3.7% 15.9%;
  --ring: 217.2 91.2% 59.8%;

  /* Sidebar Dark */
  --sidebar-background: 240 5.9% 10%;
  --sidebar-foreground: 240 4.8% 95.9%;
  --sidebar-primary: 217.2 91.2% 59.8%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 240 3.7% 15.9%;
  --sidebar-accent-foreground: 240 4.8% 95.9%;
  --sidebar-border: 240 3.7% 15.9%;
  --sidebar-ring: 217.2 91.2% 59.8%;

  /* Tokens legacy (dark override) */
  --bg-app: hsl(var(--background));
  --bg-card: hsl(var(--card));
  --border-ui: hsl(var(--border));
  --brand-primary: hsl(var(--primary));
  --sidebar-bg: hsl(var(--sidebar-background));
  --text-main: hsl(var(--foreground));
  --text-muted: hsl(var(--muted-foreground));
}

/* Minimal base overrides to follow the GMAO PREMIUM manifesto */
html, body {
  background: var(--bg-app);
  color: var(--text-main);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

/* Prevención de 'Pull-to-refresh' o rebote vertical en el contenido principal */
#content-area {
  overscroll-behavior-y: none;
}

/* Comportamiento táctil en contenedores scrolleables (Tablas y Sliders) */
.overflow-x-auto, 
.table-container, 
.custom-scrollbar-x,
#kanban-board {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
}

.gmao-card { background: var(--bg-card); border-radius: var(--radius-2xl); border: 1px solid var(--border-ui); box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05); transition: var(--transition-ui); }
.gmao-card:hover { border-color: #cbd5e1; }

.gmao-input { border-radius: var(--radius-xl); border: 1px solid var(--border-ui); padding: 0.6rem 0.75rem; transition: var(--transition-ui); background: #f9fafb; }
.gmao-input:focus { outline: none; background: white; box-shadow: 0 0 0 4px rgba(59,130,246,0.08); border-color: var(--brand-primary); }

.gmao-btn { display: inline-flex; items-center: center; justify-content: center; gap: 0.5rem; background: var(--brand-primary); color: white; padding: 0.6rem 1.25rem; border-radius: var(--radius-xl); font-weight: 600; font-size: 0.875rem; transition: var(--transition-ui); border: none; cursor: pointer; }
.gmao-btn:hover { filter: brightness(1.1); box-shadow: 0 4px 12px -2px rgba(59, 130, 246, 0.3); }
.gmao-btn.secondary { background: white; color: var(--text-muted); border: 1px solid var(--border-ui); }
.gmao-btn.secondary:hover { background: #f9fafb; color: var(--text-main); border-color: #cbd5e1; box-shadow: none; }
.gmao-btn.ghost { background: transparent; color: var(--text-muted); border: none; }
.gmao-btn.ghost:hover { background: #f1f5f9; color: var(--text-main); }
.gmao-btn:active { transform: scale(0.98); }

/* Estado deshabilitado para botones */
.gmao-btn:disabled,
.gmao-btn.disabled {
  background: #cbd5e1 !important;
  color: #94a3b8 !important;
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none !important;
  transform: none !important;
}

.gmao-btn:disabled:hover,
.gmao-btn.disabled:hover {
  filter: none;
  box-shadow: none;
  transform: none;
}

/* Estado seleccionado para botones de filtro */
.gmao-btn.selected,
.filter-pill.active {
  background: var(--brand-primary) !important;
  color: white !important;
  border-color: var(--brand-primary) !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.gmao-badge { padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.025em; text-transform: uppercase; }
.badge-pending { background: #fefce8; color: #854d0e; border: 1px solid #fef08a; }
.badge-assigned { background: #eff6ff; color: #1e40af; border: 1px solid #dbeafe; }
.badge-in_progress { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.badge-finished { background: #faf5ff; color: #6b21a8; border: 1px solid #f3e8ff; }
.badge-validated { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-rejected { background: #fef2f2; color: #991b1b; border: 1px solid #fee2e2; }

.workorder-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(320px,1fr)); gap: 1rem; }
.workorder-card { padding: 1rem; display:flex; flex-direction:column; gap:0.5rem; }

.skeleton-row { height: 72px; border-radius: 12px; }

.hidden-mobile { display: none; }
@media (min-width: 768px) { .hidden-mobile { display: block; } }

.transition-ui { transition: var(--transition-ui); }

/* Empty state */
.empty-state { text-align:center; padding:2rem; }

/* --- ASISTENTE DE CAMPO (CHAT OT) --- */

/* Reformulación Final del Layout del Modal */
#wo-detail-modal > div {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 42rem; /* Estado normal (Cerrado) */
    height: 90vh;
    transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    background: white;
    position: relative;
}

#wo-detail-modal.chat-open > div {
    max-width: 68rem; /* Expandimos para alojar el chat sin asfixiar la OT */
}

#wo-detail-modal.chat-expanded > div {
    max-width: 100%; /* Todo el ancho disponible */
}

/* Zona principal de la OT (Recuperando el scroll espectacular) */
#wo-detail-modal > div > div:first-of-type {
    flex: 1; /* Ocupa todo el espacio disponible */
    display: flex;
    flex-direction: column;
    min-width: 0; /* Permitir que sea flexible */
    height: 100%;
    background: white;
    z-index: 10;
    transition: all 0.3s ease-in-out;
}

#wo-detail-modal.chat-expanded > div > div:first-of-type {
    flex: 0;
    width: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Scroll interno de la OT */
#wo-detail-scroll-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 2rem;
    min-height: 0; /* Importante para que el flex-1 funcione en contenedores con scroll */
}

/* Contenedor del Asistente (Derecha, Deslizante) */
.ot-assistant-container {
    width: 0;
    flex-shrink: 0;
    height: 100%;
    background: #F8FAFC;
    border-left: 1px solid #F1F5F9;
    display: flex;
    flex-direction: column;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden;
}

#wo-detail-modal.chat-open .ot-assistant-container {
    width: 380px; /* Ancho fijo para el chat */
    visibility: visible;
}

#wo-detail-modal.chat-expanded .ot-assistant-container {
    width: 100%;
    flex: 1;
    border-left: none;
    visibility: visible;
}

.ot-chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: transparent;
}

/* FAB (Botón Flotante) */
.ot-chat-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    background: #3B82F6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.5);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    border: none;
    outline: none;
}

.ot-chat-fab:hover { transform: scale(1.1) rotate(5deg); }

.pulse-notification {
    animation: pulse-blue 2s infinite;
}

@keyframes pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.ot-chat-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 0.75rem;
    height: 0.75rem;
    background: #10B981;
    border: 2px solid white;
    border-radius: 9999px;
}

/* Responsive (Mobile < 768px) */
@media (max-width: 767px) {
    #wo-detail-modal.chat-open > div {
        max-width: 100%;
    }
    
    .ot-assistant-container {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100% !important;
        height: 90vh;
        z-index: 200;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        border-top-left-radius: 1.5rem;
        border-top-right-radius: 1.5rem;
        border-left: none !important;
        box-shadow: 0 -20px 25px -5px rgba(0,0,0,0.1), 0 -10px 10px -5px rgba(0,0,0,0.04);
    }
    
    #wo-detail-modal.chat-open .ot-assistant-container {
        transform: translateY(0);
    }
    
    .body-lock { overflow: hidden !important; }
}

/* Chat UI */
.ot-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #F8FAFC;
    scroll-behavior: smooth;
}

.ot-msg {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.5;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ot-msg-user {
    align-self: flex-end;
    background: #3B82F6;
    color: white;
    border-bottom-right-radius: 0.25rem;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
}

.ot-msg-ai {
    align-self: flex-start;
    background: white;
    color: #1E293B;
    border: 1px solid #E2E8F0;
    border-bottom-left-radius: 0.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Markdown simple styles inside chat */
.ot-msg-ai p { margin-bottom: 0.5rem; }
.ot-msg-ai p:last-child { margin-bottom: 0; }
.ot-msg-ai ul, .ot-msg-ai ol { margin-left: 1.25rem; margin-bottom: 0.5rem; }
.ot-msg-ai code { background: #F1F5F9; padding: 0.1rem 0.3rem; border-radius: 0.25rem; font-size: 0.8rem; }

.ot-suggested-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #E2E8F0;
}

.ot-action-btn {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: left;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ot-action-btn:hover:not(:disabled) {
    background: #E2E8F0;
    border-color: #CBD5E1;
    transform: translateX(4px);
}

.ot-action-btn.btn-loading {
    background: #F8FAFC;
    color: #94A3B8;
    cursor: wait;
}

.ot-action-btn.btn-success {
    background: #DCFCE7;
    color: #166534;
    border-color: #BBF7D0;
}

/* Nuevos estilos para acciones sugeridas con aceptar/rechazar */
.suggested-action-card {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 1rem;
    padding: 0.75rem;
    margin-top: 0.5rem;
    transition: all 0.2s ease;
}

.suggested-action-card:hover {
    border-color: #CBD5E1;
    background: #F1F5F9;
}

.suggested-action-card.accepted {
    border-color: #10B981;
    background: #ECFDF5;
}

.suggested-action-card.rejected {
    opacity: 0.6;
    filter: grayscale(0.5);
    background: #F1F5F9;
}

.chat-locked {
    pointer-events: none;
    opacity: 0.7;
}

.chat-locked textarea, .chat-locked button {
    cursor: not-allowed;
}

.ot-action-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Estilos WhatsApp Recording */
.recording-active-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #FEF2F2;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    flex: 1;
    border: 1px solid #FEE2E2;
}

.recording-dot {
    width: 10px;
    height: 10px;
    background: #EF4444;
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.waveform-sim {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 20px;
    flex: 1;
}

.waveform-sim span {
    width: 3px;
    background: #EF4444;
    border-radius: 10px;
}

/* Pre-escucha styles */
.audio-preview-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #F1F5F9;
    padding: 0.5rem;
    border-radius: 0.75rem;
    flex: 1;
}

.audio-preview-container audio {
    height: 32px;
    flex: 1;
}

.btn-trash {
    padding: 0.5rem;
    color: #94A3B8;
    transition: color 0.2s;
}
.btn-trash:hover { color: #EF4444; }

    /* --- COMPONENTES DE CHAT REUTILIZABLES --- */

/* Animación suave para las transiciones de carga entre vistas */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Guías visuales para el árbol de carpetas */
.tree-line {
  position: relative; /* Necesario para las líneas de conexión */
}
.tree-line > div::before {
  content: "";
  position: absolute; /* Línea vertical */
  left: -1rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background-color: #e5e7eb;
}

/* Animación para rotar el cheurón */
.chevron-icon {
  transition: transform 0.2s ease;
}
.is-collapsed .chevron-icon {
  transform: rotate(-90deg);
}
.is-collapsed .folder-content {
  display: none;
}
.is-collapsed .folder-icon-main {
  color: #9ca3af;
}

/* Estilo para el scrollbar del historial fusionado */
.custom-scrollbar::-webkit-scrollbar {
  width: 3px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Asegura el centrado vertical del login */
#login-section {
  min-height: 100vh !important;
}

/* Optimización para impresión de informes (PDF) */
@media print {
  #main-sidebar,
  #mobile-header,
  #toast-container,
  #upload-status-container,
  .no-print,
  button {
    display: none !important;
  }
  #main-app {
    display: block !important;
  }
  #content-area {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    overflow: visible !important;
  }
}

/* Animación Slide Up para Menús Móviles */
@keyframes slide-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}
.animate-slide-up {
  animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Animación Slide In Right para Paneles Laterales */
@keyframes slide-in-right {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}
.animate-slide-in-right {
  animation: slide-in-right 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Skeleton Screen (Brillo pulsante) */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #f9fafb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite ease-in-out;
  border-radius: 0.5rem;
}
@keyframes skeleton-loading {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* Estilos para acordeones del sidebar */
.accordion-content {
  display: block;
  overflow: visible;
  max-height: 500px;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.accordion-content.hidden {
  display: none;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}

/* Estilos mejorados para el Active State del Sidebar */
.nav-active-item {
  background-color: rgba(30, 41, 59, 0.5) !important; /* bg-slate-800 con opacidad */
  color: #ffffff !important;
  position: relative;
}

.nav-active-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: #3b82f6; /* Azul brillante */
  border-radius: 0 4px 4px 0;
}

.nav-active-item svg {
  color: #ffffff !important;
}

.nav-inactive-item {
  color: #94a3b8 !important; /* text-slate-400 */
}

.nav-inactive-item:hover {
  color: #ffffff !important;
  background-color: rgba(30, 41, 59, 0.3) !important;
}

/* Resalte sutil para el padre activo */
.sidebar-group-active .sidebar-accordion-btn {
  color: #f8fafc !important; /* slate-50 */
}

.sidebar-group-active .sidebar-accordion-btn .chevron-icon {
  color: #3b82f6 !important;
}

.custom-scrollbar-hide::-webkit-scrollbar {
    display: none;
}
.custom-scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.chat-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.animate-bounce-in {
    animation: bounceIn 0.5s cubic-bezier(0.36, 0, 0.66, -0.56) both;
}

@keyframes bounceIn {
    0% { opacity: 0; transform: scale(0.3); }
    50% { opacity: 1; transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* Bottom Sheet Mobile */
.bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: none;
}

.bottom-sheet-overlay.active {
    display: block;
    opacity: 1;
}

.bottom-sheet-container {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
    z-index: 10001;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.1);
}

.bottom-sheet-container.active {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 9999px;
    margin: 12px auto;
    flex-shrink: 0;
}

.bottom-sheet-content {
    overflow-y: auto;
    padding: 0 16px 32px 16px;
}

.bottom-sheet-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: 12px;
    transition: background-color 0.2s;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
}

.bottom-sheet-item:active {
    background-color: #f8fafc;
}

/* Animaciones de Almacén */
.animate-slide-up {
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ============================================
   GMAO SELECT — Misma apariencia que gmao-input
   ============================================ */
.gmao-select {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-ui);
  padding: 0.6rem 0.75rem;
  transition: var(--transition-ui);
  background: #f9fafb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2rem;
  cursor: pointer;
}
.gmao-select:focus {
  outline: none;
  background-color: white;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.08);
  border-color: var(--brand-primary);
}

/* ============================================
   GMAO BTN DANGER — Botón destructivo rojo
   ============================================ */
.gmao-btn.danger {
  background: hsl(var(--destructive));
  color: white;
  border: none;
}
.gmao-btn.danger:hover {
  filter: brightness(0.9);
  box-shadow: 0 4px 12px -2px hsl(var(--destructive) / 0.3);
}

/* ============================================
   GMAO BTN ICON — Botón cuadrado solo icono 36x36
   ============================================ */
.gmao-btn.icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ============================================
   BADGES DE USUARIO
   ============================================ */
.badge-active {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.badge-inactive {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fee2e2;
}
.badge-role {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* ============================================
   GMAO TABLE — Tabla base semántica
   ============================================ */
.gmao-table {
  width: 100%;
  text-align: left;
  border-collapse: collapse;
}
.gmao-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted));
  border-bottom: 1px solid var(--border-ui);
  padding: 1rem;
}
.gmao-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
}
.gmao-table tbody tr:hover {
  background: hsl(var(--muted) / 0.4);
  transition: background-color 0.15s ease;
}

/* ============================================
   GMAO EMPTY STATE — Estado vacío centrado
   ============================================ */
.gmao-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  gap: 0.75rem;
}
.gmao-empty-state svg,
.gmao-empty-state .empty-icon {
  width: 48px;
  height: 48px;
  color: hsl(var(--muted-foreground));
  opacity: 0.5;
}
.gmao-empty-state h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}
.gmao-empty-state p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 24rem;
}

/* ============================================
   GMAO SPINNER — Indicador de carga
   ============================================ */
.gmao-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2.5px solid hsl(var(--muted-foreground) / 0.25);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: gmao-spin 0.7s linear infinite;
}
@keyframes gmao-spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   ESTILOS WIZARD - CREACIÓN DE ARTÍCULO INVENTARIO
   ============================================ */

/* Drag & Drop Zone */
.drag-drop-zone {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drag-drop-zone:hover {
    border-color: var(--brand-primary);
    background: rgba(59, 130, 246, 0.02);
}

.drag-drop-zone.drag-over {
    border-color: var(--brand-primary);
    background: rgba(59, 130, 246, 0.08);
    transform: scale(1.01);
}

.drag-drop-zone.active {
    border-color: var(--brand-primary);
    background: rgba(59, 130, 246, 0.12);
}

/* Lista de Archivos Adjuntos */
.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid var(--border-ui);
    border-radius: var(--radius-xl);
    transition: var(--transition-ui);
}

.file-item:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.file-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.file-item-icon.pdf { background: #FEF2F2; color: #EF4444; }
.file-item-icon.image { background: #F0FDF4; color: #10B981; }
.file-item-icon.cad { background: #EFF6FF; color: #3B82F6; }
.file-item-icon.default { background: #F8FAFC; color: #64748B; }

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

.file-item-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.file-item-remove {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-ui);
    flex-shrink: 0;
}

.file-item-remove:hover {
    background: #FEF2F2;
    color: #EF4444;
}

/* Animaciones del Wizard */
.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   VARIANTES ADICIONALES DE GMAO BTN
   ============================================ */
.gmao-btn.success {
  background: #10b981;
  color: white;
  border: none;
}
.gmao-btn.success:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px -2px rgba(16, 185, 129, 0.3);
}

.gmao-btn.warning {
  background: #f59e0b;
  color: white;
  border: none;
}
.gmao-btn.warning:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px -2px rgba(245, 158, 11, 0.3);
}

.gmao-btn.subtle {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.gmao-btn.subtle:hover {
  background: #e2e8f0;
  color: #1e293b;
  box-shadow: none;
}

/* Responsive para el modal wizard en móvil */
@media (max-width: 767px) {
    #create-inventory-item-modal {
        padding: 0 !important;
    }
    
    #create-inventory-item-modal > div {
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
    
    #create-inventory-item-modal .p-8 {
        padding: 1rem !important;
    }
    
    #create-inventory-item-modal h2 {
        font-size: 1.25rem !important;
    }
    
    #create-inventory-item-modal .grid-cols-1.md\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }
    
    #create-inventory-item-modal .grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
    
    /* Drag & Drop zone en móvil */
    #wizard-drag-drop-zone {
        padding: 2rem 1rem !important;
    }
    
    #wizard-drag-drop-zone svg {
        width: 32px !important;
        height: 32px !important;
    }
}

/* =============================================
   🛞 Utilidad: Ocultar scrollbar (Carruseles)
   ============================================= */
/* Chrome, Safari y Opera */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
/* IE, Edge y Firefox */
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* =============================================
   🪡 Scrollbar horizontal "hilo fino" estilo Notion
   Solo visible al hover, ultra sutil
   ============================================= */
.gmao-scrollbar-x::-webkit-scrollbar {
    height: 5px;
}
.gmao-scrollbar-x::-webkit-scrollbar-track {
    background: transparent;
}
.gmao-scrollbar-x::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 9999px;
    transition: background-color 0.3s ease;
}
.gmao-scrollbar-x:hover::-webkit-scrollbar-thumb {
    background: #e2e8f0;
}
.gmao-scrollbar-x::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* =============================================
   🪡 Scrollbar vertical "hilo fino" estilo Notion
   ============================================= */
.gmao-scrollbar-y::-webkit-scrollbar {
    width: 5px;
}
.gmao-scrollbar-y::-webkit-scrollbar-track {
    background: transparent;
}
.gmao-scrollbar-y::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 9999px;
    transition: background-color 0.3s ease;
}
.gmao-scrollbar-y:hover::-webkit-scrollbar-thumb {
    background: #e2e8f0;
}
.gmao-scrollbar-y::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}
