/* Sistema de Design Tokens */
:root {
    --primary-color: #0066cc;
    --secondary-color: #333333;
    --accent-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --info-color: #17a2b8;
    --success-color: #28a745;
    
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.1);
    --shadow-xl: 0 12px 24px rgba(0,0,0,0.15);
    
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    --font-size-3xl: 2.5rem;
    
    --sidebar-width: 260px;
    --header-height: 70px;
    --transition-base: 0.3s ease;
    --transition-fast: 0.15s ease;
}

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--light-color);
    color: var(--secondary-color);
    line-height: 1.6;
}

/* Layout Components */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Modern Layout Structure */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: 0;
    transition: margin-left var(--transition-base);
    background-color: var(--light-color);
}

.main-content.with-sidebar {
    margin-left: var(--sidebar-width);
}

/* Top Header */
.top-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    color: white;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: background-color var(--transition-fast);
}

.mobile-menu-toggle:hover {
    background-color: rgba(255,255,255,0.1);
}

.header-brand {
    font-size: var(--font-size-xl);
    font-weight: 700;
    text-decoration: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    white-space: nowrap;
}

.header-brand img {
    height: 40px;
    width: auto;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 2rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255,255,255,0.9);
    font-size: var(--font-size-sm);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.breadcrumb-item:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

.breadcrumb-item.active {
    color: white;
    font-weight: 600;
    cursor: default;
}

.breadcrumb-item.active:hover {
    background-color: transparent;
}

.breadcrumb-icon {
    width: 14px;
    height: 14px;
}

.breadcrumb-separator {
    color: rgba(255,255,255,0.5);
    font-weight: 300;
}

/* User Profile Menu */
.user-profile-menu {
    position: relative;
}

.user-profile-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--border-radius-lg);
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: white;
    transition: all var(--transition-fast);
}

.user-profile-trigger:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.user-avatar .nav-icon {
    width: 20px;
    height: 20px;
    color: white;
}

.avatar-initials {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: white;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
    line-height: 1.2;
}

.user-role {
    font-size: var(--font-size-xs);
    opacity: 0.8;
    line-height: 1;
}

.dropdown-arrow {
    margin-left: 0.5rem;
    transition: transform var(--transition-fast);
}

.user-profile-trigger:hover .dropdown-arrow {
    transform: translateY(2px);
}

/* User Dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    min-width: 280px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    z-index: 1001;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
}

.dropdown-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dropdown-user-avatar .nav-icon {
    width: 24px;
    height: 24px;
    color: white;
}

.dropdown-user-info {
    flex: 1;
    min-width: 0;
}

.dropdown-user-name {
    font-weight: 600;
    font-size: var(--font-size-base);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-user-email {
    font-size: var(--font-size-xs);
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0.5rem 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--secondary-color);
    text-decoration: none;
    transition: all var(--transition-fast);
    font-size: var(--font-size-sm);
}

.dropdown-item:hover {
    background: var(--light-color);
    color: var(--primary-color);
}

.dropdown-item-danger {
    color: var(--danger-color);
}

.dropdown-item-danger:hover {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.dropdown-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1a1f36 0%, #0f172a 100%);
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 20px rgba(0,0,0,0.1);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

.sidebar.open {
    transform: translateX(0);
    box-shadow: 2px 0 30px rgba(0,0,0,0.2);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255,255,255,0.05);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.sidebar-brand {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: opacity var(--transition-fast);
}

.sidebar-brand:hover {
    opacity: 0.8;
}

.sidebar-brand img {
    height: 32px;
    width: auto;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    color: rgba(255,255,255,0.5);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0 1.5rem;
    margin-bottom: 0.75rem;
    margin-top: 1rem;
}

.nav-item {
    position: relative;
    margin: 3px 12px;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.875rem 1rem;
    border-radius: var(--border-radius);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.15), transparent);
    transition: width 0.3s ease;
}

.nav-link:hover::before {
    width: 100%;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.nav-link:active {
    transform: translateX(2px);
}

.nav-item.active .nav-link {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.1));
    color: white;
    font-weight: 600;
}

.nav-item.active .nav-link:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.25), rgba(118, 75, 162, 0.15));
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.nav-link:hover .nav-icon {
    transform: scale(1.1);
}

.nav-text {
    font-size: var(--font-size-sm);
}

/* Legacy navbar for compatibility */
.navbar {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow-md);
}

.navbar-brand {
    font-size: var(--font-size-xl);
    font-weight: bold;
    text-decoration: none;
    color: white;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin-left: auto;
}

