:root {
    --sidebar-width: 60px;
    --sidebar-expanded: 240px;
    --chatbot-btn-color: #ffffff;
    --chatbot-header-text: #ffffff;
    --chatbot-msg-bg: #f3f4f6;
    --chatbot-msg-text: #ffffff;
}

html, body { height: 100%; margin: 0; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; overflow: hidden; }
#wrapper { height: 100vh; overflow: hidden; }
#page-content-wrapper { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
#pageContent { flex: 1; overflow-y: auto; }

/* Sidebar - Modo Hover (default) */
.sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: #fff;
    transition: min-width .25s ease, max-width .25s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 100;
    overflow-y: auto;
}
.sidebar:hover {
    min-width: var(--sidebar-expanded);
    max-width: var(--sidebar-expanded);
}
.sidebar .nav-link {
    color: rgba(255,255,255,.7);
    padding: 12px 20px;
    border-radius: 0;
    transition: all .15s;
    font-size: 14px;
    white-space: nowrap;
    display: flex;
    align-items: center;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
    color: #fff;
    background: var(--sidebar-hover);
    border-left: 3px solid var(--accent);
}
.sidebar .nav-link i { 
    margin-right: 0;
    width: 20px; 
    text-align: center; 
    font-size: 18px;
    min-width: 20px;
}
.sidebar .nav-link .nav-label {
    opacity: 0;
    transition: opacity .15s;
    margin-left: 14px;
    visibility: hidden;
}
.sidebar:hover .nav-link .nav-label {
    opacity: 1;
    visibility: visible;
}
.sidebar .sidebar-header h6 {
    opacity: 0;
    transition: opacity .15s;
    visibility: hidden;
}
.sidebar:hover .sidebar-header h6 {
    opacity: 1;
    visibility: visible;
}
.sidebar .user-info .user-text {
    opacity: 0;
    transition: opacity .15s;
    visibility: hidden;
}
.sidebar:hover .user-info .user-text {
    opacity: 1;
    visibility: visible;
}
.sidebar .sidebar-footer small {
    opacity: 0;
    transition: opacity .15s;
    visibility: hidden;
}
.sidebar:hover .sidebar-footer small {
    opacity: 1;
    visibility: visible;
}

/* Sidebar - Modo Fijo (siempre expandido) */
.sidebar-fijo {
    min-width: var(--sidebar-expanded) !important;
    max-width: var(--sidebar-expanded) !important;
}
.sidebar-fijo .nav-link .nav-label {
    opacity: 1 !important;
    visibility: visible !important;
}
.sidebar-fijo .sidebar-header h6 {
    opacity: 1 !important;
    visibility: visible !important;
}
.sidebar-fijo .user-info .user-text {
    opacity: 1 !important;
    visibility: visible !important;
}
.sidebar-fijo .sidebar-footer small {
    opacity: 1 !important;
    visibility: visible !important;
}
.sidebar-fijo:hover {
    min-width: var(--sidebar-expanded) !important;
    max-width: var(--sidebar-expanded) !important;
}

/* Sidebar - Modo Toggle */
.sidebar-toggle {
    min-width: var(--sidebar-width) !important;
    max-width: var(--sidebar-width) !important;
}
.sidebar-toggle .nav-link .nav-label {
    opacity: 0 !important;
    visibility: hidden !important;
}
.sidebar-toggle .sidebar-header h6 {
    opacity: 0 !important;
    visibility: hidden !important;
}
.sidebar-toggle .user-info .user-text {
    opacity: 0 !important;
    visibility: hidden !important;
}
.sidebar-toggle .sidebar-footer small {
    opacity: 0 !important;
    visibility: hidden !important;
}
.sidebar-toggle:hover {
    min-width: var(--sidebar-width) !important;
    max-width: var(--sidebar-width) !important;
}
.sidebar-toggle.open {
    min-width: var(--sidebar-expanded) !important;
    max-width: var(--sidebar-expanded) !important;
}
.sidebar-toggle.open .nav-link .nav-label {
    opacity: 1 !important;
    visibility: visible !important;
}
.sidebar-toggle.open .sidebar-header h6 {
    opacity: 1 !important;
    visibility: visible !important;
}
.sidebar-toggle.open .user-info .user-text {
    opacity: 1 !important;
    visibility: visible !important;
}
.sidebar-toggle.open .sidebar-footer small {
    opacity: 1 !important;
    visibility: visible !important;
}

