/**
 * Softzia - Unified Custom UI System (Dialogs, Modals, Toasts, Tooltips)
 * Professional Light Glassmorphism Design System (Pillar 12 Compliant: Zero Browser Native Prompts)
 */

/* ==========================================================================
   1. TOAST NOTIFICATION CONTAINER & CARDS (Light Frosted Glass)
   ========================================================================== */
#softziaToastContainer {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 400px;
    width: calc(100vw - 48px);
}

.softzia-toast {
    position: relative;
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid #c7d2fe;
    box-shadow: 0 10px 28px -4px rgba(15, 23, 42, 0.10), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    overflow: hidden;
    transform-origin: top right;
    animation: softziaToastSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.softzia-toast.dismissing {
    animation: softziaToastSlideOut 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes softziaToastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes softziaToastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100%) scale(0.94);
    }
}

.softzia-toast-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.softzia-toast-icon svg {
    width: 18px;
    height: 18px;
}

.softzia-toast-content {
    flex: 1;
    min-width: 0;
}

.softzia-toast-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
    line-height: 1.3;
}

.softzia-toast-message {
    font-size: 12.5px;
    color: #475569;
    line-height: 1.45;
    word-break: break-word;
}

.softzia-toast-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background-color 0.15s ease;
    flex-shrink: 0;
}

.softzia-toast-close:hover {
    color: #0f172a;
    background: rgba(241, 245, 249, 0.90);
}

/* Toast Progress Bar */
.softzia-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #e0e7ff;
    width: 100%;
}

.softzia-toast-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
}

/* Toast Types */
.softzia-toast-success {
    border-left: 4px solid #059669;
}
.softzia-toast-success .softzia-toast-icon {
    background: #ecfdf5;
    color: #059669;
}
.softzia-toast-success .softzia-toast-progress-bar {
    background: #059669;
}

.softzia-toast-error {
    border-left: 4px solid #ef4444;
}
.softzia-toast-error .softzia-toast-icon {
    background: #fef2f2;
    color: #dc2626;
}
.softzia-toast-error .softzia-toast-progress-bar {
    background: #ef4444;
}

.softzia-toast-warning {
    border-left: 4px solid #f59e0b;
}
.softzia-toast-warning .softzia-toast-icon {
    background: #fffbeb;
    color: #d97706;
}
.softzia-toast-warning .softzia-toast-progress-bar {
    background: #f59e0b;
}

.softzia-toast-info {
    border-left: 4px solid #4f46e5;
}
.softzia-toast-info .softzia-toast-icon {
    background: #eef2ff;
    color: #4f46e5;
}
.softzia-toast-info .softzia-toast-progress-bar {
    background: #4f46e5;
}

/* ==========================================================================
   2. CUSTOM THEMED MODALS & CONFIRMATION BOXES (Light Frosted Glass)
   ========================================================================== */
.softzia-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.softzia-modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.softzia-modal-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border-radius: 18px;
    border: 1px solid #c7d2fe;
    box-shadow: 0 20px 50px -10px rgba(15, 23, 42, 0.15), 0 0 20px rgba(79, 70, 229, 0.06);
    max-width: 460px;
    width: 100%;
    padding: 26px;
    transform: scale(0.94) translateY(12px);
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.softzia-modal-backdrop.active .softzia-modal-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.softzia-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.softzia-modal-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.softzia-modal-header-icon svg {
    width: 22px;
    height: 22px;
}

.softzia-modal-title {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
    letter-spacing: -0.3px;
}

.softzia-modal-body {
    font-size: 14px;
    color: #475569;
    line-height: 1.55;
    margin-bottom: 22px;
}

.softzia-modal-body strong {
    color: #0f172a;
    font-weight: 600;
}

.softzia-modal-body code {
    background: #f1f5f9;
    color: #1e293b;
    padding: 2px 6px;
    border-radius: 5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12.5px;
    border: 1px solid #e2e8f0;
}

