/* Toast & Modal Interaction Dialogs */

/* Toast Container */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
    max-width: 420px;
    width: calc(100vw - 32px);
}

/* iOS Watery Frosted Glass Toast Notification */
.toast {
    pointer-events: auto;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    width: fit-content;
    max-width: 100%;
    border-radius: 20px; /* iOS squircle */
    
    /* Watery Liquid Frosted Glass */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0.60) 100%);
    backdrop-filter: blur(28px) saturate(190%) contrast(100%);
    -webkit-backdrop-filter: blur(28px) saturate(190%) contrast(100%);
    
    /* Uniform frosted border with specular highlight — NO one-sided border */
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 
        0 12px 32px -4px rgba(15, 23, 42, 0.12),
        0 4px 12px -2px rgba(15, 23, 42, 0.08),
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.75),
        inset 0 -1px 1px 0 rgba(0, 0, 0, 0.03);
    
    font-size: 0.915rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    
    /* Slide in from right */
    transform: translateX(calc(100% + 40px));
    opacity: 0;
    transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.32s ease,
                box-shadow 0.25s ease;
    will-change: transform, opacity;
}

[data-theme="dark"] .toast {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.74) 0%, rgba(15, 23, 42, 0.70) 100%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 
        0 16px 36px -4px rgba(0, 0, 0, 0.48),
        0 6px 14px -2px rgba(0, 0, 0, 0.35),
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -1px 1px 0 rgba(0, 0, 0, 0.25);
    color: var(--text-primary);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

/* Slide out to right on dismissal */
.toast.hide {
    transform: translateX(calc(100% + 40px));
    opacity: 0;
    pointer-events: none;
    transition: transform 0.36s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.28s ease;
}

.toast:hover {
    box-shadow: 
        0 14px 36px -4px rgba(15, 23, 42, 0.16),
        0 6px 16px -2px rgba(15, 23, 42, 0.1),
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.85);
    transform: translateX(0) scale(1.015);
}

[data-theme="dark"] .toast:hover {
    box-shadow: 
        0 20px 42px -4px rgba(0, 0, 0, 0.58),
        0 8px 20px -2px rgba(0, 0, 0, 0.4),
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.3);
}

/* iOS circular status icon pill */
.toast-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: transform var(--transition-micro);
}

.toast-icon-wrap svg,
.toast-icon-wrap i {
    width: 17px;
    height: 17px;
    display: block;
    stroke-width: 2.2px;
}

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

.toast-message {
    display: block;
    word-break: break-word;
}

.toast-close {
    background: transparent;
    border: none;
    padding: 4px;
    margin-left: 4px;
    margin-right: -4px;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.6;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity var(--transition-micro), background var(--transition-micro);
}

.toast-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .toast-close:hover {
    background: rgba(255, 255, 255, 0.12);
}

.toast-close svg,
.toast-close i {
    width: 14px;
    height: 14px;
    display: block;
}

/* Uniform status variants without any one-sided border */
.toast-success {
    border-color: rgba(16, 185, 129, 0.28);
}
.toast-success .toast-icon-wrap {
    background: rgba(16, 185, 129, 0.14);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
}
[data-theme="dark"] .toast-success {
    border-color: rgba(16, 185, 129, 0.32);
}
[data-theme="dark"] .toast-success .toast-icon-wrap {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.35);
}

.toast-error {
    border-color: rgba(239, 68, 68, 0.28);
}
.toast-error .toast-icon-wrap {
    background: rgba(239, 68, 68, 0.14);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.25);
}
[data-theme="dark"] .toast-error {
    border-color: rgba(239, 68, 68, 0.32);
}
[data-theme="dark"] .toast-error .toast-icon-wrap {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.35);
}

.toast-warning {
    border-color: rgba(245, 158, 11, 0.28);
}
.toast-warning .toast-icon-wrap {
    background: rgba(245, 158, 11, 0.14);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.25);
}
[data-theme="dark"] .toast-warning {
    border-color: rgba(245, 158, 11, 0.32);
}
[data-theme="dark"] .toast-warning .toast-icon-wrap {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.35);
}

