:root {
    --primary: #1e3a8a;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --dark: #1e293b;
    --light: #f8fafc;
    --border: #e2e8f0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f1f5f9;
    font-size: 14px;
}

.content-wrapper {
    background-color: #f1f5f9;
}

/* Dashboard Cards */
.stats-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    overflow: hidden;
    background: white;
}

.stats-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.stats-card .card-body {
    padding: 1.5rem;
}

.stats-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 1rem;
}

.stats-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stats-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-trend {
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* Status Colors */
.status-pendiente { background-color: #fef3c7; color: #92400e; }
.status-planificado { background-color: #dbeafe; color: #1e40af; }
.status-escalado { background-color: #fed7aa; color: #9a3412; }
.status-solucionado { background-color: #d1fae5; color: #065f46; }
.status-cerrado { background-color: #e2e8f0; color: #475569; }
.status-no-publicado { background-color: #fee2e2; color: #991b1b; }

.icon-pendiente { background-color: #fef3c7; color: #f59e0b; }
.icon-planificado { background-color: #dbeafe; color: #3b82f6; }
.icon-solucionado { background-color: #d1fae5; color: #10b981; }
.icon-cerrado { background-color: #e2e8f0; color: #64748b; }
.icon-no-publicado { background-color: #fee2e2; color: #ef4444; }

/* Table Styles */
.ticket-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.ticket-table thead th {
    background-color: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    color: #475569;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.75rem 0.5rem;
    white-space: nowrap;
}

.ticket-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s;
}

.ticket-table tbody tr:hover {
    background-color: #f8fafc;
}

.ticket-table tbody td {
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
    font-size: 0.85rem;
}

#ticketsTable {
    width: 100% !important;
    table-layout: fixed;
}

#ticketsTable th,
#ticketsTable td {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-id {
    font-weight: 600;
    color: var(--primary);
    font-family: 'Courier New', monospace;
}

/* Badges */
.badge-status {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

.badge-priority {
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.priority-alta { background-color: #fee2e2; color: #991b1b; }
.priority-media { background-color: #fef3c7; color: #92400e; }
.priority-baja { background-color: #f1f5f9; color: #64748b; }

/* Buttons */
.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

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

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
}

.btn-primary:hover {
    background-color: #1e40af;
    border-color: #1e40af;
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
    border-radius: 12px 12px 0 0 !important;
}

.card-title {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--dark);
    margin: 0;
}

/* Filters */
.filter-section {
    background: white;
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.filter-section .form-control,
.filter-section .form-select {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.filter-section .form-control:focus,
.filter-section .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* Form Styles */
.form-section {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.form-section-title {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #475569;
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* Ticket Detail */
.ticket-header {
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.ticket-header h2 {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.ticket-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.ticket-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.info-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.info-value {
    font-size: 0.875rem;
    color: var(--dark);
    font-weight: 500;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0.25rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-content {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
}

.timeline-date {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}

/* Sidebar */
.main-sidebar {
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
}

.brand-link {
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 1.25rem 1rem;
}

.nav-sidebar .nav-link {
    border-radius: 8px;
    margin: 0.25rem 0.5rem;
    padding: 0.75rem 1rem;
}

.nav-sidebar .nav-link:hover {
    background-color: rgba(255,255,255,0.1);
}

.nav-sidebar .nav-link.active {
    background-color: rgba(255,255,255,0.15);
}

/* Alerts */
.alert {
    border: none;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left-color: #10b981;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border-left-color: #ef4444;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border-left-color: #f59e0b;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border-left-color: #3b82f6;
}

/* Modal */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 1.5rem;
}

.modal-title {
    font-weight: 700;
    color: var(--dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
}

/* Loading */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-card {
        margin-bottom: 1rem;
    }
    
    .ticket-meta {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* Dashboard Improvements */
.metric-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.metric-card.active {
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    transform: scale(1.05);
}

.quick-action {
    transition: all 0.2s ease;
}

.quick-action:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

#btnRefresh i.fa-spin {
    animation: spin 1s linear infinite;
}

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

.nav-pills .nav-link {
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-pills .nav-link:hover {
    background-color: #f1f5f9;
}

.nav-pills .nav-link.active {
    background-color: var(--primary);
    color: white;
}

.table-responsive {
    border-radius: 12px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
}

/* Knowledge Base Content */
.kb-content {
    line-height: 1.9;
    color: #1e293b;
    font-size: 0.95rem;
}

.kb-content strong {
    font-weight: 700;
    color: #0f172a;
}

/* Dark Mode */
body.dark-mode {
    background-color: #0f172a;
    color: #e2e8f0;
}

body.dark-mode .content-wrapper {
    background-color: #0f172a;
}

body.dark-mode .stats-card,
body.dark-mode .card {
    background: #1e293b !important;
    border: 1px solid #334155;
}

body.dark-mode .card-header {
    background: #334155 !important;
    border-bottom: 1px solid #475569;
    color: #e2e8f0;
}

body.dark-mode .card-title {
    color: #e2e8f0;
}

body.dark-mode .stats-label {
    color: #94a3b8;
}

body.dark-mode .ticket-table {
    background: #1e293b;
}

body.dark-mode .ticket-table thead th {
    background-color: #334155;
    border-bottom: 2px solid #475569;
    color: #cbd5e1;
}

body.dark-mode #ticketsTable thead {
    background: #334155 !important;
}

body.dark-mode #ticketsTable thead tr {
    color: #e2e8f0 !important;
}

body.dark-mode #ticketsTable thead th {
    color: #e2e8f0 !important;
}

body.dark-mode .ticket-table tbody tr {
    border-bottom: 1px solid #334155;
}

body.dark-mode .ticket-table tbody tr:hover {
    background-color: #334155;
}

body.dark-mode .filter-section {
    background: #1e293b;
    border: 1px solid #334155;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: #334155;
    border-color: #475569;
    color: #e2e8f0;
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    background-color: #334155;
    border-color: var(--primary);
    color: #e2e8f0;
}

body.dark-mode .form-label {
    color: #cbd5e1;
}

body.dark-mode .form-section {
    background: #334155;
}

body.dark-mode .form-section-title {
    color: #e2e8f0;
    border-bottom: 2px solid #475569;
}

body.dark-mode .info-card {
    background: #1e293b;
    border: 1px solid #334155;
}

body.dark-mode .info-label {
    color: #94a3b8;
}

body.dark-mode .info-value {
    color: #e2e8f0;
}

body.dark-mode .timeline-content {
    background: #334155;
}

body.dark-mode .timeline-date {
    color: #94a3b8;
}

body.dark-mode .main-footer {
    background: rgba(30, 41, 59, 0.95) !important;
    border-top: 1px solid #334155;
    color: #94a3b8;
}

body.dark-mode .modal-content {
    background: #1e293b;
    color: #e2e8f0;
}

body.dark-mode .modal-header {
    border-bottom: 1px solid #475569;
}

body.dark-mode .modal-footer {
    border-top: 1px solid #475569;
}

body.dark-mode .nav-pills .nav-link:hover {
    background-color: #334155;
}

body.dark-mode .dropdown-menu {
    background: #1e293b;
    border: 1px solid #334155;
}

body.dark-mode .dropdown-item {
    color: #e2e8f0;
}

body.dark-mode .dropdown-item:hover {
    background: #334155;
}

body.dark-mode .dropdown-header {
    color: #94a3b8;
}

body.dark-mode .text-muted {
    color: #94a3b8 !important;
}

body.dark-mode .ticket-id {
    color: #60a5fa;
}

body.dark-mode .dataTables_wrapper .dataTables_filter input,
body.dark-mode .dataTables_wrapper .dataTables_length select {
    background-color: #334155;
    border-color: #475569;
    color: #e2e8f0;
}

body.dark-mode .dataTables_wrapper .dataTables_info,
body.dark-mode .dataTables_wrapper .dataTables_paginate {
    color: #94a3b8;
}

.dataTables_info {
    display: none !important;
}

body.dark-mode .page-link {
    background-color: #334155;
    border-color: #475569;
    color: #e2e8f0;
}

body.dark-mode .page-link:hover {
    background-color: #475569;
    border-color: #64748b;
}

body.dark-mode .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}

body.dark-mode table.dataTable thead th,
body.dark-mode table.dataTable thead td {
    background-color: #334155 !important;
    color: #e2e8f0 !important;
    border-bottom-color: #475569 !important;
}

body.dark-mode .dataTables_scrollHead .table thead th {
    background-color: #334155 !important;
    color: #e2e8f0 !important;
}

body.dark-mode table thead th {
    background-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* Elementos adicionales modo oscuro */
body.dark-mode .bg-white {
    background-color: #1e293b !important;
}

body.dark-mode .text-dark {
    color: #e2e8f0 !important;
}

body.dark-mode .border {
    border-color: #334155 !important;
}

body.dark-mode .alert {
    border-left-width: 4px;
}

body.dark-mode .alert-info {
    background-color: #1e3a5f;
    color: #93c5fd;
}

body.dark-mode .alert-success {
    background-color: #064e3b;
    color: #6ee7b7;
}

body.dark-mode .alert-warning {
    background-color: #78350f;
    color: #fcd34d;
}

body.dark-mode .alert-danger {
    background-color: #7f1d1d;
    color: #fca5a5;
}

body.dark-mode .btn-secondary {
    background-color: #475569;
    border-color: #475569;
}

body.dark-mode .btn-secondary:hover {
    background-color: #64748b;
    border-color: #64748b;
}

body.dark-mode .table {
    color: #e2e8f0;
}

body.dark-mode .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(51, 65, 85, 0.3);
}

body.dark-mode input[type="text"],
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode input[type="number"],
body.dark-mode input[type="date"],
body.dark-mode input[type="time"],
body.dark-mode textarea,
body.dark-mode select {
    background-color: #334155;
    border-color: #475569;
    color: #e2e8f0;
}

body.dark-mode .breadcrumb {
    background-color: #1e293b;
}

body.dark-mode .breadcrumb-item,
body.dark-mode .breadcrumb-item a {
    color: #94a3b8;
}

body.dark-mode .breadcrumb-item.active {
    color: #e2e8f0;
}

body.dark-mode .badge-light {
    background-color: #475569;
    color: #e2e8f0;
}

body.dark-mode hr {
    border-color: #334155;
}

body.dark-mode .list-group-item {
    background-color: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode .nav-tabs {
    border-bottom-color: #334155;
}

body.dark-mode .nav-tabs .nav-link {
    color: #94a3b8;
}

body.dark-mode .nav-tabs .nav-link.active {
    background-color: #1e293b;
    border-color: #334155 #334155 #1e293b;
    color: #e2e8f0;
}

body.dark-mode .close {
    color: #e2e8f0;
    opacity: 0.8;
}

body.dark-mode .close:hover {
    color: #ffffff;
    opacity: 1;
}

/* Texto específico en modo oscuro */
body.dark-mode .card-body p,
body.dark-mode .card-body span:not(.badge),
body.dark-mode .card-body div:not(.stats-icon),
body.dark-mode .modal-body p,
body.dark-mode .modal-body span,
body.dark-mode .form-text,
body.dark-mode .help-block {
    color: #e2e8f0;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: #e2e8f0 !important;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    background: #334155;
    border-radius: 15px;
    cursor: pointer;
    transition: background 0.3s;
}

.dark-mode-toggle.active {
    background: #3b82f6;
}

.dark-mode-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.dark-mode-toggle.active .dark-mode-toggle-slider {
    transform: translateX(30px);
}
