/* Notification & Custom Popups Styles */

/* 1. Toast Notifications */
#toast-container {
    position: fixed;
    top: 60px;
    /* Increased from 20px to avoid notch/clock */
    right: 20px;
    z-index: var(--z-notification);
    /* Absolute Top: Above everything else */
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--bg-surface-solid);
    color: var(--text-main);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 250px;
    max-width: 400px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    pointer-events: auto;
}

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

.toast-icon {
    font-size: 1.2rem;
}

.toast.success .toast-icon {
    color: #10b981;
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.info .toast-icon {
    color: var(--primary);
}

.toast.warning .toast-icon {
    color: #f59e0b;
}

/* 1b. Sync/Auto-Save Compact Style */
.toast.sync-toast {
    min-width: unset;
    padding: 10px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    justify-content: center;
    gap: 0;
    overflow: hidden;
    background: var(--bg-surface-solid);
    border: 2px solid var(--border-glass);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    transition:
        transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28),
        background-color 0.4s ease,
        border-color 0.4s ease,
        box-shadow 0.4s ease;
}

.toast.sync-toast.success {
    border-color: #10b981;
    background: #10b981;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    animation: sync-success-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.5);
}

.toast.sync-toast .toast-icon {
    transition: transform 0.3s ease, color 0.3s ease;
}

.toast.sync-toast.success .toast-icon {
    color: white;
    font-size: 1.4rem;
    transform: scale(1.1);
}

.toast.sync-toast .toast-text {
    display: none;
}

@keyframes sync-success-pop {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes sync-spin-fade {
    0% {
        opacity: 0.5;
        transform: rotate(0deg);
    }

    100% {
        opacity: 1;
        transform: rotate(360deg);
    }
}

.toast.sync-toast .fa-spin {
    color: var(--primary);
    filter: drop-shadow(0 0 5px rgba(var(--p-rgb), 0.3));
}

/* 2. Custom Dialog Modal (Confirm/Prompt) */
#dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    z-index: var(--z-dialog);
    /* Priority Top: Above Auth/Landing (150M/100M) */
    /* Must be > OneNote Nav (1,000,000) and Bulk Bar (1,100,000) */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#dialog-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.dialog-modal {
    background: var(--bg-surface-solid);
    width: 100%;
    max-width: 400px;
    border-radius: 24px;
    padding: 30px;
    border: 1px solid var(--border-glass);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
}

#dialog-overlay.show .dialog-modal {
    transform: scale(1);
}

.dialog-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.dialog-message {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 24px;
    line-height: 1.5;
}

.dialog-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--bg-item);
    border: 1px solid var(--border-strong);
    color: var(--text-main);
    margin-bottom: 24px;
    font-size: 16px;
    /* Prevent iOS zoom on focus */
    outline: none;
    min-height: 48px;
}

.dialog-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--p-h), 90%, 60%, 0.1);
}

.dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.dialog-btn {
    padding: 14px 24px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    transition: all 0.2s;
    min-height: 48px;
    /* Touch friendly height */
    -webkit-tap-highlight-color: transparent;
}

.dialog-btn:active {
    transform: scale(0.96);
    filter: brightness(0.9);
}

.dialog-btn.cancel {
    background: var(--bg-item);
    color: var(--text-muted);
}

.dialog-btn.cancel:hover {
    background: var(--bg-item-hover);
    color: var(--text-main);
}

.dialog-btn.confirm {
    background: var(--primary);
    color: white;
}

.dialog-btn.confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px var(--primary);
}

.dialog-btn.danger {
    background: #ef4444;
    color: white;
}

.dialog-btn.danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px #ef4444;
}

/* 3. Global Notification Panel (Premium OneNote Style) */
.notification-panel-premium {
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: modal-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.notif-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notif-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.notif-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-clear-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 6px 10px;
    border-radius: 8px;
}

.notif-clear-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.notif-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.notif-close:hover {
    color: var(--danger);
}

.notif-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.notif-item {
    padding: 16px;
    border-radius: 14px;
    background: var(--bg-item);
    margin-bottom: 10px;
    border: 1px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
}

.notif-item:hover {
    background: var(--bg-item-hover);
    border-color: var(--primary);
    transform: translateX(4px);
}

.notif-item.unread {
    border-left: 4px solid var(--primary);
}

.notif-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 4px;
    display: block;
}

.notif-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: block;
}

.notif-time {
    font-size: 0.75rem;
    color: var(--primary);
    opacity: 0.7;
    margin-top: 8px;
    display: block;
}

.notif-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* 4. Share Modal Styles */
.share-card {
    max-width: 440px !important;
    overflow: visible !important;
}

/* Keep glow contained despite overflow:visible */
.share-card::before {
    clip-path: inset(0 round 20px);
}

.share-content {
    position: relative;
    overflow: visible;
}

.share-content .input-group-modern {
    position: relative;
    z-index: 10;
}

.share-description {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.95rem;
    line-height: 1.5;
}

#share-target-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    #toast-container {
        left: 20px;
        right: 20px;
        top: 60px;
        /* Increased for mobile notch */
        width: auto;
    }

    .toast {
        min-width: 0;
        width: 100%;
    }

    .notification-panel-premium {
        max-width: 95vw;
        max-height: 70vh;
    }
}