.softzia-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.softzia-modal-btn {
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 700;
    border-radius: 9px;
    border: none;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.softzia-modal-btn:active {
    transform: scale(0.96);
    transition: transform 0.08s ease;
}

.softzia-modal-btn-cancel {
    background: #ffffff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
}

.softzia-modal-btn-cancel:hover {
    background: #eef2ff;
    color: #3730a3;
    border-color: #818cf8;
}

.softzia-modal-btn-confirm,
.softzia-modal-btn-primary {
    background: #4f46e5;
    color: #ffffff;
    border: 1px solid #4338ca;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.softzia-modal-btn-confirm:hover,
.softzia-modal-btn-primary:hover {
    background: #4338ca;
    border-color: #3730a3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.32);
}

.softzia-modal-btn-confirm.danger,
.softzia-modal-btn-danger {
    background: #ef4444;
    color: #ffffff;
    border: 1px solid #dc2626;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

.softzia-modal-btn-confirm.danger:hover,
.softzia-modal-btn-danger:hover {
    background: #dc2626;
    border-color: #b91c1c;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.32);
}

.softzia-modal-btn-success {
    background: #10b981;
    color: #ffffff;
    border: 1px solid #059669;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.softzia-modal-btn-success:hover {
    background: #059669;
    border-color: #047857;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.32);
}

/* Modal Variants */
.softzia-modal-confirm-warning .softzia-modal-header-icon {
    background: #fffbeb;
    color: #d97706;
}

.softzia-modal-confirm-danger .softzia-modal-header-icon {
    background: #fef2f2;
    color: #dc2626;
}

.softzia-modal-confirm-info .softzia-modal-header-icon {
    background: #eef2ff;
    color: #4f46e5;
}

/* ==========================================================================
   3. CUSTOM SLEEK TOOLTIPS (Pillar 12 Compliant)
   ========================================================================== */
.softzia-tooltip {
    position: fixed;
    z-index: 999999;
    background: #0f172a;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.softzia-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   4. CUSTOM THEMED SELECT / COMBOBOX DROPDOWNS (Light Glass)
   ========================================================================== */
.glass-dropdown {
    background: #ffffff;
    border: 1px solid #c7d2fe;
    border-radius: 12px;
    box-shadow: 0 16px 40px -6px rgba(15, 23, 42, 0.14), 0 4px 12px rgba(15, 23, 42, 0.05);
}

.combobox-trigger.glass-surface {
    background: #ffffff;
    border: 1px solid #c7d2fe;
    color: #0f172a;
    transition: all 0.18s ease;
}

.combobox-trigger.glass-surface:hover {
    border-color: #6366f1;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.combobox-options .combobox-item {
    color: #334155;
    transition: background 0.15s ease, color 0.15s ease;
}

.combobox-options .combobox-item:hover {
    background: #eef2ff !important;
    color: #4f46e5 !important;
}

/* ==========================================================================
   5. FLOATING BACK-TO-TOP BUTTON (Light Frosted Glass)
   ========================================================================== */
.btn-back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid #c7d2fe;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.btn-back-to-top:hover {
    background: #ffffff;
    color: #4f46e5;
    border-color: #818cf8;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -2px rgba(79, 70, 229, 0.20);
}

.btn-back-to-top:active {
    transform: scale(0.92);
    transition: transform 0.08s ease;
}

/* ==========================================================================
   6. SEARCH CLEAR BUTTON
   ========================================================================== */
.search-clear-btn {
    position: absolute;
    right: 52px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    transition: all 0.15s ease;
    padding: 0;
    z-index: 5;
    -webkit-appearance: none;
    appearance: none;
}

.search-clear-btn:hover {
    background: #c7d2fe;
    color: #312e81;
}

/* ==========================================================================
   7. RESPONSIVE MOBILE NAVIGATION DRAWER & TOGGLE (Light Glass)
   ========================================================================== */
.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #c7d2fe;
    cursor: pointer;
    padding: 8px 7px;
    gap: 5px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-appearance: none;
    appearance: none;
}

.mobile-nav-toggle:hover {
    background: #ffffff;
    border-color: #818cf8;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.mobile-nav-toggle .bar {
    display: block;
    width: 20px;
    height: 2px;
    background: #334155;
    border-radius: 2px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: center;
}

.mobile-nav-toggle.active .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-nav-toggle.active .bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-nav-toggle.active .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav-drawer {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid #c7d2fe;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
    padding: 16px 20px 24px;
    z-index: 999;
    flex-direction: column;
    gap: 8px;
    animation: mobileDrawerSlideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes mobileDrawerSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-nav-drawer.active {
    display: flex;
}

.mobile-nav-drawer .nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    font-size: 14.5px;
    font-weight: 600;
    color: #334155;
    border-radius: 8px;
    border: 1px solid transparent;
}

.mobile-nav-drawer .nav-link:hover,
.mobile-nav-drawer .nav-link.active {
    background: #eef2ff;
    color: #4f46e5;
    border-color: #c7d2fe;
}

.mobile-nav-drawer .btn-portal {
    margin-left: 0;
    margin-top: 8px;
    width: 100%;
    justify-content: center;
    padding: 11px 16px;
    font-size: 14px;
}

@media (max-width: 860px) {
    .nav-menu {
        display: none !important;
    }
    .mobile-nav-toggle {
        display: flex;
    }
}

/* ==========================================================================
   7. PILLAR 12 CUSTOM COMBOBOX DROPDOWN (Zero Browser Native OS Popups)
   ========================================================================== */
.softzia-combobox {
    position: relative;
    width: 100%;
}

.softzia-combobox-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
    cursor: pointer;
    text-align: left;
    transition: all 0.18s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    outline: none;
    user-select: none;
    min-height: 42px;
    box-sizing: border-box;
}

.softzia-combobox-trigger:hover {
    border-color: #818cf8;
    background-color: #ffffff;
}

.softzia-combobox.open .softzia-combobox-trigger,
.softzia-combobox-trigger:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

.softzia-combobox-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
    color: #0f172a;
}

