/* MediX - Sistema de Expediente Médico Electrónico */

/* ===== TEMA LIGHT (Default) ===== */
:root {
    --primary: #0ea5e9;
    --primary-light: #38bdf8;
    --primary-dark: #0284c7;
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --secondary: #6366f1;
    --accent: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --success: #22c55e;
    --info: #3b82f6;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-input: #ffffff;
    --bg-hover: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: 200ms ease;
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Theme toggle */
    --theme-toggle-bg: #e2e8f0;
    --theme-toggle-active: #0ea5e9;
}

/* ===== TEMA DARK ===== */
[data-theme="dark"] {
    --primary: #38bdf8;
    --primary-light: #7dd3fc;
    --primary-dark: #0ea5e9;
    --primary-50: rgba(56, 189, 248, 0.1);
    --primary-100: rgba(56, 189, 248, 0.15);
    --gray-50: #1e293b;
    --gray-100: #273548;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #1e293b;
    --bg-input: #273548;
    --bg-hover: #273548;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --border-light: #273548;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4);
    --theme-toggle-bg: #334155;
    --theme-toggle-active: #38bdf8;
}

/* Dark theme specific overrides */
[data-theme="dark"] .btn-outline {
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .btn-outline:hover {
    background: var(--bg-hover);
}

/* ===== SCROLLBAR PERSONALIZADO ===== */
/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Scrollbar en contenedores específicos */
.custom-select-dropdown::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    width: 6px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Dark theme scrollbar */
[data-theme="dark"]::-webkit-scrollbar-thumb {
    background: var(--gray-500);
}

[data-theme="dark"]::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

[data-theme="dark"] .custom-select-dropdown::-webkit-scrollbar-thumb,
[data-theme="dark"] .modal-body::-webkit-scrollbar-thumb,
[data-theme="dark"] .table-responsive::-webkit-scrollbar-thumb {
    background: var(--gray-500);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

[data-theme="dark"] * {
    scrollbar-color: var(--gray-500) transparent;
}

/* ===== FIX PLACEHOLDER ===== */
.placeholder {
    background: transparent !important;
    background-color: transparent !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    border-color: var(--primary);
    background: var(--bg-input);
}
[data-theme="dark"] .form-control::placeholder {
    color: var(--text-muted);
}
[data-theme="dark"] .modal {
    background: var(--bg-card);
}
[data-theme="dark"] .dropdown-menu {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .dropdown-item:hover {
    background: var(--bg-hover);
}

/* Text utilities dark mode */
[data-theme="dark"] .font-medium {
    color: var(--text-primary);
}
[data-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}

/* Tables dark mode */
[data-theme="dark"] .table th {
    background: var(--bg-input);
    color: var(--text-secondary);
}
[data-theme="dark"] .table td {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .table tbody tr {
    background: var(--bg-card);
}
[data-theme="dark"] .table tbody tr:hover {
    background-color: var(--bg-hover) !important;
}
[data-theme="dark"] .table-container {
    background: var(--bg-card);
}

/* Card titles and text */
[data-theme="dark"] .card-title {
    color: var(--text-primary) !important;
}
[data-theme="dark"] .card-title i {
    color: inherit;
}
[data-theme="dark"] .card-header {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

/* Prescription number */
[data-theme="dark"] .prescription-number {
    color: var(--text-primary);
}

/* Sidebar card (patient show page) */
[data-theme="dark"] .sidebar-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .sidebar-card-header {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .sidebar-card-body {
    background: var(--bg-card);
}

/* Badges - all variants */
[data-theme="dark"] .badge {
    color: inherit;
}
[data-theme="dark"] .badge-secondary {
    background: var(--gray-200);
    color: var(--text-primary);
}
[data-theme="dark"] .badge-primary {
    background: rgba(56, 189, 248, 0.2);
    color: var(--primary);
}
[data-theme="dark"] .badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}
[data-theme="dark"] .badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}
[data-theme="dark"] .badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}
[data-theme="dark"] .badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

/* Medication count */
[data-theme="dark"] .medication-count {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Loading overlay */
[data-theme="dark"] .loading-overlay {
    background: rgba(15, 23, 42, 0.8);
}
[data-theme="dark"] .loading-spinner {
    border-color: var(--border-color);
    border-top-color: var(--primary);
}

/* Table loading state */
[data-theme="dark"] .table-loading,
[data-theme="dark"] .table-container.loading {
    background: var(--bg-card);
}
[data-theme="dark"] tbody tr.loading-row {
    background: var(--bg-card);
}
[data-theme="dark"] .skeleton,
[data-theme="dark"] .skeleton-line {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
}

/* Mobile table cards */
@media (max-width: 768px) {
    [data-theme="dark"] .table-responsive .table tbody tr {
        background: var(--bg-card);
        border-color: var(--border-color);
    }
}

/* Quick action buttons */
[data-theme="dark"] .quick-action-btn {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .quick-action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

/* Help page elements */
[data-theme="dark"] .quick-link-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .quick-link-card:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}
[data-theme="dark"] .faq-item {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .faq-question {
    color: var(--text-primary);
}
[data-theme="dark"] .faq-answer {
    color: var(--text-secondary);
    background: var(--bg-input);
}
[data-theme="dark"] .shortcut-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .shortcut-card kbd {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .contact-section {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .help-header {
    background: linear-gradient(135deg, #0c4a6e 0%, #075985 100%);
}

/* Upcoming list */
[data-theme="dark"] .upcoming-item {
    border-color: var(--border-color);
}
[data-theme="dark"] .upcoming-date {
    background: var(--bg-input);
}

/* Patient list */
[data-theme="dark"] .patient-list-item {
    border-color: var(--border-color);
}
[data-theme="dark"] .patient-list-item:hover {
    background: var(--bg-hover);
}

/* Time badge */
[data-theme="dark"] .time-badge {
    background: var(--bg-input);
    color: var(--primary);
}

/* Consultation card */
[data-theme="dark"] .consultation-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .consultation-card:hover {
    background: var(--bg-hover);
}
[data-theme="dark"] .consultation-card .consultation-date {
    color: var(--text-secondary);
}

/* Prescription card */
[data-theme="dark"] .prescription-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .prescription-card:hover {
    background: var(--bg-hover);
}

/* Medication item */
[data-theme="dark"] .medication-item {
    background: var(--bg-input);
    border-color: var(--border-color);
}
[data-theme="dark"] .medication-item:hover {
    background: var(--bg-hover);
}
[data-theme="dark"] .medication-name {
    color: var(--text-primary);
}
[data-theme="dark"] .medication-details {
    color: var(--text-secondary);
}

/* Stat mini */
[data-theme="dark"] .stat-mini {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .stat-mini-value {
    color: var(--text-primary);
}
[data-theme="dark"] .stat-mini-label {
    color: var(--text-muted);
}

/* Stat card */
[data-theme="dark"] .stat-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .stat-value {
    color: var(--text-primary);
}
[data-theme="dark"] .stat-label {
    color: var(--text-secondary);
}

/* Company card */
[data-theme="dark"] .company-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .company-card:hover {
    background: var(--bg-hover);
}
[data-theme="dark"] .company-name {
    color: var(--text-primary);
}
[data-theme="dark"] .company-info {
    color: var(--text-secondary);
}

/* Settings nav */
[data-theme="dark"] .settings-nav {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .settings-nav-item {
    color: var(--text-secondary);
    border-color: var(--border-color);
}
[data-theme="dark"] .settings-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
[data-theme="dark"] .settings-nav-item.active {
    background: var(--primary-50);
    color: var(--primary);
    border-color: var(--primary);
}

/* Lab results */
[data-theme="dark"] .lab-result-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .lab-param-row {
    border-color: var(--border-color);
}
[data-theme="dark"] .lab-param-name {
    color: var(--text-primary);
}
[data-theme="dark"] .lab-param-value {
    color: var(--text-primary);
}

/* Appointments module */
[data-theme="dark"] .selectedDateTitle,
[data-theme="dark"] .selected-date-title {
    color: var(--text-primary);
}
[data-theme="dark"] .slot-info {
    background: var(--bg-input);
    color: var(--text-primary);
}
[data-theme="dark"] .slot-patient {
    color: var(--text-primary);
}
[data-theme="dark"] .slot-time {
    color: var(--text-secondary);
}
[data-theme="dark"] .time-slot {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .time-slot:hover {
    background: var(--bg-hover);
}
[data-theme="dark"] .time-slot.occupied {
    background: var(--bg-input);
}

/* Patient name */
[data-theme="dark"] .patient-name {
    color: var(--text-primary);
}
[data-theme="dark"] .patient-info {
    color: var(--text-secondary);
}

/* Prescription patient */
[data-theme="dark"] .prescription-patient {
    color: var(--text-primary);
}
[data-theme="dark"] .prescription-date {
    color: var(--text-secondary);
}
[data-theme="dark"] .prescription-info {
    color: var(--text-secondary);
}

/* Consultation module - create/edit/view */
[data-theme="dark"] .consultation-header {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .consultation-section {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .consultation-section-title {
    color: var(--text-primary);
}
[data-theme="dark"] .section-title {
    color: var(--text-primary);
}
[data-theme="dark"] .consultation-content {
    background: var(--bg-card);
}
[data-theme="dark"] .consultation-complaint {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border-color);
}
[data-theme="dark"] .soap-section {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .soap-title {
    color: var(--text-primary);
}
[data-theme="dark"] .soap-content {
    color: var(--text-secondary);
}
[data-theme="dark"] .vitals-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .vital-item {
    background: var(--bg-input);
}
[data-theme="dark"] .vital-label {
    color: var(--text-muted);
}
[data-theme="dark"] .vital-value {
    color: var(--text-primary);
}
[data-theme="dark"] .diagnosis-item {
    background: var(--bg-input);
    border-color: var(--border-color);
}
[data-theme="dark"] .diagnosis-code {
    color: var(--primary);
}
[data-theme="dark"] .diagnosis-name {
    color: var(--text-primary);
}
[data-theme="dark"] .treatment-item {
    background: var(--bg-input);
    color: var(--text-primary);
}
[data-theme="dark"] .notes-section {
    background: var(--bg-input);
    color: var(--text-primary);
}

/* List group */
[data-theme="dark"] .list-group {
    background: var(--bg-card);
}
[data-theme="dark"] .list-group-item {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .list-group-item:hover {
    background: var(--bg-hover);
}
[data-theme="dark"] .list-group-item.active {
    background: var(--primary);
    border-color: var(--primary);
}

/* Generic text elements */
[data-theme="dark"] span {
    color: inherit;
}
[data-theme="dark"] p {
    color: var(--text-primary);
}
[data-theme="dark"] label {
    color: var(--text-primary);
}
[data-theme="dark"] h1, 
[data-theme="dark"] h2, 
[data-theme="dark"] h3, 
[data-theme="dark"] h4, 
[data-theme="dark"] h5, 
[data-theme="dark"] h6 {
    color: var(--text-primary);
}
[data-theme="dark"] strong {
    color: var(--text-primary);
}
[data-theme="dark"] small {
    color: var(--text-secondary);
}

/* Bootstrap margin utilities - ensure text visibility */
[data-theme="dark"] .mb-0,
[data-theme="dark"] .mb-1,
[data-theme="dark"] .mb-2,
[data-theme="dark"] .mb-3,
[data-theme="dark"] .mb-4,
[data-theme="dark"] .mb-5,
[data-theme="dark"] .mt-0,
[data-theme="dark"] .mt-1,
[data-theme="dark"] .mt-2,
[data-theme="dark"] .mt-3,
[data-theme="dark"] .mt-4,
[data-theme="dark"] .mt-5,
[data-theme="dark"] .my-0,
[data-theme="dark"] .my-1,
[data-theme="dark"] .my-2,
[data-theme="dark"] .my-3,
[data-theme="dark"] .my-4,
[data-theme="dark"] .my-5 {
    color: inherit;
}

/* Section body - consultation forms */
[data-theme="dark"] .section-body {
    background: var(--bg-card);
    color: var(--text-primary);
}

[data-theme="dark"] .section-header {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .section-title {
    color: var(--text-primary);
}

/* Vitals grid */
[data-theme="dark"] .vital-input {
    background: var(--bg-input);
    border-color: var(--border-color);
}

[data-theme="dark"] .vital-input:focus-within {
    background: var(--bg-card);
    border-color: var(--primary);
}

[data-theme="dark"] .vital-input label {
    color: var(--text-muted);
}

[data-theme="dark"] .vital-input input {
    background: transparent;
    color: var(--text-primary);
}

[data-theme="dark"] .vital-input .unit {
    color: var(--text-muted);
}

/* SOAP sections in consultations */
[data-theme="dark"] .soap-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .soap-header {
    background: var(--bg-input);
    color: var(--text-primary);
}

/* Diagnosis and treatment items */
[data-theme="dark"] .diagnosis-item,
[data-theme="dark"] .treatment-item,
[data-theme="dark"] .medication-row {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Form sections general */
[data-theme="dark"] .form-section {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .form-section-header {
    background: var(--bg-input);
    color: var(--text-primary);
}

/* Patient show page */
[data-theme="dark"] .patient-header {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .patient-details {
    color: var(--text-secondary);
}
[data-theme="dark"] .info-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .info-label {
    color: var(--text-muted);
}
[data-theme="dark"] .info-value {
    color: var(--text-primary);
}

/* Tabs */
[data-theme="dark"] .nav-tabs {
    border-color: var(--border-color);
}
[data-theme="dark"] .nav-tabs .nav-link {
    color: var(--text-secondary);
}
[data-theme="dark"] .nav-tabs .nav-link:hover {
    color: var(--text-primary);
    border-color: var(--border-color);
}
[data-theme="dark"] .nav-tabs .nav-link.active {
    background: var(--bg-card);
    color: var(--primary);
    border-color: var(--border-color);
    border-bottom-color: var(--bg-card);
}
[data-theme="dark"] .tab-content {
    background: var(--bg-card);
}
[data-theme="dark"] .tab-pane {
    color: var(--text-primary);
}

/* Calendar */
[data-theme="dark"] .calendar {
    background: var(--bg-card);
}
[data-theme="dark"] .calendar-header {
    color: var(--text-primary);
}
[data-theme="dark"] .calendar-day {
    color: var(--text-primary);
}
[data-theme="dark"] .calendar-day:hover {
    background: var(--bg-hover);
}
[data-theme="dark"] .calendar-day.today {
    background: var(--primary-50);
}
[data-theme="dark"] .calendar-day.selected {
    background: var(--primary);
    color: white;
}
[data-theme="dark"] .calendar-day.other-month {
    color: var(--text-muted);
}

/* Empty states */
[data-theme="dark"] .empty-state {
    color: var(--text-secondary);
}
[data-theme="dark"] .empty-state-icon {
    color: var(--text-muted);
}

/* Alerts */
[data-theme="dark"] .alert {
    border-color: var(--border-color);
}
[data-theme="dark"] .alert-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}
[data-theme="dark"] .alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}
[data-theme="dark"] .alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}
[data-theme="dark"] .alert-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

/* Textarea */
[data-theme="dark"] textarea.form-control {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Allergy tags */
[data-theme="dark"] .allergy-tag {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border-color: var(--danger);
}

/* Medical history sections */
[data-theme="dark"] .history-section {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .history-item {
    background: var(--bg-input);
    color: var(--text-primary);
}

/* Stat icons */
[data-theme="dark"] .stat-icon.primary { background: rgba(56, 189, 248, 0.15); }
[data-theme="dark"] .stat-icon.success { background: rgba(34, 197, 94, 0.15); }
[data-theme="dark"] .stat-icon.warning { background: rgba(245, 158, 11, 0.15); }
[data-theme="dark"] .stat-icon.danger { background: rgba(239, 68, 68, 0.15); }
[data-theme="dark"] .stat-icon.info { background: rgba(59, 130, 246, 0.15); }

/* Cards */
[data-theme="dark"] .card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .card-body {
    background: var(--bg-card);
}

/* Toast dark theme */
[data-theme="dark"] .toast {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .toast-title {
    color: var(--text-primary);
}
[data-theme="dark"] .toast-message {
    color: var(--text-secondary);
}
[data-theme="dark"] .toast-close {
    color: var(--text-muted);
}
[data-theme="dark"] .toast-close:hover {
    color: var(--text-primary);
}
[data-theme="dark"] .toast-success .toast-icon {
    background: rgba(34, 197, 94, 0.2);
}
[data-theme="dark"] .toast-danger .toast-icon {
    background: rgba(239, 68, 68, 0.2);
}
[data-theme="dark"] .toast-warning .toast-icon {
    background: rgba(245, 158, 11, 0.2);
}
[data-theme="dark"] .toast-info .toast-icon {
    background: rgba(59, 130, 246, 0.2);
}

/* Context menu */
[data-theme="dark"] .context-menu {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .context-menu-item:hover {
    background: var(--bg-hover);
}

/* Settings page */
[data-theme="dark"] .settings-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .settings-card-header {
    border-color: var(--border-color);
}
[data-theme="dark"] .settings-nav-item {
    color: var(--text-secondary);
}
[data-theme="dark"] .settings-nav-item:hover,
[data-theme="dark"] .settings-nav-item.active {
    background: var(--bg-input);
    color: var(--text-primary);
}

/* Avatar */
[data-theme="dark"] .patient-avatar,
[data-theme="dark"] .avatar {
    background: var(--bg-input);
}

/* Labels */
[data-theme="dark"] .form-label {
    color: var(--text-primary);
}

/* Nav section titles */
[data-theme="dark"] .nav-section-title {
    color: var(--text-muted);
}

/* Sidebar */
[data-theme="dark"] .sidebar {
    background: var(--bg-sidebar);
    border-color: var(--border-color);
}
[data-theme="dark"] .nav-link {
    color: var(--text-secondary);
}
[data-theme="dark"] .nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
[data-theme="dark"] .nav-link.active {
    background: var(--primary-50);
    color: var(--primary);
}

/* Header */
[data-theme="dark"] .app-header {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .header-btn {
    color: var(--text-secondary);
}
[data-theme="dark"] .header-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Search */
[data-theme="dark"] .search-results {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .search-result-item:hover {
    background: var(--bg-hover);
}

*, *::before, *::after { box-sizing: border-box; }

html {
    overflow-x: hidden;
}

body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-body);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

.app-wrapper { display: flex; min-height: 100vh; width: 100%; max-width: 100vw; overflow-x: hidden; }
.app-main { flex: 1; display: flex; flex-direction: column; margin-left: var(--sidebar-width); transition: margin-left var(--transition); min-width: 0; max-width: 100%; }
.sidebar-collapsed .app-main { margin-left: var(--sidebar-collapsed-width); }
.app-content { flex: 1; padding: 24px; margin-top: var(--header-height); width: 100%; max-width: 100%; overflow-x: hidden; }

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    transition: width var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    height: var(--header-height);
    border-bottom: 1px solid var(--border-light);
}

/*.sidebar-brand .brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}*/

.sidebar-brand .brand-logo {
    width: 40px;
    height: 40px;
    background: #ffffff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sidebar-brand .brand-logo img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.sidebar-brand .brand-text {
    margin-left: 12px;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.sidebar-collapsed .sidebar-brand .brand-text { opacity: 0; }

.sidebar-nav { 
    flex: 1; 
    padding: 16px 12px; 
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
.sidebar-nav::-webkit-scrollbar { 
    display: none; /* Chrome, Safari, Opera */
}
.nav-section { margin-bottom: 24px; }
.nav-section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 0 12px; margin-bottom: 8px; }
.nav-menu { list-style: none; padding: 0; margin: 0; }
.nav-item { margin-bottom: 4px; }

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition);
    position: relative;
}

.nav-link:hover { color: var(--primary); background-color: var(--primary-50); }
.nav-link.active { color: var(--primary); background-color: var(--primary-100); font-weight: 500; }
.nav-link.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 24px; background: var(--primary); border-radius: 0 3px 3px 0; }
.nav-link i { font-size: 18px; width: 24px; text-align: center; }
.nav-link span { margin-left: 12px; white-space: nowrap; }
.sidebar-collapsed .nav-link span { opacity: 0; }
.nav-link .badge { margin-left: auto; background: var(--danger); color: white; font-size: 10px; padding: 2px 6px; border-radius: 10px; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border-light); }
.sidebar-user { display: flex; align-items: center; padding: 12px; background: var(--gray-50); border-radius: var(--border-radius-sm); }
.sidebar-user-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--primary-light), var(--primary)); display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; }
.sidebar-user-info { margin-left: 12px; }
.sidebar-collapsed .sidebar-user-info { opacity: 0; }
.sidebar-user-name { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }

/* Header */
.header {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 24px;
    transition: left var(--transition);
}

.sidebar-collapsed .header { left: var(--sidebar-collapsed-width); }
.header-left { display: flex; align-items: center; flex: 1; }

.sidebar-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    margin-right: 16px;
}

.sidebar-toggle:hover { background: var(--gray-100); color: var(--text-primary); }

.header-search { position: relative; max-width: 400px; width: 100%; }
.header-search input { width: 100%; height: 44px; padding: 0 16px 0 44px; background: var(--gray-50); border: 1px solid transparent; border-radius: var(--border-radius); font-size: 14px; }
.header-search input:focus { outline: none; background: white; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.header-search i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: white; border: 1px solid var(--border-color); border-radius: var(--border-radius); box-shadow: var(--shadow-lg); max-height: 400px; overflow-y: auto; z-index: 1100; display: none; margin-top: 4px; }
.search-results.show { display: block; }
.search-results-section { padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.search-results-section:last-child { border-bottom: none; }
.search-results-title { padding: 8px 16px; font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); background: var(--gray-50); }
.search-result-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; transition: background 0.15s; }
.search-result-item:hover { background: var(--primary-50); }
.search-result-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; position: relative; }
.search-result-icon i { position: static; transform: none; line-height: 1; }
.search-result-icon.patient { background: var(--primary-100); color: var(--primary); }
.search-result-icon.appointment { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.search-result-icon.consultation { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.search-result-info { flex: 1; min-width: 0; }
.search-result-name { font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-meta { font-size: 12px; color: var(--text-muted); }
.search-no-results { padding: 24px 16px; text-align: center; color: var(--text-muted); }
.search-loading { padding: 24px 16px; text-align: center; color: var(--text-muted); }

.header-right { display: flex; align-items: center; gap: 8px; position: relative; }
.header-right .dropdown { position: static; }
.header-right .dropdown-menu { 
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
}
.header-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: transparent; border: none; color: var(--text-secondary); cursor: pointer; border-radius: var(--border-radius-sm); position: relative; }
.header-btn:hover { background: var(--gray-100); color: var(--text-primary); }
.header-btn .badge { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; background: var(--danger); color: white; font-size: 10px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

.header-user { display: flex; align-items: center; padding: 6px 12px 6px 6px; background: var(--gray-50); border-radius: 50px; cursor: pointer; margin-left: 8px; }
.header-user:hover { background: var(--gray-100); }
.header-user-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary-light), var(--primary)); display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 14px; }
.header-user-name { margin-left: 10px; font-weight: 500; font-size: 13px; }
.header-user i { margin-left: 8px; font-size: 12px; color: var(--text-muted); }

/* Cards */
.card { background: var(--bg-card); border-radius: var(--border-radius); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); max-width: 100%; overflow: hidden; }
.card.overflow-visible, .card:has(.overflow-visible) { overflow: visible; }
.card:hover { box-shadow: var(--shadow-md); }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border-light); flex-wrap: wrap; gap: 12px; }
.card-title { font-size: 16px; font-weight: 600; margin: 0; }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border-light); background: var(--gray-50); border-radius: 0 0 var(--border-radius) var(--border-radius); }

/* Stat Cards */
.stat-card { background: var(--bg-card); border-radius: var(--border-radius); padding: 20px; display: flex; align-items: flex-start; gap: 16px; border: 1px solid var(--border-color); transition: all var(--transition); min-width: 0; height: 100%; min-height: 120px; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon { width: 48px; height: 48px; border-radius: var(--border-radius-sm); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-icon.primary { background: var(--primary-100); color: var(--primary); }
.stat-icon.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-icon.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.stat-icon.info { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.stat-content { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; word-break: break-word; }
.stat-change { display: inline-flex; align-items: center; font-size: 11px; font-weight: 500; margin-top: auto; padding: 3px 6px; border-radius: 20px; white-space: nowrap; }
.stat-change.positive { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-change.negative { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.stat-change.warning-change { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-change i { margin-right: 4px; font-size: 10px; }

/* Tables */
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -1px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border-light); }
.table th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); background: var(--gray-50); white-space: nowrap; }
.table tbody tr { transition: background-color 0.15s ease; }
.table tbody tr:hover { background-color: var(--gray-100) !important; }
.table tbody tr.context-enabled { cursor: pointer; }
.table tbody tr.context-enabled:hover { background-color: var(--primary-50) !important; }
.table tbody tr:last-child td { border-bottom: none; }

/* Responsive Table - Card Layout en móvil */
.table-responsive {
    width: 100%;
}

@media (max-width: 768px) {
    .table-responsive {
        overflow-x: visible;
    }
    
    .table-responsive .table {
        min-width: 0;
    }
    
    .table-responsive .table thead {
        display: none;
    }
    
    .table-responsive .table tbody tr {
        display: block;
        background: white;
        border: 1px solid var(--border-light);
        border-radius: var(--border-radius);
        margin-bottom: 12px;
        padding: 16px;
        box-shadow: var(--shadow-sm);
        transition: box-shadow 0.15s ease, border-color 0.15s ease;
    }
    
    .table-responsive .table tbody tr:hover {
        background: white !important;
        box-shadow: var(--shadow);
        border-color: var(--primary-200);
    }
    
    .table-responsive .table tbody tr.context-enabled:hover {
        background: var(--primary-50) !important;
        border-color: var(--primary);
    }
    
    .table-responsive .table tbody tr td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-light);
        text-align: right;
    }
    
    .table-responsive .table tbody tr td:last-child {
        border-bottom: none;
    }
    
    .table-responsive .table tbody tr td:before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 12px;
        color: var(--text-muted);
        text-transform: uppercase;
        text-align: left;
        flex-shrink: 0;
        margin-right: 16px;
    }
    
    /* Primera celda como header de la card */
    .table-responsive .table tbody tr td:first-child {
        display: block;
        text-align: left;
        padding-bottom: 12px;
        margin-bottom: 8px;
        border-bottom: 2px solid var(--primary-100);
    }
    
    .table-responsive .table tbody tr td:first-child:before {
        display: none;
    }
    
    /* Ocultar columnas marcadas como hide-mobile */
    .table-responsive .table tbody tr td.hide-mobile {
        display: none;
    }
    
    /* Ajustes para elementos dentro de celdas */
    .table-responsive .table tbody tr td .d-flex {
        justify-content: flex-start;
    }
    
    .table-responsive .table tbody tr td .badge {
        margin-left: auto;
    }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; font-size: 14px; font-weight: 500; border-radius: var(--border-radius-sm); border: none; cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; }
.btn-secondary { background: var(--gray-100); color: var(--text-primary); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { background: var(--gray-50); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-icon { width: 40px; height: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; height: 32px; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.form-control { width: 100%; height: 44px; padding: 0 16px; font-size: 14px; color: var(--text-primary); background: white; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); transition: all var(--transition); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.form-control.is-invalid { border-color: var(--danger); }
textarea.form-control { height: auto; min-height: 100px; padding: 12px 16px; resize: vertical; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2364748b'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 12px center; background-size: 20px; padding-right: 40px; cursor: pointer; }

/* =====================================================
   CUSTOM SELECT - Diseño mejorado para dropdowns
   ===================================================== */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 44px;
    padding: 0 16px;
    font-size: 14px;
    color: var(--text-primary);
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}

.custom-select-trigger:hover {
    border-color: var(--gray-300);
}

.custom-select-wrapper.open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.custom-select-trigger .selected-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    background: transparent !important;
}

.custom-select-trigger .selected-text.placeholder {
    color: #9ca3af !important;
    background: transparent !important;
    background-color: transparent !important;
}

.custom-select-trigger .arrow {
    width: 20px;
    height: 20px;
    margin-left: 8px;
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

.custom-select-wrapper.open .custom-select-trigger .arrow {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--border-radius-sm) var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
}

.custom-select-wrapper.open .custom-select-dropdown {
    display: block;
    animation: slideDown 0.15s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.custom-select-search {
    position: sticky;
    top: 0;
    padding: 8px;
    background: white;
    border-bottom: 1px solid var(--border-light);
}

.custom-select-search input {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    outline: none;
}

.custom-select-search input:focus {
    border-color: var(--primary);
}

.custom-select-option {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s ease;
}

.custom-select-option:hover {
    background: var(--primary-50);
}

.custom-select-option.selected {
    background: var(--primary-100);
    color: var(--primary);
    font-weight: 500;
}

.custom-select-option.disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.custom-select-option.disabled:hover {
    background: transparent;
}

.custom-select-option-icon {
    width: 20px;
    margin-right: 10px;
    text-align: center;
    color: var(--text-muted);
}

.custom-select-option.selected .custom-select-option-icon {
    color: var(--primary);
}

.custom-select-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.custom-select-group {
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--gray-50);
}

/* Dark theme para custom select */
[data-theme="dark"] .custom-select-trigger {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .custom-select-trigger:hover {
    border-color: var(--gray-500);
}

[data-theme="dark"] .custom-select-dropdown {
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .custom-select-search {
    background: var(--bg-card);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .custom-select-search input {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .custom-select-option {
    color: var(--text-primary);
}

[data-theme="dark"] .custom-select-option:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .custom-select-option.selected {
    background: rgba(56, 189, 248, 0.15);
    color: var(--primary);
}

[data-theme="dark"] .custom-select-group {
    background: var(--bg-input);
    color: var(--text-muted);
}

/* Input con icono */
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; z-index: 1; font-size: 14px; }
.input-icon input, .input-icon .form-control { padding-left: 42px; }
.form-text { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 6px; }
.form-check { display: flex; align-items: center; margin-bottom: 8px; }
.form-check-input { width: 18px; height: 18px; margin-right: 10px; accent-color: var(--primary); }

/* Input Group */
.input-group { display: flex; position: relative; }
.input-group .form-control { flex: 1; }
.input-group-text { display: flex; align-items: center; padding: 0 16px; background: var(--gray-50); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); color: var(--text-muted); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; font-size: 11px; font-weight: 600; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.02em; }
.badge-primary { background: var(--primary-100); color: var(--primary); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.badge-pink { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.badge-secondary { background: var(--gray-100); color: var(--text-secondary); }

/* Avatars */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary-light), var(--primary)); color: white; font-weight: 600; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 80px; height: 80px; font-size: 28px; }

/* Alerts */
.alert { padding: 16px 20px; border-radius: var(--border-radius-sm); display: flex; align-items: flex-start; gap: 12px; }
.alert i { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.alert-content { flex: 1; }
.alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.2); color: var(--success); }
.alert-danger { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2); color: var(--danger); }
.alert-warning { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.2); color: var(--warning); }
.alert-info { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.2); color: var(--info); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px); z-index: 1050; opacity: 0; visibility: hidden; transition: all var(--transition); }
.modal-backdrop.show { opacity: 1; visibility: visible; }
.modal {height: auto; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.95); background: white; border-radius: 16px; box-shadow: var(--shadow-lg); z-index: 1051; width: 90%; max-width: 500px; max-height: 90vh; overflow: hidden; opacity: 0; visibility: hidden; transition: all var(--transition); display: flex; flex-direction: column; }
.modal.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.modal-dialog { display: contents; }
.modal-content { display: flex; flex-direction: column; max-height: 90vh; overflow: hidden; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border-light); flex-shrink: 0; }
.modal-title { font-size: 18px; font-weight: 600; margin: 0; }
.modal-close, .btn-close { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: transparent; border: none; color: var(--text-muted); cursor: pointer; border-radius: var(--border-radius-sm); font-size: 20px; }
.modal-close:hover, .btn-close:hover { background: var(--gray-100); color: var(--text-primary); }
.btn-close::before { content: '×'; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--border-light); background: var(--gray-50); flex-shrink: 0; }
.modal-sm { max-width: 400px; }
.modal-md { max-width: 500px; }
.modal-lg { max-width: 700px; }
.modal-xl { max-width: 1200px; width: 95%; }