.toast-info {
    border-color: rgba(226, 24, 91, 0.24);
}
.toast-info .toast-icon-wrap {
    background: rgba(226, 24, 91, 0.12);
    color: var(--brand-primary);
    border: 1px solid rgba(226, 24, 91, 0.22);
}
[data-theme="dark"] .toast-info {
    border-color: rgba(255, 101, 148, 0.3);
}
[data-theme="dark"] .toast-info .toast-icon-wrap {
    background: rgba(255, 101, 148, 0.2);
    color: #ff6594;
    border-color: rgba(255, 101, 148, 0.35);
}

/* Responsive adjustments */
@media (max-width: 640px) {
    #toast-container {
        top: 16px;
        right: 14px;
        left: 14px;
        width: auto;
        max-width: none;
        align-items: stretch;
    }
    
    .toast {
        width: 100%;
        padding: 12px 16px;
        border-radius: 18px;
    }
}

/* Stop background scroll when any modal is active */
html.modal-open {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    height: 100% !important;
}

body.modal-open {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    height: 100% !important;
    touch-action: none !important;
}

/* Modal Overlay: Traps all touch scroll gestures */
.modal-backdrop,
.mod-inspector-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9990;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-ui), visibility var(--transition-ui);
    touch-action: none !important;
    overscroll-behavior: contain !important;
}

.modal-backdrop.active,
.mod-inspector-modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-box,
.mod-inspector-modal {
    background: var(--surface-elevated);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    width: 100%;
    max-width: 460px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.92);
    transition: transform var(--transition-ui);
    touch-action: auto;
}

.modal-backdrop.active .modal-box,
.mod-inspector-modal-backdrop.active .mod-inspector-modal {
    transform: scale(1);
}

.modal-header {
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--surface-border);
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-body,
.inspector-scrollable {
    padding: 22px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-secondary);
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y;
}

.modal-footer {
    padding: 16px 22px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--surface-border);
    background: var(--surface-glass);
    flex-shrink: 0;
}

/* Incoming Contact Requests List in Modal */
.requests-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 380px;
    overflow-y: auto;
}

.request-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface-glass);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
}

.request-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.request-item-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--surface-border);
    background: #1e293b;
}

.request-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.request-item-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
}

.request-item-city {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.request-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-approve-req {
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    background: #10b981;
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-approve-req:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
}

.btn-decline-req {
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--surface-border);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-decline-req:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
    color: #ef4444;
}

.request-status-pill {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: capitalize;
}

.request-status-pill.accepted {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
}

.request-status-pill.rejected {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
}

.request-status-pill.pending {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
}

/* Requests Modal Tabs */
.requests-tabs {
    display: flex;
    gap: 8px;
    padding: 6px;
    background: var(--surface-card);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 1px solid var(--surface-border);
}

.requests-tab-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition-micro);
}

.requests-tab-btn.active {
    background: var(--surface-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.requests-tab-badge {
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--brand-primary);
    color: #ffffff;
}

/* Unlocked Confidential Contact Details */
.unlocked-details-box {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.24);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.unlocked-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.unlocked-phone-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.unlocked-phone-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.86rem;
    font-weight: 700;
    color: #10b981;
    text-decoration: none;
}

.unlocked-phone-link i,
.unlocked-phone-link svg {
    width: 15px;
    height: 15px;
}

.unlocked-wa-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.74rem;
    font-weight: 700;
    background: #25d366;
    color: #ffffff;
    text-decoration: none;
    transition: transform var(--transition-micro);
}

.unlocked-wa-link:hover {
    transform: translateY(-1px);
}

.unlocked-wa-link i,
.unlocked-wa-link svg {
    width: 14px;
    height: 14px;
}

.unlocked-rate-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 800;
    background: rgba(226, 24, 91, 0.12);
    color: var(--brand-primary);
    border: 1px solid rgba(226, 24, 91, 0.25);
}

.unlocked-rate-badge i,
.unlocked-rate-badge svg {
    width: 14px;
    height: 14px;
}

.locked-pending-hint {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

