/**
 * Archidoc - Componentes CSS Reutilizables
 * Sistema de diseño unificado para todas las vistas
 */

/* ==========================================================================
   Variables CSS
   ========================================================================== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #3b82f6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);

    --border-radius-sm: 6px;
    --border-radius-md: 10px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* ==========================================================================
   Cards Mejoradas
   ========================================================================== */
.archidoc-card {
    border: none;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    overflow: hidden;
}

.archidoc-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.archidoc-card .card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.archidoc-card .card-header.bg-gradient-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.archidoc-card .card-header.bg-gradient-info {
    background: linear-gradient(135deg, #17a2b8 0%, #117a8b 100%);
}

.archidoc-card .card-header.bg-gradient-warning {
    background: linear-gradient(135deg, #ffc107 0%, #d39e00 100%);
    color: #212529;
}

.archidoc-card .card-header.bg-gradient-danger {
    background: linear-gradient(135deg, #dc3545 0%, #bd2130 100%);
}

/* ==========================================================================
   Estadisticas Cards
   ========================================================================== */
.stat-card {
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    text-align: center;
    transition: transform var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.stat-card .stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

/* ==========================================================================
   Tablas Mejoradas
   ========================================================================== */
.archidoc-table {
    margin-bottom: 0;
}

.archidoc-table thead th {
    background: #f8f9fa;
    border-top: none;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    padding: 0.875rem 1rem;
}

.archidoc-table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
}

.archidoc-table tbody tr {
    transition: background var(--transition-fast);
}

.archidoc-table tbody tr:hover {
    background-color: #f8f9ff;
}

/* ==========================================================================
   Badges y Status
   ========================================================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--border-radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.pending { background: #fff3cd; color: #856404; }
.status-badge.processing { background: #cce5ff; color: #004085; }
.status-badge.approved { background: #d1ecf1; color: #0c5460; }
.status-badge.completed { background: #d4edda; color: #155724; }
.status-badge.rejected { background: #f8d7da; color: #721c24; }
.status-badge.cancelled { background: #e2e3e5; color: #383d41; }
.status-badge.failed { background: #f8d7da; color: #721c24; }

/* ==========================================================================
   Botones Mejorados
   ========================================================================== */
.btn-archidoc {
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: all var(--transition-fast);
    border: none;
}

.btn-archidoc:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-archidoc-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-archidoc-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #003d7a 100%);
    color: white;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* ==========================================================================
   Formularios Mejorados
   ========================================================================== */
.form-control-archidoc {
    border-radius: var(--border-radius-sm);
    border: 2px solid #e9ecef;
    padding: 0.6rem 1rem;
    transition: all var(--transition-fast);
}

.form-control-archidoc:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.form-label-archidoc {
    font-weight: 600;
    font-size: 0.85rem;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   Empty States
   ========================================================================== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state .empty-icon {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

.empty-state .empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.empty-state .empty-text {
    color: #6c757d;
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   Timeline
   ========================================================================== */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.65rem;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.timeline-item.completed::before { background: var(--success-color); box-shadow-color: var(--success-color); }
.timeline-item.pending::before { background: var(--warning-color); box-shadow-color: var(--warning-color); }
.timeline-item.failed::before { background: var(--danger-color); box-shadow-color: var(--danger-color); }

/* ==========================================================================
   Notificaciones
   ========================================================================== */
.notification-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #f1f3f5;
    transition: background var(--transition-fast);
}

.notification-item:hover {
    background: #f8f9ff;
}

.notification-item.unread {
    background: #fff8e6;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.info { background: #e7f3ff; color: var(--info-color); }
.notification-icon.success { background: #e6f7e6; color: var(--success-color); }
.notification-icon.warning { background: #fff8e6; color: var(--warning-color); }
.notification-icon.danger { background: #ffe6e6; color: var(--danger-color); }
.notification-icon.pending { background: #fff8e6; color: #856404; }
.notification-icon.processing { background: #cce5ff; color: #004085; }
.notification-icon.approved { background: #d1ecf1; color: #0c5460; }
.notification-icon.completed { background: #d4edda; color: #155724; }
.notification-icon.rejected { background: #f8d7da; color: #721c24; }
.notification-icon.cancelled { background: #e2e3e5; color: #383d41; }

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.25rem;
}

.notification-meta {
    font-size: 0.8rem;
    color: #6c757d;
}

.notification-item.read {
    opacity: 0.6;
}

.notification-item:last-child {
    border-bottom: none;
}

/* ==========================================================================
   Charts Container
   ========================================================================== */
.chart-container {
    position: relative;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius-md);
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ==========================================================================
   Filtros Panel
   ========================================================================== */
.filters-panel {
    background: #f8f9fa;
    border-radius: var(--border-radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.filters-panel .form-group {
    margin-bottom: 0;
}

.filters-panel label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d;
}

/* ==========================================================================
   Page Header
   ========================================================================== */
.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: #6c757d;
    font-size: 0.9rem;
}

.breadcrumb-archidoc {
    background: transparent;
    padding: 0;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.breadcrumb-archidoc .breadcrumb-item + .breadcrumb-item::before {
    content: '\f105';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
}

/* ==========================================================================
   Animaciones
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .stat-card {
        margin-bottom: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.75rem;
    }

    .page-title {
        font-size: 1.25rem;
    }
}

/* ==========================================================================
   Quick Action Cards
   ========================================================================== */
.quick-action-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius-md);
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-normal);
}

.quick-action-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.quick-action-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.quick-action-content {
    flex: 1;
}

.quick-action-content h6 {
    margin: 0 0 0.25rem 0;
    font-weight: 600;
}

.quick-action-content small {
    color: #6c757d;
}

.quick-action-arrow {
    color: #adb5bd;
    transition: transform var(--transition-fast);
}

.quick-action-card:hover .quick-action-arrow {
    transform: translateX(3px);
    color: var(--primary-color);
}

/* ==========================================================================
   User Info Items
   ========================================================================== */
.user-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f3f5;
}

.user-info-item:last-of-type {
    border-bottom: none;
}

.user-info-label {
    color: #6c757d;
    font-size: 0.85rem;
}

.user-info-value {
    font-weight: 500;
    color: #212529;
}

/* ==========================================================================
   Loading Spinner
   ========================================================================== */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Text Decoration Helper
   ========================================================================== */
.text-decoration-none {
    text-decoration: none !important;
}

.text-decoration-none:hover {
    text-decoration: none !important;
}

/* ==========================================================================
   Card Header Styles for Non-gradient
   ========================================================================== */
.archidoc-card .card-header:not([class*="bg-gradient"]) {
    background: white;
    color: #212529;
    border-bottom: 1px solid #e9ecef;
}

/* ==========================================================================
   Alert Improvements
   ========================================================================== */
.alert {
    border: none;
    border-radius: var(--border-radius-sm);
}

.alert-info {
    background: #e7f3ff;
    color: #004085;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
}

/* ==========================================================================
   Sidebar Navigation - Menú Lateral Modernizado
   ========================================================================== */
.sidebar-nav {
    background: linear-gradient(180deg, #1e2a38 0%, #2c3e50 100%);
    height: 100%;
}

.sidebar-nav .nav-list {
    padding: 0;
    margin: 0;
    list-style: none;
}

.sidebar-nav .nav-list > li > a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: #b8c7ce;
    text-decoration: none;
    transition: all var(--transition-normal);
    border-left: 3px solid transparent;
    gap: 12px;
}

.sidebar-nav .nav-list > li > a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-left-color: rgba(255, 255, 255, 0.3);
}

.sidebar-nav .nav-list > li.active > a {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.15) 0%, transparent 100%);
    color: #fff;
    border-left-color: var(--primary-color);
}

.sidebar-nav .nav-list > li.active > a::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--primary-color);
    border-radius: 4px 0 0 4px;
}

.sidebar-nav .nav-list > li > a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    opacity: 0.8;
}

.sidebar-nav .nav-list > li.active > a i {
    opacity: 1;
    color: var(--primary-color);
}

/* Treeview menus */
.sidebar-nav .treeview > a {
    position: relative;
}

.sidebar-nav .treeview > a .nav-arrow {
    margin-left: auto;
    transition: transform var(--transition-normal);
}

.sidebar-nav .treeview.menu-open > a .nav-arrow {
    transform: rotate(-90deg);
}

.sidebar-nav .treeview-menu {
    background: rgba(0, 0, 0, 0.15);
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    margin-left: 20px;
}

.sidebar-nav .treeview-menu > li > a {
    display: flex;
    align-items: center;
    padding: 10px 15px 10px 20px;
    color: #8aa4af;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    gap: 10px;
}

.sidebar-nav .treeview-menu > li > a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-nav .treeview-menu > li > a i {
    width: 16px;
    text-align: center;
    font-size: 0.8rem;
}

.sidebar-nav .treeview-menu .nav-header {
    padding: 10px 15px 5px 20px;
    font-size: 0.7rem;
    color: #5a7a8a;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.sidebar-nav .treeview-menu .divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 8px 15px;
}

/* Sidebar section headers */
.sidebar-nav .nav-section-header {
    padding: 20px 20px 10px;
    font-size: 0.7rem;
    color: #5a7a8a;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
}

/* ==========================================================================
   Login Page Styles
   ========================================================================== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    animation: fadeIn 0.4s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header .login-logo {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #6c757d;
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form .input-icon-wrapper {
    position: relative;
}

.login-form .input-icon-wrapper i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
    transition: color var(--transition-fast);
}

.login-form .input-icon-wrapper input:focus + i,
.login-form .input-icon-wrapper input:focus ~ i {
    color: var(--primary-color);
}

.login-form .form-control-login {
    padding: 14px 15px 14px 45px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.login-form .form-control-login:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.login-form .form-control-login.is-invalid {
    border-color: var(--danger-color);
}

.btn-login {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
    transition: all var(--transition-normal);
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.35);
    color: white;
}

.btn-login:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.login-footer p {
    color: #6c757d;
    font-size: 0.85rem;
    margin: 0;
}

/* ==========================================================================
   Error Pages (403, 404, 500)
   ========================================================================== */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    padding: 20px;
}

.error-container {
    text-align: center;
    max-width: 500px;
}

.error-code {
    font-size: 8rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 1rem;
    text-shadow: 4px 4px 0 rgba(37, 99, 235, 0.1);
}

.error-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 1rem;
}

.error-description {
    color: #6c757d;
    font-size: 1rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.error-icon {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 1.5rem;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==========================================================================
   Tooltips Mejorados
   ========================================================================== */
.tooltip-archidoc {
    position: relative;
    cursor: pointer;
}

.tooltip-archidoc::before,
.tooltip-archidoc::after {
    position: absolute;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 1000;
}

.tooltip-archidoc::before {
    content: attr(data-tooltip);
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    padding: 8px 12px;
    background: #212529;
    color: white;
    font-size: 0.8rem;
    border-radius: var(--border-radius-sm);
    white-space: nowrap;
    max-width: 250px;
}

.tooltip-archidoc::after {
    content: '';
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    border: 6px solid transparent;
    border-top-color: #212529;
}

.tooltip-archidoc:hover::before,
.tooltip-archidoc:hover::after {
    opacity: 1;
    visibility: visible;
}

.tooltip-archidoc:hover::before {
    transform: translateX(-50%) translateY(-5px);
}

.tooltip-archidoc:hover::after {
    transform: translateX(-50%);
}

/* Botones deshabilitados con tooltip */
.btn-disabled-tooltip {
    position: relative;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.btn-disabled-tooltip:hover::before {
    content: attr(data-disabled-reason);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: #6c757d;
    color: white;
    font-size: 0.75rem;
    border-radius: var(--border-radius-sm);
    white-space: nowrap;
    margin-bottom: 5px;
    z-index: 1000;
}

/* ==========================================================================
   Flash Messages Estandarizados
   ========================================================================== */
.flash-message {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideInDown 0.3s ease;
}

.flash-message i {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.flash-message-content {
    flex: 1;
}

.flash-message-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.flash-message-text {
    font-size: 0.9rem;
    opacity: 0.9;
}

.flash-message.success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid var(--success-color);
}

.flash-message.error,
.flash-message.danger {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--danger-color);
}

.flash-message.warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid var(--warning-color);
}

.flash-message.info {
    background: #cce5ff;
    color: #004085;
    border-left: 4px solid var(--info-color);
}

.flash-message .close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
    padding: 0;
    line-height: 1;
}

.flash-message .close-btn:hover {
    opacity: 1;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Toast Mejorados
   ========================================================================== */
.archidoc-toast {
    border-radius: var(--border-radius-sm) !important;
    box-shadow: var(--shadow-md) !important;
}

.archidoc-toast.swal2-icon-success {
    border-left: 4px solid var(--success-color) !important;
}

.archidoc-toast.swal2-icon-error {
    border-left: 4px solid var(--danger-color) !important;
}

.archidoc-toast.swal2-icon-warning {
    border-left: 4px solid var(--warning-color) !important;
}

.archidoc-toast.swal2-icon-info {
    border-left: 4px solid var(--info-color) !important;
}

/* ==========================================================================
   Permission-based UI States
   ========================================================================== */
.no-permission {
    display: none !important;
}

.permission-denied-overlay {
    position: relative;
}

.permission-denied-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 1;
    border-radius: inherit;
}

.permission-denied-overlay::after {
    content: 'Sin permiso';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #6c757d;
    color: white;
    padding: 4px 10px;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    z-index: 2;
}

/* ==========================================================================
   Fixed Action Buttons
   ========================================================================== */
.btn-fixed {
    position: fixed;
    bottom: 20px;
    z-index: 100;
}

.btn-fixed-right {
    right: 20px;
}

.btn-fixed-left {
    left: calc(200px + 40px);
}

.btn-fixed-action {
    width: 150px;
    height: 60px;
    font-size: 15px;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-md);
}

#btn-enviar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 150px;
    height: 60px;
    font-size: 15px;
}

#btn-volver {
    position: fixed;
    bottom: 20px;
    left: calc(200px + 40px);
    width: 150px;
    height: 60px;
    font-size: 15px;
}