/* Dropdown - Compatible con Bootstrap */
.dropdown { position: relative; }
.dropdown-menu { 
    min-width: 200px; 
    background: white; 
    border: 1px solid var(--border-color); 
    border-radius: var(--border-radius); 
    box-shadow: var(--shadow-lg); 
    padding: 8px 0; 
    z-index: 1100; 
}
.dropdown-item { 
    display: flex; 
    align-items: center; 
    padding: 10px 16px; 
    color: var(--text-secondary); 
    transition: all 150ms ease; 
    cursor: pointer;
    text-decoration: none;
}
.dropdown-item:hover, 
.dropdown-item:focus { 
    background: var(--gray-50); 
    color: var(--primary); 
}
.dropdown-item:active {
    background: var(--gray-100);
}
.dropdown-item i { width: 20px; margin-right: 10px; font-size: 14px; }
.dropdown-item.text-danger { color: var(--danger); }
.dropdown-item.text-danger:hover { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.dropdown-divider { height: 0; margin: 8px 0; border-top: 1px solid var(--border-light); }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border-color); gap: 4px; flex-wrap: wrap; }
.tab { padding: 12px 20px; font-size: 14px; font-weight: 500; color: var(--text-secondary); background: transparent; border: none; cursor: pointer; position: relative; transition: color 150ms ease; white-space: nowrap; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); }
.tab.active::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--primary); border-radius: 2px 2px 0 0; }
.tab-content { padding: 24px 0; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.tab-pane.overflow-visible, 
.tab-pane.overflow-visible .card-body { overflow: visible !important; }

/* Progress */
.progress { height: 8px; background: var(--gray-100); border-radius: 10px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 10px; transition: width 300ms ease; }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-link { display: flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 12px; font-size: 13px; color: var(--text-secondary); background: white; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); transition: all 150ms ease; }
.page-link:hover { background: var(--gray-50); color: var(--primary); }
.page-link.active { background: var(--primary); border-color: var(--primary); color: white; }
.page-link.disabled { opacity: 0.5; pointer-events: none; }

