/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8fafc;
    color: #334155;
    line-height: 1.6;
    overflow: hidden;
}

/* Login Screen */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-container {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.login-logo {
    height: 4.5rem;
    width: 4.5rem;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.login-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.025em;
}

.login-header p {
    color: #64748b;
    font-size: 1rem;
    margin: 0;
}

.login-header p {
    color: #64748b;
    font-size: 0.875rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.form-group input {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.login-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.login-btn:hover {
    background: #2563eb;
}

.login-error {
    color: #dc2626;
    font-size: 0.875rem;
    text-align: center;
    margin-top: 0.5rem;
}

/* Remember Credentials Checkbox */
.remember-group {
    margin: 0.5rem 0;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
    user-select: none;
}

.remember-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    position: relative;
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    background-color: white;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.remember-label input[type="checkbox"]:checked + .checkmark {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.remember-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.remember-label:hover .checkmark {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    height: 100vh;
    background-color: #f8fafc;
}

.hidden {
    display: none !important;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-container {
    flex: 1;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.brand-logo-icon {
    height: 2.5rem;
    width: 2.5rem;
    object-fit: contain;
    flex-shrink: 0;
    transition: all 0.3s ease;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.brand-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #000000;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.025em;
    transition: all 0.3s ease;
    white-space: nowrap;
    opacity: 1;
}

/* Collapsed state - hide text, smaller icon */
.sidebar.collapsed .brand-container {
    justify-content: center;
}

.sidebar.collapsed .brand-logo-icon {
    height: 2rem;
    width: 2rem;
}

.sidebar.collapsed .brand-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.toggle-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    color: #ffffff;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
}

.toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.sidebar-content {
    flex: 1;
    padding: 1rem 0;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: #64748b;
    transition: all 0.2s;
    position: relative;
}

.nav-link:hover {
    background-color: #f1f5f9;
    color: #334155;
}

.nav-item.active .nav-link {
    background-color: #e0f2fe;
    color: #0369a1;
    border-right: 3px solid #0369a1;
}

.nav-link i {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    flex-shrink: 0;
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.3s ease, width 0.3s ease;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
    transition: margin-right 0.3s ease;
}

/* Submenu */
.has-submenu .nav-link {
    justify-content: space-between;
}

.submenu-arrow {
    transition: transform 0.2s;
    margin-left: auto;
    margin-right: 0 !important;
}

.has-submenu.open .submenu-arrow {
    transform: rotate(90deg);
}

.submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: #f8fafc;
}

.has-submenu.open .submenu {
    max-height: 200px;
}

.submenu-item {
    margin-bottom: 0.125rem;
}

.submenu-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem 0.5rem 3rem;
    text-decoration: none;
    color: #64748b;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.submenu-link:hover {
    background-color: #e2e8f0;
    color: #334155;
}

.submenu-item.active .submenu-link {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.sidebar.collapsed .submenu {
    display: none;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
}

.logout-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.75rem;
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s;
    text-align: left;
}

.logout-btn:hover {
    background-color: #fef2f2;
}

.logout-btn i {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    flex-shrink: 0;
    transition: margin-right 0.3s ease;
}

.sidebar.collapsed .logout-btn i {
    margin-right: 0;
}

/* Sidebar hover state - when collapsed and hovered */
.sidebar.collapsed.hovered {
    width: 280px;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed.hovered .nav-text,
.sidebar.collapsed.hovered .logout-text {
    opacity: 1;
    visibility: visible;
}

.sidebar.collapsed.hovered .nav-link i {
    margin-right: 0.75rem;
}

.sidebar.collapsed.hovered .logout-btn i {
    margin-right: 0.75rem;
}

.sidebar.collapsed.hovered .submenu {
    display: block;
}

/* When sidebar is hovered and collapsed, keep open submenus visible */
.sidebar.collapsed.hovered .has-submenu.open .submenu {
    max-height: 200px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-area {
    flex: 1;
    position: relative;
    background: white;
}

/* Iframe Container */
.iframe-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#mainIframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Profile Page */
.profile-page {
    padding: 2rem;
    height: 100%;
    overflow-y: auto;
}

.profile-header {
    margin-bottom: 2rem;
}

.profile-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.profile-header p {
    color: #64748b;
}

.profile-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.profile-avatar {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    background: #e0f2fe;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-icon {
    width: 60px;
    height: 60px;
    color: #0369a1;
}

.profile-info {
    flex: 1;
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr 1fr;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-item label {
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-item span {
    font-size: 1rem;
    color: #1f2937;
}

.status-active {
    color: #059669 !important;
    font-weight: 600;
}

/* Loading States */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Registros Page Styles */
.registros-page {
    padding: 2rem;
    height: 100%;
    overflow-y: auto;
    background: #f8fafc;
}

.registros-page > div:first-child {
    background: #ffffff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.registros-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.registros-title-section {
    flex: 1;
    min-width: 200px;
}

.registros-title-section h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.registros-title-section p {
    color: #64748b;
    font-size: 1rem;
}

.registros-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.registros-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.registros-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.registros-refresh-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.registros-refresh-btn:hover:not(:disabled) {
    background: #e2e8f0;
    color: #334155;
}

.registros-download-btn {
    background: #059669;
    color: white;
    border: 1px solid #059669;
}

.registros-download-btn:hover:not(:disabled) {
    background: #047857;
    border-color: #047857;
}

.registros-action-btn i {
    font-size: 1rem;
}

.registros-content {
    min-height: 400px;
    position: relative;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #64748b;
}

.loading-spinner i {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.spin {
    animation: spin 1s linear infinite;
}

.registros-table-container {
    overflow-x: auto;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.registros-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.registros-table th {
    background: #f8fafc;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.registros-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    color: #4b5563;
}

.registros-table tr:hover {
    background: #f9fafb;
}

.registros-table tr:nth-child(even) {
    background: #f8fafc;
}

.registros-table tr:nth-child(even):hover {
    background: #f1f5f9;
}

.registros-error {
    text-align: center;
    padding: 2rem;
    color: #dc2626;
}

.registros-error i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.registros-refresh-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: 1rem;
    transition: background-color 0.2s;
}

.registros-refresh-btn:hover {
    background: #2563eb;
}

/* Responsive Styles for Registros */
@media (max-width: 768px) {
    .registros-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .registros-actions {
        justify-content: stretch;
    }
    
    .registros-action-btn {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }
    
    .registros-action-btn span {
        display: none;
    }
}

@media (max-width: 480px) {
    .registros-actions {
        flex-direction: column;
    }
    
    .registros-action-btn span {
        display: inline;
    }
}

/* Download Notification Styles */
.download-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1000;
    font-weight: 500;
    animation: slideInRight 0.3s ease-out;
    border-left: 4px solid;
}

.download-notification.success {
    border-left-color: #059669;
    color: #047857;
}

.download-notification.error {
    border-left-color: #dc2626;
    color: #b91c1c;
}

.download-notification i {
    font-size: 1.25rem;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive styles for login */
@media (max-width: 480px) {
    .login-container {
        margin: 1rem;
        padding: 2rem;
    }
    
    .login-logo {
        height: 3.5rem;
        width: 3.5rem;
    }
    
    .login-title {
        font-size: 2rem;
    }
    
    .login-brand {
        gap: 0.5rem;
    }
    
    .login-btn {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        min-height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        box-sizing: border-box;
    }
}

@media (max-width: 360px) {
    .login-brand {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .login-logo {
        height: 3rem;
        width: 3rem;
    }
    
    .login-title {
        font-size: 1.75rem;
    }
    
    .login-btn {
        padding: 1rem;
        font-size: 1rem;
        min-height: 48px;
        font-weight: 600;
    }
}

/* ==================== MOBILE RESPONSIVE STYLES ==================== */

/* Mobile Header - Oculto en escritorio, visible en móvil */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem;
    align-items: center;
    gap: 1rem;
    z-index: 10001;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    height: 70px;
}

.mobile-menu-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.mobile-menu-btn:hover {
    background-color: #f1f5f9;
}

.mobile-menu-btn i {
    width: 1.5rem;
    height: 1.5rem;
    color: #374151;
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.mobile-logo {
    height: 2rem;
    width: 2rem;
    object-fit: contain;
}

.mobile-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
}

/* Mobile Overlay - Oculto por defecto */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Media Queries para Móvil */
@media (max-width: 768px) {
    /* Mostrar header móvil */
    .mobile-header {
        display: flex;
    }
    
    /* Dashboard layout para móvil */
    .dashboard {
        flex-direction: column;
        height: 100vh;
    }
    
    /* Sidebar completamente oculto por defecto en móvil */
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        height: 100vh;
        width: 280px !important;
        z-index: 1000;
        transition: left 0.3s ease;
        border-right: 1px solid #e2e8f0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    /* Mostrar sidebar cuando se abre en móvil */
    .sidebar.mobile-open {
        left: 0;
    }
    
    /* Main content ocupa toda la pantalla menos el header */
    .main-content {
        flex: 1;
        width: 100%;
        height: calc(100vh - 70px);
        margin-left: 0;
        margin-top: 70px;
    }
    
    /* Mostrar overlay cuando sidebar está abierto */
    .mobile-overlay.show {
        display: block;
    }
    
    /* Ocultar botón toggle de escritorio en móvil */
    .sidebar #toggleSidebar {
        display: none;
    }
    
    /* Ajustar contenido del sidebar para móvil */
    .sidebar-header {
        padding: 1rem;
    }
    
    .sidebar-content {
        flex: 1;
        overflow-y: auto;
        max-height: calc(100vh - 160px);
        padding-bottom: 1rem;
    }
    
    /* Asegurar que el footer del sidebar sea visible en móvil */
    .sidebar-footer {
        flex-shrink: 0;
        padding: 0.75rem 1rem;
        border-top: 1px solid #e2e8f0;
        position: sticky;
        bottom: 0;
        background: white;
    }
    
    /* Asegurar que el estado collapsed no se aplique en móvil */
    .sidebar.collapsed {
        width: 280px !important;
        left: -280px;
    }
    
    .sidebar.collapsed.mobile-open {
        left: 0;
    }
    
    /* Resetear estilos collapsed para móvil */
    .sidebar.collapsed .brand-text,
    .sidebar.collapsed .nav-text {
        opacity: 1;
        visibility: visible;
        width: auto;
    }
    
    .sidebar.collapsed .nav-link i {
        margin-right: 0.75rem;
    }
    
    /* Ajustes adicionales para móvil */
    .profile-page {
        padding: 1rem;
    }
    
    .profile-card {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .profile-avatar {
        align-self: center;
        width: 100px;
        height: 100px;
    }
    
    .avatar-icon {
        width: 50px;
        height: 50px;
    }
    
    .profile-info {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Registros page mobile adjustments */
    .registros-page {
        padding: 1rem;
    }
    
    .registros-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .registros-actions {
        gap: 0.5rem;
    }
    
    .registros-action-btn {
        flex: 1;
        justify-content: center;
    }
}

/* Pantallas móviles más pequeñas */
@media (max-width: 480px) {
    .mobile-header {
        padding: 0.75rem;
    }
    
    .mobile-title {
        font-size: 1.125rem;
    }
    
    .mobile-logo {
        height: 1.75rem;
        width: 1.75rem;
    }
    
    .sidebar {
        width: 260px !important;
        left: -260px;
    }
    
    .sidebar.mobile-open,
    .sidebar.collapsed.mobile-open {
        left: 0;
    }
    
    .main-content {
        height: calc(100vh - 60px);
        margin-top: 60px;
    }
    
    .mobile-header {
        height: 60px;
    }
}

/* ========================================================================
   PWA (Progressive Web App) STYLES
   ======================================================================== */

/* PWA Install Button */
.pwa-install-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    z-index: 9999;
    transition: all 0.3s ease;
    animation: pwa-pulse 2s infinite;
}

.pwa-install-button:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6c5ce7 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* PWA Animations */
@keyframes pwa-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    }
}

@keyframes pwa-slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pwa-slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* PWA Notifications */
.pwa-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 320px;
    animation: pwa-slideInRight 0.3s ease;
    border-left: 4px solid #007bff;
}

.pwa-notification.success {
    border-left-color: #28a745;
}

.pwa-notification.success i {
    color: #28a745;
}

.pwa-notification.info {
    border-left-color: #007bff;
}

.pwa-notification.info i {
    color: #007bff;
}

.pwa-notification.warning {
    border-left-color: #ffc107;
}

.pwa-notification.warning i {
    color: #ffc107;
}

.pwa-notification i {
    font-size: 20px;
    flex-shrink: 0;
}

.pwa-notification button {
    background: #007bff;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s ease;
}

.pwa-notification button:hover {
    background: #0056b3;
}

.pwa-notification button.secondary {
    background: #6c757d;
}

.pwa-notification button.secondary:hover {
    background: #545b62;
}

/* PWA Standalone Mode Adjustments */
@media all and (display-mode: standalone) {
    body {
        /* Ajustes específicos para cuando la app está instalada */
        user-select: none; /* Evitar selección de texto accidental */
    }
    
    /* Ocultar scrollbars en modo standalone */
    ::-webkit-scrollbar {
        width: 8px;
    }
    
    ::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    ::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 4px;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }
    
    /* Mejorar taps en modo standalone */
    button, .nav-link, .submenu-link {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
}

/* PWA Mobile Optimizations */
@media (max-width: 768px) {
    .pwa-install-button {
        bottom: 80px; /* Evitar conflicto con UI móvil */
        right: 16px;
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .pwa-notification {
        top: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
        border-radius: 6px;
    }
    
    /* Mejorar área de toque en móviles */
    .nav-link, .submenu-link, button {
        min-height: 44px; /* Área mínima recomendada para toque */
        display: flex;
        align-items: center;
    }
}

/* PWA Dark Mode Support (si se implementa en el futuro) */
@media (prefers-color-scheme: dark) {
    .pwa-notification {
        background: #2d3748;
        color: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

/* PWA Landscape Orientation */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .pwa-install-button {
        bottom: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .pwa-notification {
        top: 10px;
        right: 10px;
        padding: 12px;
    }
}

/* PWA Loading States */
.pwa-loading {
    position: relative;
    overflow: hidden;
}

.pwa-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: pwa-shimmer 1.5s infinite;
}

@keyframes pwa-shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* PWA Accessibility Improvements */
.pwa-install-button:focus,
.pwa-notification button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .pwa-install-button {
        animation: none;
    }
    
    .pwa-notification {
        animation: none;
    }
    
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
