/* ==========================================
   css/components.css — Glass, Login, Sidebar, Tabs, Toast, Loader, B2B Switch
   Extraído de style.css líneas 48–252 + 316–371
   ========================================== */

/* Glassmorphism Panel */
.glass-panel {
    background: rgba(252, 252, 253, 0.85) !important;
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
}

.bg-white {
    background-color: #ffffff !important;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.03), 0 0 1px rgba(15, 23, 42, 0.06) !important;
    border: 1px solid rgba(226, 232, 240, 0.5) !important;
}

/* Login */
.login-bg {
    background-color: #f8fafc;
    background-image:
        radial-gradient(at 0% 0%, hsla(220, 30%, 95%, 1) 0, transparent 50%),
        radial-gradient(at 100% 100%, hsla(220, 30%, 90%, 1) 0, transparent 50%);
}

.login-glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.08), 0 0 1px rgba(15, 23, 42, 0.05);
}

/* Sidebar Móvil */
.sidebar-overlay {
    display: none;
    background: rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    position: fixed;
    inset: 0;
    z-index: 40;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
    .mobile-sidebar { transform: translateX(-100%); position: fixed; z-index: 50; }
    .mobile-sidebar.open { transform: translateX(0); }
}

/* Tabs — Estilo iOS Premium */
.tabs-container {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tabs-container::-webkit-scrollbar { display: none; }

.tab-btn {
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.tab-btn:hover { color: #0f172a; }
.tab-btn.active {
    background-color: #ffffff !important;
    color: #0f172a !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02) !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
}
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }

/* Toast */
#toast-container { z-index: 999999; pointer-events: none; }
.toast {
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(-20px);
    opacity: 0;
    pointer-events: auto;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* Loader */
#global-loader { 
    z-index: 999999; 
    background: #0f172a; 
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.spinner {
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s cubic-bezier(0.6, 0.2, 0.4, 0.8) infinite;
    width: 24px;
    height: 24px;
}

/* B2B Switch (iOS Style) */
.b2b-switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.b2b-switch input { opacity: 0; width: 0; height: 0; }
.b2b-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(148, 163, 184, 0.3);
    transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 34px;
}
.b2b-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}
input:checked + .b2b-slider { background-color: #0f172a; }
input:checked + .b2b-slider:before { transform: translateX(14px); }

/* Master Panel readonly inputs */
#master-aliado-info-fields input[readonly] {
    background-color: #fcfcfd !important;
    border-color: rgba(226, 232, 240, 0.5) !important;
    cursor: default;
    box-shadow: none !important;
}

/* Mobile safe modals */
@media (max-width: 768px) {
    button, select, input, textarea, .tab-btn { min-height: 44px !important; }
    .modal-mobile-safe {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        height: -webkit-fill-available !important;
        max-height: -webkit-fill-available !important;
        border-radius: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}