/* ==========================================================================
   Tab Panel Overrides
   ========================================================================== */
.nav-tabs-hidden {
    display: none;
}

.tab-content.transparent {
    margin-top: 0;
}

/* ==========================================================================
   Accessibility Components
   ========================================================================== */
.skip-link {
    position: absolute;
    left: -999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    position: absolute;
    left: 16px;
    top: 12px;
    width: auto;
    height: auto;
    padding: 10px 14px;
    background: var(--primary-color);
    color: #fff;
    border-radius: var(--border-radius-sm);
    z-index: 10000;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.sr-live-region,
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

/* ==========================================================================
   Fixed Button Utility
   ========================================================================== */
.fixed-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}

/* ==========================================================================
   Approval Flow Components
   ========================================================================== */
.approval-card {
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all var(--transition-normal);
}
.approval-card:hover { background: #f8f9ff; }
.approval-card.approved { border-left: 4px solid var(--success-color); }
.approval-card.rejected { border-left: 4px solid var(--danger-color); }
.approval-card.pending { border-left: 4px solid var(--warning-color); }

.approval-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem;
    flex-shrink: 0;
}

/* ==========================================================================
   Operation Subtype Cards
   ========================================================================== */
.operation-type-card {
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: white;
}
.operation-type-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transform: translateY(-3px);
}
.operation-type-card.selected {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}
.operation-type-card .op-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}
.operation-type-card .op-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}
.operation-type-card .op-desc {
    font-size: 0.8rem;
    color: #6c757d;
}