#page-content-wrapper { min-width: 0; width: 100%; }
.user-info { background: rgba(255,255,255,.05); }

/* Cards */
.card { border: none; box-shadow: 0 1px 3px rgba(0,0,0,.08); border-radius: 10px; }
.card-header { background: transparent; border-bottom: 1px solid rgba(0,0,0,.05); font-weight: 600; }
.stat-card { border-radius: 12px; transition: all .2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }

/* Tables */
.table th { font-weight: 600; font-size: 13px; color: #6c757d; border-bottom-width: 1px; }
.table td { vertical-align: middle; font-size: 14px; }
.table-hover tbody tr:hover { background: var(--accent-light); }

/* Tickets */
.ticket-badge { font-size: 12px; padding: 4px 10px; border-radius: 20px; font-weight: 500; }
.priority-critical { background: #dc3545; color: #fff; }
.priority-high { background: #fd7e14; color: #fff; }
.priority-medium { background: #ffc107; color: #000; }
.priority-low { background: #28a745; color: #fff; }

/* Notificaciones */
.notif-dropdown { width: 380px; max-height: 480px; border: none; border-radius: 12px; overflow: hidden; }
.notif-list { max-height: 360px; overflow-y: auto; scrollbar-width: thin; }
.notif-header { background: var(--bg-card, #fff); border-bottom: 1px solid var(--border-color, #eee); }
.notif-footer { background: var(--bg-card, #fff); font-size: 11px; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border-color, #f0f0f0); cursor: pointer; transition: all .15s; display: flex; align-items: flex-start; gap: 10px; }
.notif-item:hover { background: var(--hover-bg, #f5f5f5); }
.notif-item.unread { background: var(--accent-light, #eef2ff); border-left: 3px solid var(--accent, #6366f1); }
.notif-item .notif-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.notif-item .notif-body { flex: 1; min-width: 0; }
.notif-item .notif-body .notif-title { font-size: 12px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item .notif-body .notif-msg { font-size: 11px; opacity: .8; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-item .notif-body .notif-time { font-size: 10px; opacity: .5; }
@keyframes notif-bounce { 0%,100% { transform: scale(1); } 30% { transform: scale(1.3); } 60% { transform: scale(.9); } }
.notif-bounce { animation: notif-bounce .5s ease; }
/* Kanban responsive */
#tkKanbanView .row {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}
#tkKanbanView .row > div {
    min-width: 280px;
    max-width: 320px;
    scroll-snap-align: start;
}
@media (max-width: 768px) {
    #tkKanbanView .row > div {
        min-width: 75vw;
    }
}

.notif-item:hover { background: #f8f9fa; }
.notif-item.unread { background: var(--accent-light); border-left: 3px solid var(--accent); }

/* Mensajes ticket */
.mensaje-bubble { max-width: 80%; padding: 12px 16px; border-radius: 16px; margin-bottom: 8px; }
.mensaje-mio { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; margin-left: auto; }
.mensaje-otro { background: #f1f3f5; border-bottom-left-radius: 4px; }

/* Animations */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.slide-down { animation: slideDown .3s ease; }
@keyframes slideDown { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 200px; } }

/* Bot\u00f3n API Docs animado */
.btn-docs {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    border: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(26,26,46,0.3);
}
.btn-docs:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(26,26,46,0.4);
    color: #fff;
    background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
}
.btn-docs:active {
    transform: translateY(0);
}
.btn-docs i {
    animation: pulse-icon 2s infinite;
}
@keyframes pulse-icon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
.btn-docs::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.3s;
    opacity: 0;
}
.btn-docs:hover::after {
    left: 100%;
    opacity: 1;
}
html[data-tema="dark"] .btn-docs {
    box-shadow: 0 2px 8px rgba(88,166,255,0.15);
}
html[data-tema="dark"] .btn-docs:hover {
    box-shadow: 0 4px 16px rgba(88,166,255,0.25);
}

/* Modal */
.modal-header { border-radius: 10px 10px 0 0; }

/* Login */
#loginModal .modal-content { border-radius: 16px; }

/* Botones flotantes */
.btn-float { position: fixed; bottom: 20px; right: 20px; width: 56px; height: 56px; border-radius: 50%; font-size: 24px; z-index: 100; box-shadow: 0 4px 12px rgba(0,0,0,.3); }

/* ════════════════════════════════════════════════════
   TEMAS PROFESIONALES
   ════════════════════════════════════════════════════
   5 temas completos con paletas diferenciadas:
   - light    → Claro profesional moderno
   - dark     → Oscuro premium (GitHub-style)
   - ocean    → Azul profundo con acentos turquesa
   - midnight → Púrpura oscuro intenso
   - nature   → Verde teal corporativo relajante
   ════════════════════════════════════════════════════ */

/* ── LIGHT: Claro profesional ── */
html[data-tema="light"] {
    --body-bg: #f4f6f9;
    --body-color: #212529;
    --card-bg: #ffffff;
    --card-border: #dee2e6;
    --navbar-bg: rgba(255,255,255,0.92);
    --table-color: #212529;
    --table-hover-bg: #f0f4ff;
    --input-bg: #ffffff;
    --input-color: #212529;
    --input-border: #d1d5db;
    --modal-bg: #ffffff;
    --modal-header-bg: #f8f9fa;
    --header-color: #111827;
    --sidebar-bg: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    --sidebar-hover: rgba(255,255,255,0.08);
    --accent: #3b82f6;
    --accent-light: #eff4ff;
    --accent-hover: #2563eb;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
    --badge-bg: #f3f4f6;
    --tag-bg: #e5e7eb;
    --modal-backdrop: rgba(0,0,0,0.4);
    --scrollbar-track: #e5e7eb;
    --scrollbar-thumb: #9ca3af;
    --btn-ghost-hover: #f3f4f6;
    --nav-link-hover: rgba(255,255,255,0.08);
    --login-modal-bg: rgba(10,16,30,0.7);
    --login-card-bg: #ffffff;
    --gamification-open-bg: #f0f4ff;
    --gamification-streak-bg: #fffbeb;
    --gamification-rating-bg: #f0fdf4;
    --gamification-rank-bg: #fef2f2;
    --chatbot-btn-color: #ffffff;
    --chatbot-header-text: #ffffff;
    --chatbot-msg-bg: #f3f4f6;
    --chatbot-msg-text: #ffffff;
}

/* ── DARK: Oscuro premium ── */
html[data-tema="dark"] {
    --body-bg: #0d1117;
    --body-color: #c9d1d9;
    --card-bg: #161b22;
    --card-border: #30363d;
    --navbar-bg: rgba(22,27,34,0.92);
    --table-color: #c9d1d9;
    --table-hover-bg: #1c2333;
    --input-bg: #0d1117;
    --input-color: #c9d1d9;
    --input-border: #30363d;
    --modal-bg: #161b22;
    --modal-header-bg: #1c2333;
    --header-color: #e6edf3;
    --sidebar-bg: #0d1117;
    --sidebar-hover: #161b22;
    --accent: #58a6ff;
    --accent-light: #1c2c3e;
    --accent-hover: #79c0ff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
    --badge-bg: #21262d;
    --tag-bg: #1c2333;
    --modal-backdrop: rgba(0,0,0,0.7);
    --scrollbar-track: #21262d;
    --scrollbar-thumb: #30363d;
    --btn-ghost-hover: #21262d;
    --nav-link-hover: #161b22;
    --login-modal-bg: rgba(0,0,0,0.8);
    --login-card-bg: #161b22;
    --gamification-open-bg: #1e1e3a;
    --gamification-streak-bg: #2a2416;
    --gamification-rating-bg: #162e1a;
    --gamification-rank-bg: #2a1616;
    --chatbot-btn-color: #ffffff;
    --chatbot-header-text: #ffffff;
    --chatbot-msg-bg: #1c2333;
    --chatbot-msg-text: #ffffff;
}

/* ── OCEAN: Azul profundo elegante ── */
html[data-tema="ocean"] {
    --body-bg: #eef2f8;
    --body-color: #1a2a3a;
    --card-bg: #ffffff;
    --card-border: #c8d8e8;
    --navbar-bg: rgba(255,255,255,0.92);
    --table-color: #1a2a3a;
    --table-hover-bg: #e8f4fd;
    --input-bg: #ffffff;
    --input-color: #1a2a3a;
    --input-border: #b0c8dc;
    --modal-bg: #ffffff;
    --modal-header-bg: #f0f7fc;
    --header-color: #0a2647;
    --sidebar-bg: linear-gradient(180deg, #0a1628 0%, #0d2137 50%, #10324f 100%);
    --sidebar-hover: rgba(255,255,255,0.07);
    --accent: #0088b3;
    --accent-light: #e6f4fa;
    --accent-hover: #006e9c;
    --shadow-sm: 0 1px 2px rgba(0,40,80,0.06);
    --shadow-md: 0 4px 6px rgba(0,40,80,0.08);
    --shadow-lg: 0 10px 40px rgba(0,40,80,0.14);
    --badge-bg: #eef2f8;
    --tag-bg: #dce6f0;
    --modal-backdrop: rgba(0,20,40,0.5);
    --scrollbar-track: #c8d8e8;
    --scrollbar-thumb: #7fa8c8;
    --btn-ghost-hover: #eef2f8;
    --nav-link-hover: rgba(255,255,255,0.07);
    --login-modal-bg: rgba(8,18,32,0.7);
    --login-card-bg: #ffffff;
    --gamification-open-bg: #e8f4fd;
    --gamification-streak-bg: #fef7e0;
    --gamification-rating-bg: #e6f5ed;
    --gamification-rank-bg: #fde8e8;
    --chatbot-btn-color: #ffffff;
    --chatbot-header-text: #ffffff;
    --chatbot-msg-bg: #eef2f8;
    --chatbot-msg-text: #ffffff;
}

/* ── MIDNIGHT: Púrpura oscuro intenso ── */
html[data-tema="midnight"] {
    --body-bg: #0f0820;
    --body-color: #d4cced;
    --card-bg: #1a1038;
    --card-border: #2d2250;
    --navbar-bg: rgba(22,14,42,0.92);
    --table-color: #d4cced;
    --table-hover-bg: #241a42;
    --input-bg: #120a28;
    --input-color: #d4cced;
    --input-border: #2d2250;
    --modal-bg: #1a1038;
    --modal-header-bg: #241a42;
    --header-color: #e6daf5;
    --sidebar-bg: linear-gradient(180deg, #100820 0%, #180d35 50%, #251350 100%);
    --sidebar-hover: rgba(255,255,255,0.06);
    --accent: #8b5cf6;
    --accent-light: #1e1535;
    --accent-hover: #a78bfa;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.45);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.55);
    --badge-bg: #241a42;
    --tag-bg: #1e1535;
    --modal-backdrop: rgba(8,4,20,0.8);
    --scrollbar-track: #2d2250;
    --scrollbar-thumb: #4a3b78;
    --btn-ghost-hover: #241a42;
    --nav-link-hover: #1e1535;
    --login-modal-bg: rgba(8,4,20,0.85);
    --login-card-bg: #1a1038;
    --gamification-open-bg: #241a42;
    --gamification-streak-bg: #2a2018;
    --gamification-rating-bg: #1a2e20;
    --gamification-rank-bg: #2a1a1a;
    --chatbot-btn-color: #ffffff;
    --chatbot-header-text: #ffffff;
    --chatbot-msg-bg: #241a42;
    --chatbot-msg-text: #ffffff;
}

/* ── NATURE: Verde teal corporativo ── */
html[data-tema="nature"] {
    --body-bg: #eef4f0;
    --body-color: #1a2e24;
    --card-bg: #ffffff;
    --card-border: #c8ddd4;
    --navbar-bg: rgba(255,255,255,0.92);
    --table-color: #1a2e24;
    --table-hover-bg: #e6f5ed;
    --input-bg: #ffffff;
    --input-color: #1a2e24;
    --input-border: #b0ccc0;
    --modal-bg: #ffffff;
    --modal-header-bg: #eef8f2;
    --header-color: #0a2e20;
    --sidebar-bg: linear-gradient(180deg, #0a1f14 0%, #0d2818 50%, #123d26 100%);
    --sidebar-hover: rgba(255,255,255,0.07);
    --accent: #0d8a62;
    --accent-light: #e6f5ed;
    --accent-hover: #0a7553;
    --shadow-sm: 0 1px 2px rgba(0,30,20,0.06);
    --shadow-md: 0 4px 6px rgba(0,30,20,0.08);
    --shadow-lg: 0 10px 40px rgba(0,30,20,0.14);
    --badge-bg: #eef4f0;
    --tag-bg: #d8e6df;
    --modal-backdrop: rgba(8,30,18,0.5);
    --scrollbar-track: #c8ddd4;
    --scrollbar-thumb: #78a890;
    --btn-ghost-hover: #eef4f0;
    --nav-link-hover: rgba(255,255,255,0.07);
    --login-modal-bg: rgba(8,20,12,0.7);
    --login-card-bg: #ffffff;
    --gamification-open-bg: #e6f5ed;
    --gamification-streak-bg: #fef7e0;
    --gamification-rating-bg: #e6f5ed;
    --gamification-rank-bg: #fde8e8;
    --chatbot-btn-color: #ffffff;
    --chatbot-header-text: #ffffff;
    --chatbot-msg-bg: #eef4f0;
    --chatbot-msg-text: #ffffff;
}

/* Aplicar variables a elementos */
body {
    background: var(--body-bg, #f4f6f9);
    color: var(--body-color, #212529);
    transition: background 0.3s ease, color 0.3s ease;
}
.card {
    background: var(--card-bg, #fff);
    border-color: var(--card-border, #dee2e6) !important;
    box-shadow: var(--shadow-sm);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.table {
    color: var(--table-color, #212529) !important;
}
.table-hover tbody tr:hover {
    background: var(--table-hover-bg, var(--accent-light)) !important;
}
.navbar {
    position: sticky;
    top: 0;
    z-index: 99;
    background: var(--navbar-bg, #fff) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background 0.3s ease;
}
.form-control, .form-select {
    background: var(--input-bg, #fff) !important;
    color: var(--input-color, #212529) !important;
    border-color: var(--input-border, #dee2e6) !important;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.modal-content {
    background: var(--modal-bg, #fff);
    transition: background 0.3s ease;
}
.modal-header {
    background: var(--modal-header-bg, #f8f9fa);
    transition: background 0.3s ease;
}
h1, h2, h3, h4, h5, h6 {
    color: var(--header-color, #212529);
    transition: color 0.3s ease;
}
.modal-backdrop.show {
    opacity: 0.5;
}
.modal-backdrop {
    background: var(--modal-backdrop, rgba(0,0,0,0.4));
}
/* Login modal */
#loginModal .modal-content {
    background: var(--login-card-bg, #fff);
}
#loginModal .modal-backdrop {
    background: var(--login-modal-bg, rgba(0,0,0,0.5));
}

/* ============================================ */
/* SUBMENU ADMINISTRACION */
/* ============================================ */

.admin-submenu {
    display: none;
    padding-left: 0;
    background: rgba(255,255,255,.04);
    border-left: 2px solid var(--accent);
    margin-left: 14px;
    border-radius: 0 4px 4px 0;
}

.admin-submenu.show {
    display: block;
}

.admin-submenu .sub-item {
    padding: 6px 16px 6px 20px;
    font-size: 13px;
}

.admin-submenu .sub-item i {
    font-size: 14px;
    margin-right: 10px;
    width: 20px;
    text-align: center;
    opacity: 0.7;
}

.admin-submenu .sub-item:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

/* Flecha del submenu */
.submenu-arrow {
    transition: transform 0.2s ease;
    font-size: 11px;
    opacity: 0.5;
    display: inline-block;
}

.submenu-arrow.rotated {
    transform: rotate(180deg);
}

.sidebar .nav-link[data-p="admin"]:hover {
    background: var(--sidebar-hover);
}

/* Comportamiento en modo colapsado (toggle): 
   cuando el sidebar esta angosto y se hace clic en Admin,
   el submenu aparece fuera del sidebar como dropdown flotante */
.sidebar-toggle .admin-submenu.show {
    position: fixed;
    left: var(--sidebar-width);
    top: auto;
    min-width: 200px;
    background: var(--sidebar-bg);
    border: 1px solid rgba(255,255,255,.1);
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    padding: 6px 0;
    margin-left: 0;
    box-shadow: 4px 4px 16px rgba(0,0,0,.3);
    z-index: 1050;
}

.sidebar-toggle .admin-submenu.show .sub-item {
    padding: 8px 20px;
    white-space: nowrap;
}

/* Ajustar posicion del submenu flotante basado en la posicion del toggle */
.sidebar-toggle #adminToggle {
    position: relative;
}

/* Modo hover: el submenu se expande dentro */
.sidebar:not(.sidebar-toggle):not(.sidebar-fijo) .admin-submenu.show {
    background: rgba(255,255,255,.04);
}

/* Quitar los estilos theme-dark antiguos */

/* Scroll */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ============================================ */
/* TICKETS - REDISEÑADO */
/* ============================================ */

/* Fila de ticket */
.ticket-row {
    transition: background .15s;
}
.ticket-row:hover {
    background: #f8f9ff;
}

/* Tabla de tickets - proporciones limpias */
#tkTable thead th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
    padding: 10px 8px;
    white-space: nowrap;
    user-select: none;
}
#tkTable td {
    padding: 10px 8px;
    border-bottom: 1px solid #f3f4f6;
}
#tkTable .table-danger td {
    background: #fef2f2;
}
/* Checkbox más visible */
#tkTable .ticket-compare-cb {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: #3b82f6;
}

/* Barra de prioridad izquierda */
.ticket-priority-bar {
    width: 3px;
    height: 36px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Badge de ticket */
.ticket-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
}

/* Mini avatar circular */
.tk-avatar-mini {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Botones de accion pequeños */
.tk-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Tarjeta kanban */
.ticket-kanban-card {
    transition: transform .15s, box-shadow .15s;
}
.ticket-kanban-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1) !important;
}

/* Kanban drag & drop */
.kanban-board {
    height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
}
.kanban-board .kanban-wrap {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
}
.kanban-row {
    display: flex;
    gap: 16px;
    min-height: 100%;
    padding-bottom: 8px;
}
.kanban-col {
    min-width: 280px;
    max-width: 320px;
    flex: 1;
    background: var(--card-bg,#f8f9fa);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--border-color,#e9ecef);
    display: flex;
    flex-direction: column;
    max-height: 100%;
}
.kanban-tickets {
    flex: 1;
    overflow-y: auto;
    min-height: 60px;
    transition: background .2s;
    border-radius: 8px;
    padding: 4px;
}
.kanban-card {
    transition: transform .15s, box-shadow .15s;
}
.kanban-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1) !important;
}
.kanban-card:active {
    cursor: grabbing !important;
}

/* Burbujas de chat */
.chat-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.chat-bubble-mia {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-bubble-otra {
    background: #f0f0f5;
    color: #212529;
    border-bottom-left-radius: 4px;
}

[theme-mode="dark"] .chat-bubble-otra {
    background: #2a2a3e;
    color: #e0e0e0;
}

/* Scroll suave */
#dtChatMessages::-webkit-scrollbar,
#dtSidebar::-webkit-scrollbar {
    width: 4px;
}
#dtChatMessages::-webkit-scrollbar-thumb,
#dtSidebar::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,.1);
    border-radius: 2px;
}

/* Filtros responsive */
@media (max-width: 768px) {
    .sidebar { margin-left: -240px; position: fixed; z-index: 1000; }
    .sidebar.show { margin-left: 0; }
    .chat-bubble { max-width: 90%; }
}

/* ============================================ */
/* WIZARD NUEVO TICKET */
/* ============================================ */

/* Steps */
.wizard-step {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: .4;
    transition: opacity .3s;
    cursor: default;
}
.wizard-step.active { opacity: 1; }
.wizard-step.completed { opacity: .7; }

.wizard-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background: #e5e7eb;
    color: #6b7280;
    transition: all .3s;
}
.wizard-step.active .wizard-circle {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(13,110,253,.2);
}
.wizard-step.completed .wizard-circle {
    background: #198754;
    color: #fff;
    font-size: 0;
}
.wizard-step.completed .wizard-circle::after {
    content: '\2713';
    font-size: 14px;
}

.wizard-label {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.wizard-line {
    flex: 1;
    height: 2px;
    background: #e5e7eb;
    margin: 0 8px;
    min-width: 20px;
}
.wizard-step.completed ~ .wizard-line {
    background: var(--accent);
}

/* Prioridad cards */
.prioridad-card.selected {
    border-color: var(--accent) !important;
    background: rgba(13,110,253,.06);
    box-shadow: 0 0 0 3px rgba(13,110,253,.15);
}
.prioridad-card:hover {
    border-color: #bbb !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
}

/* Dropzone captura */
#pasteZone:hover {
    border-color: var(--accent) !important;
    background: rgba(13,110,253,.03);
}

/* Responsive */
@media (max-width: 576px) {
    .wizard-label { display: none; }
    .wizard-line { min-width: 10px; }
    .prioridad-card { min-width: 70px !important; padding: 8px !important; }
    .prioridad-card div:first-child { font-size: 18px !important; }
}

/* Modal detalle ticket profesional */
#detalleTicketModal .modal-content {
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
#detalleTicketModal .modal-header {
    border-radius: 16px 16px 0 0;
}
#detalleTicketModal .modal-body {
    overflow: hidden;
}
#dtSidebarContent .ticket-badge {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
}
#dtChatMessages .mensaje-item {
    max-width: 85%;
    margin-bottom: 8px;
}
#dtChatMessages .mensaje-item.mensaje-propio {
    margin-left: auto;
}
#dtChatMessages .mensaje-item .mensaje-contenido {
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
}
#dtChatMessages .mensaje-item.mensaje-propio .mensaje-contenido {
    background: #0d6efd;
    color: #fff;
    border-radius: 12px 12px 4px 12px;
}
#dtChatMessages .mensaje-item:not(.mensaje-propio) .mensaje-contenido {
    background: #f0f2f5;
    color: #1a1a1a;
    border-radius: 12px 12px 12px 4px;
}
@media (max-width: 767px) {
    #detalleTicketModal .modal-dialog {
        margin: 0;
        max-width: 100%;
    }
    #detalleTicketModal .modal-content {
        border-radius: 0 !important;
        max-height: 100vh !important;
        min-height: 100vh;
    }
    #dtChatMessages .mensaje-item {
        max-width: 95%;
    }
}

.sugerencia-item {
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
    color: var(--bs-body-color, #333);
}
.sugerencia-item:hover {
    background: var(--bs-light, #f0f0f0);
}

/* ===== Responsive Mobile ===== */
@media (max-width: 767.98px) {
    /* Sidebar como overlay */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -260px !important;
        bottom: 0 !important;
        z-index: 1050 !important;
        min-width: 240px !important;
        max-width: 240px !important;
        transition: left .3s ease !important;
        box-shadow: 2px 0 12px rgba(0,0,0,.15) !important;
    }
    .sidebar:hover {
        min-width: 240px !important;
        max-width: 240px !important;
    }
    .sidebar.mobile-open {
        left: 0 !important;
    }
    .sidebar .nav-link .nav-label {
        opacity: 1 !important;
        visibility: visible !important;
    }
    .sidebar .sidebar-header h6 {
        opacity: 1 !important;
        visibility: visible !important;
    }
    .sidebar .user-info .user-text {
        opacity: 1 !important;
        visibility: visible !important;
    }
    .sidebar .sidebar-footer small {
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    /* Overlay detrás del sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,.4);
        z-index: 1049;
    }
    .sidebar-overlay.show {
        display: block;
    }
    
    /* Main content ocupa todo el ancho */
    #page-content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    /* Botón hamburguesa visible en mobile */
    #menuToggleBtn {
        display: inline-block !important;
    }
    
    /* Tablas con scroll horizontal */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .table-responsive .table th, 
    .table-responsive .table td {
        white-space: nowrap;
    }
    
    /* Tarjetas full width */
    .row.g-3 > [class*="col-"] {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    /* Modal responsive */
    .modal-dialog {
        margin: .5rem !important;
        max-width: calc(100vw - 1rem) !important;
    }
    
    /* Grid de tarjetas apiladas */
    .card-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Botones de acción compactos */
    .btn-group-mobile {
        display: flex !important;
        flex-wrap: wrap;
        gap: 4px;
    }
    .btn-group-mobile .btn {
        flex: 1;
        min-width: 0;
        font-size: .8rem;
        padding: 4px 8px;
    }
}
