/* 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;
    }
}
/* ── Share with teacher: suggestions (theme-aware, touch-sized) ── */
#share-suggestions .share-sugg-item {
    display: flex; align-items: center; gap: 12px;
    min-height: 56px; padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-glass, rgba(127, 127, 127, 0.15));
    transition: background 0.15s;
}
#share-suggestions .share-sugg-item:last-child { border-bottom: none; }
#share-suggestions .share-sugg-item:hover,
#share-suggestions .share-sugg-item:focus-visible { background: rgba(99, 102, 241, 0.1); outline: none; }
#share-suggestions .share-sugg-avatar {
    width: 36px; height: 36px; flex: none;
    display: grid; place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; font-weight: 700;
}
#share-suggestions .share-sugg-text { flex: 1; min-width: 0; }
#share-suggestions .share-sugg-name {
    font-weight: 600; font-size: 0.95rem;
    color: var(--text-main, #0f172a) !important;
    -webkit-text-fill-color: var(--text-main, #0f172a) !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#share-suggestions .share-sugg-email {
    font-size: 0.8rem; color: var(--text-muted, #64748b);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#share-suggestions .share-sugg-check { color: #6366f1; }
#share-suggestions .share-sugg-state {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    font-size: 0.88rem; line-height: 1.4;
    color: var(--text-muted, #64748b);
}
#share-suggestions .share-sugg-state.is-error { color: #dc2626; }

/* ── Share with Teacher: one clear light card in every theme (themes force navy headings) ── */
html body #shareModal .share-card {
    background: #ffffff !important;
    background-image: none !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.35) !important;
    color: #0f172a !important;
    border-radius: 24px !important;
}
html body #shareModal .share-card::before { display: none !important; }
html body #shareModal .modal-title-text,
html body #shareModal .modal-title-text i {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    background: none !important;
    text-shadow: none !important;
    opacity: 1 !important;
}
html body #shareModal .modal-title-text i { color: #4f46e5 !important; -webkit-text-fill-color: #4f46e5 !important; }
html body #shareModal .share-description { color: #475569 !important; -webkit-text-fill-color: #475569 !important; opacity: 1 !important; }
html body #shareModal .share-description span { color: #0f172a !important; -webkit-text-fill-color: #0f172a !important; font-weight: 700; }
html body #shareModal .label-modern { color: #334155 !important; -webkit-text-fill-color: #334155 !important; opacity: 1 !important; }
html body #shareModal .close-btn-modern { background: #f1f5f9 !important; color: #334155 !important; border: none !important; }
html body #shareModal .close-btn-modern:hover { background: #fee2e2 !important; color: #dc2626 !important; }
html body #shareModal #share-email-input {
    background: #f8fafc !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    border: 1.5px solid #e2e8f0 !important;
    caret-color: #4f46e5;
}
html body #shareModal #share-email-input::placeholder { color: #94a3b8 !important; -webkit-text-fill-color: #94a3b8 !important; }
html body #shareModal #share-email-input:focus { border-color: #4f46e5 !important; box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12) !important; background: #fff !important; }
html body #shareModal #share-suggestions { background: #ffffff !important; border: 1px solid #e2e8f0 !important; box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18) !important; }
html body #shareModal #share-suggestions .share-sugg-name { color: #0f172a !important; -webkit-text-fill-color: #0f172a !important; }
html body #shareModal #share-suggestions .share-sugg-email,
html body #shareModal #share-suggestions .share-sugg-state { color: #64748b !important; -webkit-text-fill-color: #64748b !important; }
html body #shareModal #share-suggestions .share-sugg-state.is-error { color: #dc2626 !important; -webkit-text-fill-color: #dc2626 !important; }
html body #shareModal #share-target-info { background: #eef2ff !important; }
html body #shareModal #share-target-name { color: #1e1b4b !important; -webkit-text-fill-color: #1e1b4b !important; }
html body #shareModal .modal-btn.cancel { background: #f1f5f9 !important; color: #334155 !important; -webkit-text-fill-color: #334155 !important; border: none !important; }
html body #shareModal .modal-btn.primary { background: #4f46e5 !important; color: #ffffff !important; -webkit-text-fill-color: #ffffff !important; border: none !important; }
html body #shareModal .modal-btn.primary.disabled { background: #c7d2fe !important; color: #ffffff !important; -webkit-text-fill-color: #ffffff !important; cursor: not-allowed; }