.softzia-combobox-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.18s ease;
    flex-shrink: 0;
}

.softzia-combobox.open .softzia-combobox-arrow {
    transform: rotate(180deg);
    color: #4f46e5;
}

.softzia-combobox-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #c7d2fe;
    border-radius: 12px;
    box-shadow: 0 20px 35px -5px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(79, 70, 229, 0.08);
    z-index: 99999;
    max-height: 290px;
    overflow-y: auto;
    padding: 6px;
    display: none;
    transform-origin: top center;
    animation: softziaComboboxSlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes softziaComboboxSlideDown {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.softzia-combobox-search-wrapper {
    padding: 4px 4px 8px 4px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 4px;
}

.softzia-combobox-search {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: #0f172a;
    outline: none;
    transition: all 0.15s ease;
}

.softzia-combobox-search:focus {
    background: #ffffff;
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

.softzia-combobox-options {
    max-height: 220px;
    overflow-y: auto;
}

.softzia-combobox-options::-webkit-scrollbar,
.softzia-combobox-menu::-webkit-scrollbar {
    width: 6px;
}
.softzia-combobox-options::-webkit-scrollbar-track,
.softzia-combobox-menu::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 8px;
}
.softzia-combobox-options::-webkit-scrollbar-thumb,
.softzia-combobox-menu::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 8px;
}
.softzia-combobox-options::-webkit-scrollbar-thumb:hover,
.softzia-combobox-menu::-webkit-scrollbar-thumb:hover {
    background: #818cf8;
}

.softzia-combobox-item {
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.14s ease;
    user-select: none;
}

.softzia-combobox-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.softzia-combobox-item.selected {
    background: rgba(79, 70, 229, 0.08);
    color: #4f46e5;
    font-weight: 700;
}

.softzia-combobox-item.is-child {
    padding-left: 24px;
    font-size: 13px;
    color: #475569;
}

.softzia-combobox-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent !important;
}

.softzia-combobox-check {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4f46e5;
    flex-shrink: 0;
}