/* Toast */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 12px; }
.toast { background: white; border-radius: var(--border-radius); box-shadow: var(--shadow-lg); padding: 16px 20px; display: flex; align-items: flex-start; gap: 12px; min-width: 320px; max-width: 400px; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
.toast-icon { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.toast-success .toast-icon { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.toast-danger .toast-icon { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.toast-warning .toast-icon { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.toast-info .toast-icon { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.toast-content { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.toast-message { font-size: 13px; color: var(--text-secondary); }
.toast-close { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; }

/* Utilities */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; } .mb-4 { margin-bottom: 24px; }
.my-4 { margin-top: 24px; margin-bottom: 24px; }
.py-4 { padding-top: 24px; padding-bottom: 24px; } .py-5 { padding-top: 48px; padding-bottom: 48px; }
.p-0 { padding: 0; } .p-3 { padding: 16px; } .p-4 { padding: 24px; }
.text-primary { color: var(--primary); } .text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); } .text-muted { color: var(--text-muted); }
.text-center { text-align: center; } .text-right { text-align: right; }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; } .font-medium { font-weight: 500; }
.d-none { display: none !important; } .d-block { display: block; } .d-flex { display: flex; } .d-inline-flex { display: inline-flex; }
.flex-column { flex-direction: column; } .flex-wrap { flex-wrap: wrap; }
.align-items-center { align-items: center; } .align-items-start { align-items: flex-start; } .align-items-end { align-items: flex-end; }
.justify-content-between { justify-content: space-between; } .justify-content-center { justify-content: center; } .justify-content-end { justify-content: flex-end; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 16px; } .gap-4 { gap: 24px; }
.w-100 { width: 100%; } .h-100 { height: 100%; }
.rounded { border-radius: var(--border-radius); } .rounded-full { border-radius: 50%; }
.shadow { box-shadow: var(--shadow); } .shadow-md { box-shadow: var(--shadow-md); }
.overflow-hidden { overflow: hidden; } .overflow-auto { overflow: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.required { color: var(--danger); }
.cursor-pointer { cursor: pointer; }
.border-0 { border: none; }

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

/* Bootstrap overrides para evitar overflow */
.row {
    margin-left: -12px;
    margin-right: -12px;
    max-width: 100%;
}

.row > * {
    padding-left: 12px;
    padding-right: 12px;
    max-width: 100%;
}

[class*="col-"] {
    min-width: 0;
}

/* Tablet - hasta 992px */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 0px;
    }
    
    .sidebar { 
        transform: translateX(-100%); 
        width: 280px;
        z-index: 1100;
    }
    .sidebar.show { 
        transform: translateX(0); 
    }
    
    .app-main { 
        margin-left: 0; 
    }
    
    .header { 
        left: 0; 
    }
    
    .mobile-overlay { 
        display: block; 
        position: fixed; 
        inset: 0; 
        background: rgba(0,0,0,0.5); 
        z-index: 1050; 
        opacity: 0; 
        visibility: hidden;
        transition: all 200ms ease;
    }
    .mobile-overlay.show { 
        opacity: 1; 
        visibility: visible; 
    }
    
    .sidebar-collapsed .app-main {
        margin-left: 0;
    }
    
    .sidebar-collapsed .header {
        left: 0;
    }
    
    /* Header adjustments */
    .header-search {
        max-width: 200px;
    }
    
    /* Cards grid */
    .row.g-4 {
        --bs-gutter-x: 1rem;
        --bs-gutter-y: 1rem;
    }
}

/* Mobile - hasta 768px */
@media (max-width: 768px) {
    .app-content { 
        padding: 16px; 
    }
    
    .header {
        padding: 0 16px;
    }
    
    .header-search { 
        display: none; 
    }
    
    .header-user-name {
        display: none;
    }
    
    /* Stat cards */
    .stat-card { 
        padding: 14px; 
        min-height: 100px;
    }
    .stat-value { 
        font-size: 20px; 
    }
    .stat-label {
        font-size: 11px;
    }
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    .stat-change {
        font-size: 10px;
        padding: 2px 5px;
    }
    
    /* Tables */
    .table-container {
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    .table th,
    .table td {
        padding: 12px 8px;
        font-size: 13px;
    }
    
    /* Cards */
    .card-header,
    .card-body,
    .card-footer {
        padding: 16px;
    }
    
    /* Modals */
    .modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-lg,
    .modal-xl {
        max-width: 95%;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }
    
    /* Forms */
    .row > [class*="col-md-"] {
        margin-bottom: 0;
    }
    
    /* Tabs */
    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .tabs::-webkit-scrollbar {
        display: none;
    }
    .tab {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    /* Toast */
    .toast-container {
        left: 16px;
        right: 16px;
        top: auto;
        bottom: 16px;
    }
    .toast {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
    
    /* Page header */
    .d-flex.justify-content-between.align-items-center.mb-4 {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 16px;
    }
    
    .d-flex.justify-content-between.align-items-center.mb-4 .btn {
        width: 100%;
    }
    
    /* Pagination */
    .card-footer .d-flex {
        flex-direction: column;
        gap: 12px;
    }
    
    .pagination {
        justify-content: center;
    }
    
    /* Dropdown en mobile - simplificado */
    .dropdown-menu {
        min-width: 180px;
    }
    
    .dropdown-item {
        padding: 12px 16px;
    }
    
    /* Row y columnas */
    .row {
        margin-left: -8px;
        margin-right: -8px;
    }
    
    .row > [class*="col"] {
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* Mobile pequeño - hasta 480px */
@media (max-width: 480px) {
    .app-content {
        padding: 12px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .avatar {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .btn-icon {
        width: 36px;
        height: 36px;
    }
    
    h1.h4, .h4 {
        font-size: 18px;
    }
}

/* Utility classes responsive */
@media (max-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
    .d-md-inline { display: inline !important; }
}

@media (min-width: 769px) {
    .d-md-none { display: block; }
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 8px 0;
    min-width: 200px;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.95);
    transform-origin: top left;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.context-menu.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: scale(1);
}

.context-menu-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 14px;
}

.context-menu-item:hover {
    background: var(--gray-50);
    color: var(--primary);
}

.context-menu-item i {
    width: 20px;
    margin-right: 12px;
    font-size: 14px;
    text-align: center;
}

.context-menu-item.text-danger {
    color: var(--danger);
}

.context-menu-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.context-menu-item.text-success {
    color: var(--success);
}

.context-menu-item.text-success:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.context-menu-divider {
    height: 1px;
    background: var(--border-light);
    margin: 8px 0;
}

.context-menu-header {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Table row context menu enabled */
.table tbody tr.context-enabled {
    cursor: context-menu;
    transition: background-color 0.15s ease;
}

.table tbody tr.context-enabled:hover {
    background: var(--gray-50);
}

.table tbody tr.context-active {
    background: var(--primary-100) !important;
}

/* SPA Loader - Barra de progreso superior */
#spaLoader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

#spaLoader.active {
    opacity: 1;
}

.spa-loader-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light), var(--primary));
    background-size: 200% 100%;
    animation: spaLoaderAnimation 1s linear infinite;
    box-shadow: 0 0 10px var(--primary), 0 0 5px var(--primary);
}

@keyframes spaLoaderAnimation {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Transición suave del contenido SPA */
.app-content {
    transition: opacity 0.15s ease-out;
}

.app-content.spa-loading {
    opacity: 0.5;
    pointer-events: none;
}

.app-content.spa-loaded {
    animation: spaFadeIn 0.25s ease-out;
}

@keyframes spaFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Print styles */
@media print {
    .sidebar,
    .header,
    .mobile-overlay,
    .toast-container,
    .modal-backdrop,
    .btn,
    .dropdown-menu,
    #spaLoader {
        display: none !important;
    }
    
    .app-main {
        margin-left: 0 !important;
    }
    
    .app-content {
        padding: 0 !important;
        margin-top: 0 !important;
        animation: none !important;
    }
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: var(--theme-toggle-bg);
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition);
}

.theme-toggle-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}

.theme-toggle-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.theme-toggle-btn:hover:not(.active) {
    color: var(--text-primary);
}

/* Sidebar theme toggle */
.sidebar-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
}

.sidebar-theme-toggle .theme-toggle {
    width: 100%;
    justify-content: center;
}

/* Header theme toggle (icon only) */
.header-theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}