/* Cards */
.card {
    background: linear-gradient(135deg, white 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(0, 102, 204, 0.2);
}

.card-header {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    position: relative;
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

.card-elevated {
    box-shadow: var(--shadow-lg);
    border: none;
}

.card-accent::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-size: var(--font-size-base);
    font-weight: 500;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    line-height: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 102, 204, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #1e7e34 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #1e7e34 0%, #155724 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #c82333 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #a02622 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(220, 53, 69, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: var(--font-size-lg);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.5rem;
}

.col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

.col-1, .col-2, .col-3, .col-4, .col-6, .col-8, .col-12 {
    padding: 0 0.5rem;
}

/* Badges and Labels */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-primary {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
}

.badge-success {
    background: linear-gradient(135deg, var(--success-color), #1e7e34);
    color: white;
}

.badge-warning {
    background: linear-gradient(135deg, var(--warning-color), #e0a800);
    color: var(--dark-color);
}

.badge-danger {
    background: linear-gradient(135deg, var(--danger-color), #c82333);
    color: white;
}

.badge-info {
    background: linear-gradient(135deg, var(--info-color), #117a8b);
    color: white;
}

.badge-light {
    background: var(--light-color);
    color: var(--dark-color);
    border: 1px solid #dee2e6;
}

.badge-dark {
    background: var(--dark-color);
    color: white;
}

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.status-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-active::before {
    background: var(--success-color);
    box-shadow: 0 0 6px var(--success-color);
    animation: pulse 2s infinite;
}

.status-inactive::before {
    background: #6c757d;
}

.status-pending::before {
    background: var(--warning-color);
    box-shadow: 0 0 6px var(--warning-color);
}

.status-error::before {
    background: var(--danger-color);
}

/* Modals - v3.0 - Corregido para todas las estructuras */
/* Sistema de Modales Estandarizado - ÚLTIMA ACTUALIZACIÓN */
.modal {
    display: none; /* Oculto por defecto */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    padding: 1rem;
    overflow-y: auto;
}

/* Cuando el modal está visible (por clase .show o display inline) */
.modal.show,
.modal[style*="display: block"],
.modal[style*="display: flex"] {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Alias para compatibilidad con código existente */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    padding: 1rem;
    overflow-y: auto;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
    margin: auto; /* Centrado adicional */
}

/* Asegurar que modal-content es visible */
.modal .modal-content {
    display: block;
    visibility: visible;
}

/* Animación para modales */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Soporte para hijo directo de modal-overlay (compatibilidad) */
/* CRÍTICO: Resetear completamente el .modal cuando está dentro de modal-overlay */
.modal-overlay > .modal {
    /* Resetear TODO el posicionamiento y background del .modal padre */
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;

    /* ELIMINAR el background oscuro (el modal-overlay ya lo tiene) */
    background: white !important;
    backdrop-filter: none !important;

    /* Dimensiones y apariencia */
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    padding: 0 !important;
    overflow-y: auto;
    overflow-x: hidden;

    /* Estilo del contenedor blanco */
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);

    /* Animación y centrado */
    animation: modalFadeIn 0.3s ease-out;
    margin: auto;
    display: block !important;
    z-index: auto !important;
}

/* Respetar max-width inline */
.modal-overlay > .modal[style*="max-width"] {
    width: 100%;
}

/* Otros divs directos de modal-overlay */
.modal-overlay > div:not(.modal):not(.modal-content) {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
    margin: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    transition: background var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 1.5rem;
    max-height: calc(90vh - 200px);
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    background: var(--light-color);
}

/* Alert Messages */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border-left: 4px solid;
    animation: slideInLeft 0.3s ease-out;
}

.alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-message {
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    border-left-color: var(--success-color);
    color: #155724;
}

.alert-error {
    background: rgba(220, 53, 69, 0.1);
    border-left-color: var(--danger-color);
    color: #721c24;
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    border-left-color: var(--warning-color);
    color: #856404;
}

.alert-info {
    background: rgba(23, 162, 184, 0.1);
    border-left-color: var(--info-color);
    color: #0c5460;
}

/* Progress Bars */
.progress {
    height: 8px;
    background: #e9ecef;
    border-radius: 100px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #0056b3);
    border-radius: 100px;
    transition: width 0.6s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
    background-size: 200% 100%;
}

/* Dividers */
.divider {
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        #dee2e6,
        transparent
    );
    margin: 1.5rem 0;
}

.divider-text {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: #6c757d;
    font-size: var(--font-size-sm);
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #dee2e6;
}

.divider-text::before {
    margin-right: 1rem;
}

.divider-text::after {
    margin-left: 1rem;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.flex-1 { flex: 1; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* Authentication */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, #004499 100%);
}

.auth-card {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo img {
    max-height: 80px;
    width: auto;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, white 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
    cursor: pointer;
    text-align: center;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.stat-card.stat-primary::before {
    background: linear-gradient(90deg, var(--primary-color), #0056b3);
}

.stat-card.stat-success::before {
    background: linear-gradient(90deg, var(--success-color), #1e7e34);
}

.stat-card.stat-warning::before {
    background: linear-gradient(90deg, var(--warning-color), #e0a800);
}

.stat-card.stat-danger::before {
    background: linear-gradient(90deg, var(--danger-color), #c82333);
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stat-number {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--secondary-color);
    font-weight: 500;
    font-size: var(--font-size-base);
}

.stat-change {
    font-size: var(--font-size-sm);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--danger-color);
}

/* QR Scanner */
.qr-scanner-container {
    max-width: 600px;
    margin: 2rem auto;
    text-align: center;
}

#qr-video {
    width: 100%;
    max-width: 400px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.table th {
    background-color: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
}

.table tr:hover {
    background-color: rgba(0,0,0,0.02);
}

/* Skeleton Loading States */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--border-radius);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-card {
    height: 120px;
    width: 100%;
}

/* Micro-interactions and Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.slide-in-left {
    animation: slideInLeft 0.4s ease-out;
}

@keyframes slideInLeft {
    from { transform: translateX(-30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.slide-in-right {
    animation: slideInRight 0.4s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.bounce-in {
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.scale-in {
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Page transition */
.content-wrapper {
    animation: contentFadeIn 0.4s ease-out;
}

@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse animation for notifications */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Shimmer effect */
.shimmer {
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer 2s infinite;
    background-size: 200% 100%;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Interactive Elements */
.clickable {
    cursor: pointer;
    transition: all var(--transition-fast);
}

.clickable:hover {
    transform: scale(1.02);
}

.clickable:active {
    transform: scale(0.98);
}

/* Enhanced Form Styles */
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
    transform: translateY(-1px);
}

.form-control.error {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.form-control.success {
    border-color: var(--success-color);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .main-content.with-sidebar {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: block;
    }

    /* Mobile Header Adjustments */
    .top-header {
        padding: 0 1rem;
        height: 60px;
    }

    .header-brand .brand-text {
        font-size: var(--font-size-base);
    }

    .header-center {
        display: none;
    }

    .user-info {
        display: none;
    }

    .user-profile-trigger {
        padding: 0.5rem;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
    }

    .dropdown-arrow {
        display: none;
    }

    .user-dropdown {
        right: -1rem;
        min-width: 260px;
    }

    .dashboard-grid,
    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 0.5rem;
    }

    .navbar-nav {
        flex-direction: column;
        gap: 0.5rem;
        margin-left: 0;
        margin-top: 1rem;
    }

    .col-1, .col-2, .col-3, .col-4, .col-6, .col-8, .col-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .auth-card {
        margin: 1rem;
        padding: 1.5rem;
    }

    .toast-container {
        left: 10px;
        right: 10px;
        top: 10px;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-number {
        font-size: var(--font-size-2xl);
    }
}

@media (max-width: 480px) {
    .top-header {
        padding: 0 0.75rem;
    }

    .header-brand {
        font-size: var(--font-size-base);
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }

    .user-profile-trigger {
        padding: 0.375rem;
    }
}

@media (min-width: 769px) {
    .sidebar {
        transform: translateX(0);
    }
    
    .main-content.with-sidebar {
        margin-left: var(--sidebar-width);
    }
    
    .mobile-menu-toggle {
        display: none;
    }
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #1a1a1a;
        --dark-color: #ffffff;
        --secondary-color: #e5e5e5;
    }
    
    body {
        background-color: var(--light-color);
        color: var(--dark-color);
    }
    
    .card {
        background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
        border-color: #404040;
    }
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Advanced Notification System */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 1rem 1.25rem;
    min-width: 350px;
    transform: translateX(400px);
    animation: slideIn 0.3s ease forwards;
    position: relative;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    backdrop-filter: blur(10px);
}

@keyframes slideIn {
    to { transform: translateX(0); }
}

@keyframes slideOut {
    to { transform: translateX(400px); }
}

.toast.hiding {
    animation: slideOut 0.3s ease forwards;
}

.toast-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.toast-title {
    font-weight: 600;
    font-size: var(--font-size-base);
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #6b7280;
    transition: color var(--transition-fast);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    color: var(--dark-color);
}

.toast-body {
    font-size: var(--font-size-sm);
    color: var(--secondary-color);
    line-height: 1.4;
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-success .toast-icon {
    background: var(--success-color);
    color: white;
}

.toast-success .toast-title {
    color: var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--danger-color);
}

.toast-error .toast-icon {
    background: var(--danger-color);
    color: white;
}

.toast-error .toast-title {
    color: var(--danger-color);
}

.toast-warning {
    border-left: 4px solid var(--warning-color);
}

.toast-warning .toast-icon {
    background: var(--warning-color);
    color: white;
}

.toast-warning .toast-title {
    color: var(--warning-color);
}

.toast-info {
    border-left: 4px solid var(--info-color);
}

.toast-info .toast-icon {
    background: var(--info-color);
    color: white;
}

.toast-info .toast-title {
    color: var(--info-color);
}