/* ==========================================================================
   Detail View - Operation Panel
   ========================================================================== */
.detail-panel {
    background: white;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.detail-panel-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.detail-panel-header h5 {
    margin: 0;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.detail-panel-body {
    padding: 1.5rem;
}
.detail-field {
    margin-bottom: 1rem;
}
.detail-field-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}
.detail-field-value {
    font-size: 1rem;
    color: #212529;
}

/* ==========================================================================
   Wizard Steps
   ========================================================================== */
.wizard-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    padding: 0;
    list-style: none;
    counter-reset: step;
}
.wizard-step {
    flex: 1;
    text-align: center;
    position: relative;
    padding: 0 1rem;
}
.wizard-step::before {
    content: counter(step);
    counter-increment: step;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    margin: 0 auto 0.5rem;
    position: relative;
    z-index: 1;
    transition: all var(--transition-normal);
}
.wizard-step::after {
    content: '';
    position: absolute;
    top: 18px;
    left: calc(50% + 18px);
    right: calc(-50% + 18px);
    height: 2px;
    background: #e9ecef;
}
.wizard-step:last-child::after { display: none; }
.wizard-step.active::before {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 4px rgba(99,102,241,0.2);
}
.wizard-step.completed::before {
    background: var(--success-color);
    color: white;
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.8rem;
}
.wizard-step.completed::after {
    background: var(--success-color);
}
.wizard-step-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d;
}
.wizard-step.active .wizard-step-label { color: var(--primary-color); }
.wizard-step.completed .wizard-step-label { color: var(--success-color); }