.header-theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

/* Smooth transition for theme change */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease !important;
}

/* Animaciones para notificaciones */
@keyframes slideInRight { 
    from { opacity: 0; transform: translateX(100%); } 
    to { opacity: 1; transform: translateX(0); } 
}

@keyframes slideOutRight { 
    from { opacity: 1; transform: translateX(0); } 
    to { opacity: 0; transform: translateX(100%); } 
}

/* Toast de notificación mejorado */
.notification-toast {
    border-left: 4px solid var(--primary);
}

.notification-toast.toast-success {
    border-left-color: var(--success);
}

.notification-toast.toast-warning {
    border-left-color: var(--warning);
}

.notification-toast.toast-danger {
    border-left-color: var(--danger);
}

.notification-toast .toast-title {
    color: var(--text-primary);
}

.notification-toast .toast-message {
    color: var(--text-secondary);
    line-height: 1.4;
}


/* ===========================================
   PANEL DE NOTIFICACIONES
   =========================================== */
.header-notifications {
    position: relative;
}

.header-notification-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all var(--transition);
}

.header-notification-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notifications-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.notifications-panel.show {
    display: block;
    animation: slideDown 0.2s ease;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}

.notifications-header h6 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.notifications-header .btn-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}

.notifications-header .btn-link:hover {
    text-decoration: underline;
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notifications-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.notifications-empty i {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.notifications-empty p {
    margin: 0;
    font-size: 14px;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.15s;
}

.notification-item:hover {
    background: var(--bg-hover);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background: rgba(14, 165, 233, 0.05);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.notification-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.notification-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.notification-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.notification-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notification-message {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

@media (max-width: 480px) {
    .notifications-panel {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        width: auto;
        max-height: calc(100vh - 80px);
    }
    
    .announcements-panel {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        width: auto;
        max-height: calc(100vh - 80px);
    }
}
 
/* ===== SISTEMA DE ANUNCIOS ===== */
.announcements-trigger {
    position: relative;
    cursor: pointer;
}
 
.announcements-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 9px;
    padding: 0 5px;
    border: 2px solid var(--bg-sidebar);
}
 
.announcements-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 380px;
    max-height: 480px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 1000;
    display: none;
    overflow: hidden;
}
 
/* Header announcements container */
.header-announcements {
    position: relative;
}
 
.header-announcements .announcements-trigger {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}
 
.header-announcements .announcements-trigger:hover {
    background: var(--primary-50);
    color: var(--primary);
}
 
.announcements-panel.show {
    display: block;
}
 
.announcements-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}
 
.announcements-panel-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}
 