/* ==========================================================================
   Dashboard Widgets
   ========================================================================== */
.widget-card {
    background: white;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    height: 100%;
    transition: transform var(--transition-normal);
}
.widget-card:hover { transform: translateY(-2px); }
.widget-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f3f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.widget-card-header h6 {
    margin: 0;
    font-weight: 700;
    font-size: 0.9rem;
}
.widget-card-body {
    padding: 1.25rem;
}

/* ==========================================================================
   Modern Top Navbar
   ========================================================================== */
.top-navbar {
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.top-navbar .navbar-brand {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--primary-color);
    text-decoration: none;
}
.top-navbar .navbar-brand i { margin-right: 0.5rem; }

/* ==========================================================================
   Responsive Enhancements
   ========================================================================== */
@media (max-width: 768px) {
    .wizard-steps { flex-direction: column; gap: 0.5rem; }
    .wizard-step::after { display: none; }
    .wizard-step { flex: none; display: flex; align-items: center; gap: 0.75rem; text-align: left; padding: 0.5rem 0; }
    .wizard-step::before { margin: 0; flex-shrink: 0; }
    .operation-type-card { padding: 1rem; }
    .detail-panel-header { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
}

/* ==========================================================================
   Validation Required Indicator
   ========================================================================== */
.validation-required {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    background: #fff3cd;
    color: #856404;
    border-radius: var(--border-radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
}

/* ==========================================================================
   Multi-select Approvers
   ========================================================================== */
.approver-selector {
    border: 2px dashed #e9ecef;
    border-radius: var(--border-radius-md);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.approver-selector:hover {
    border-color: var(--primary-color);
    background: rgba(99,102,241,0.02);
}
.approver-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    background: #e7f3ff;
    color: var(--primary-color);
    border-radius: var(--border-radius-xl);
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0.25rem;
}
.approver-tag .remove-approver {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}
.approver-tag .remove-approver:hover { opacity: 1; }

/* ==========================================================================
   Timeline Component
   ========================================================================== */
.archidoc-timeline {
    position: relative;
    padding-left: 2rem;
}
.archidoc-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}
.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    margin-left: -2rem;
}
.timeline-content {
    flex: 1;
    background: #f8f9fa;
    border-radius: var(--border-radius-md);
    padding: 0.75rem 1rem;
    border: 1px solid #e9ecef;
}
.timeline-content:hover {
    background: #fff;
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */
.sidebar-nav {
    width: 260px;
    background: #1e293b;
    color: #94a3b8;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 200;
    overflow-y: auto;
    transition: width var(--transition-normal);
}
.sidebar-nav .sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-nav .sidebar-brand h5 {
    color: white;
    margin: 0;
    font-weight: 800;
    font-size: 1.1rem;
}
.sidebar-nav .sidebar-section {
    padding: 0.75rem 1.5rem 0.35rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: #64748b;
}
.sidebar-nav .sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    color: #94a3b8;
    text-decoration: none;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}
.sidebar-nav .sidebar-link:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}
.sidebar-nav .sidebar-link.active {
    background: rgba(99,102,241,0.15);
    color: white;
    border-left-color: var(--primary-color);
}
.sidebar-nav .sidebar-link i {
    width: 20px;
    text-align: center;
}
.sidebar-nav .sidebar-badge {
    margin-left: auto;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--primary-color);
    color: white;
}

/* Layout with sidebar */
.layout-with-sidebar {
    margin-left: 260px;
    min-height: 100vh;
    background: #f1f5f9;
}

@media (max-width: 991px) {
    .sidebar-nav { transform: translateX(-100%); }
    .sidebar-nav.show { transform: translateX(0); }
    .layout-with-sidebar { margin-left: 0; }
}