.announcements-panel-header button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
}
 
.announcements-list {
    max-height: 400px;
    overflow-y: auto;
}
 
.announcement-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background var(--transition);
}
 
.announcement-item:hover {
    background: var(--bg-hover);
}
 
.announcement-item.unread {
    background: var(--primary-50);
}
 
.announcement-item.unread:hover {
    background: var(--primary-100);
}
 
.announcement-item-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}
 
.announcement-item-icon.info {
    background: #e0f2fe;
    color: #0369a1;
}
 
.announcement-item-icon.feature {
    background: #fef3c7;
    color: #b45309;
}
 
.announcement-item-icon.important {
    background: #fee2e2;
    color: #b91c1c;
}
 
.announcement-item-content {
    flex: 1;
    min-width: 0;
}
 
.announcement-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}
 
.announcement-item-summary {
    font-size: 13px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
 
.announcement-item-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}
 
.announcements-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}
 
.announcements-empty i {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}
 
/* Modal de anuncio detallado */
#announcementDetailModal .announcement-detail-image {
    margin: -20px -24px 20px -24px;
    max-height: 200px;
    overflow: hidden;
}
 
#announcementDetailModal .announcement-detail-image img {
    width: 100%;
    object-fit: cover;
}
 
#announcementDetailModal .announcement-detail-content {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}
 
#announcementDetailModal .announcement-detail-content h4 {
    font-size: 15px;
    color: var(--text-primary);
    margin: 20px 0 10px 0;
}
 
#announcementDetailModal .announcement-detail-content ul {
    margin: 12px 0;
    padding-left: 20px;
}
 
#announcementDetailModal .announcement-detail-content li {
    margin-bottom: 8px;
}