.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.show-modal-overlay {
    opacity: 1;
    visibility: visible;
}

.modal-overlay .modal-content {
    background: var(--panel);
    border-radius: var(--radius);
    width: 90%;
    max-width: 850px;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    transform: scale(0.85);
    transition: transform 0.3s ease;
    color: var(--text);
}

.modal-overlay.show-modal-overlay .modal-content {
    transform: scale(1);
}

.modal-overlay .modal-header {
    background: linear-gradient(135deg, var(--accent) 0%, #764ba2 100%);
    color: #fff;
    padding: 18px 20px;
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-overlay .modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.modal-overlay .modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

/* Notes Content */
.modal-overlay .notes-content {
    padding: 1.2rem;
    line-height: 1.6;
}

.modal-overlay .notes-content h3 {
    color: var(--accent);
    margin: 25px 0 12px 0;
    font-size: 1.25rem;
    border-bottom: 2px solid var(--accent-weak);
    padding-bottom: 6px;
}

.modal-overlay .notes-content h3:first-child {
    margin-top: 0;
}

.modal-overlay .notes-content p {
    color: var(--muted);
    margin-bottom: 15px;
    text-align: justify;
}

.modal-overlay .complexity-box {
    background: var(--accent-weak);
    border-left: 4px solid var(--accent);
    padding: 15px;
    margin: 20px 0;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.modal-overlay .complexity-box strong {
    color: var(--accent);
}

.modal-overlay .algorithm-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: var(--radius);
    margin: 20px 0;
    box-shadow: var(--shadow);
}

.modal-overlay .steps-list {
    background: var(--accent-weak);
    padding: 20px;
    border-radius: var(--radius);
    margin: 20px 0;
}

.modal-overlay ol,
.modal-overlay ul {
    padding-left: 20px;
}

.modal-overlay .steps-list li {
    margin-bottom: 10px;
    color: var(--text);
}

.modal-overlay .use-cases {
    background: var(--bg);
    padding: 20px;
    border-radius: var(--radius);
    margin: 20px 0;
    border: 1px solid var(--border);
}

.modal-overlay .use-cases li {
    margin-bottom: 8px;
    color: var(--muted);
}

.modal-overlay .code-example {
    background: #111827;
    color: var(--text);
    padding: 20px;
    border-radius: var(--radius);
    margin: 20px 0;
    font-family: 'Courier New', monospace;
    overflow-x: auto;
    border: 1px solid var(--border);
}

.modal-overlay .links-section {
    display: flex;
    gap: 15px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.modal-overlay .link-btn {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.3s ease;
    display: inline-block;
}

.modal-overlay .link-btn:hover {
    background: #5a67d8;
}




.toast-container.event {
    position: fixed;
    max-height: 20%;
    top: 10vh;
    right: 0;
    z-index: 10;
    padding: 1rem;
    overflow: hidden;
    border-radius: 12px;
    transition: all 0.3s ease;
}


.toast-container.steps {
    position: absolute;
    bottom: 0vh;
    max-height: 80vh;;
    min-height: 3.6rem;
    height: 3.6rem;
    width: 100%;
    border-radius: 12px;

    padding: 0.5rem;
    border: 1px solid #6878e1;
    background: #0f1116;
    transition: box-shadow 0.3s ease;
}

.toast-container.steps:hover {
    box-shadow: 0cap 6px 16px 0px #746acf;
    border: 2px dashed #6878e1;
}



.toast-container .inner-container,
.event-toast-container .inner-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast-container.hide {
    max-width: 0;
    padding: 0;
    margin: 0;
    opacity: 0;
}



.toast-container .show-toast,
.event-toast-container .show-toast {
    opacity: 1;
    transform: translateX(0);
}


.toast-container h3 {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.6rem;
    border-radius: 12px;
    color: white;
        background: linear-gradient(90deg, var(--accent), #8a6cff);
    background-size: 200% 200%;
    /* larger than container */
    background-position: left center;
    cursor: n-resize;
    transition: background-position 1s ease;
}

.scrollable-content {
    overflow-y: scroll;
    overflow-x: hidden;
    height: calc(100% - 3rem);
    border-radius: 12px;
    margin-top: 0.5rem;
}

#toastList,
.toast-inner {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}


.toast-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
    border-radius: 13px;
    backdrop-filter: blur(100px);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    padding: 0.75rem 1rem;
    opacity: 0;
    transform: translateX(400px);
    border-left: 6px solid transparent;

    transition:
        opacity 0.3s ease,
        transform 0.4s ease,
        max-height 0.5s ease,
        padding 0.5s ease,
        margin 0.5s ease;
}

.toast-wrapper:first-child {
    margin-top: 0.5rem;
}

.toast-wrapper.hide-toast {
    max-height: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
}

.toast-wrapper.paused::after {
    animation-play-state: paused;
}

.progress-bar {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 5px;
    background: #6878e1;
    border-radius: 13px;
    animation: progress 5s linear forwards;
}

@keyframes progress {
    100% {
        width: 0;
    }
}


.toast {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    padding: 0.5rem;
    max-width: 25rem;
    overflow: hidden;
    margin: 0 0 0 12px;
    background: transparent;
}

.scrollable-content .toast {
    max-width: 100%;
}


.toast-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.toast-message {
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 18px;
}

.toast-icon {
    font-size: 2rem;
    color: #6878e1;
}

/* SUCCESS */
.toast-wrapper.success {
    border-left-color: #4CAF50;
    background: linear-gradient(120deg, rgba(76, 175, 80, 0.3), rgba(255, 255, 255, 0.05));
    color: #DFFFE2;
}

.toast-wrapper.success::after {
    background: #4CAF50;
}


/* ERROR */
.toast-wrapper.error {
    border-left-color: #E53935;
    background: linear-gradient(120deg, rgba(229, 57, 53, 0.3), rgba(255, 255, 255, 0.05));
    color: #FFE4E4
}

.toast-wrapper.error::after {
    background: #E53935;
}

/* WARNING */
.toast-wrapper.warning {
    border-left-color: #FFC107;
    background: linear-gradient(120deg, rgba(255, 193, 7, 0.3), rgba(255, 255, 255, 0.05));
    color: #FFF4E0;
}

.toast-wrapper.warning::after {
    background: #FFC107;
}

/* INFO */
.toast-wrapper.info {
    border-left-color: #2196F3;
    background: linear-gradient(120deg, rgba(33, 150, 243, 0.3), rgb(130 115 255 / 13%));
    color: #E0E6F6;
}

.toast-wrapper.info::after {
    background: #2196F3;
}



@media (max-width: 768px) {
    .modal-overlay h1 {
        font-size: 2rem;
    }

    .modal-overlay .algorithm-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }

    .modal-overlay .algorithm-btn {
        padding: 15px;
        font-size: 1rem;
    }

    .modal-overlay .modal-content {
        width: 95%;
    }

    .modal-overlay .modal-header {
        padding: 15px;
    }

    .modal-overlay .notes-content {
        padding: 15px;
    }

    .modal-overlay .notes-content h3 {
        font-size: 1.15rem;
    }

    .modal-overlay .links-section {
        flex-direction: column;
    }

    .toast-container.steps {
        width: 100%;
        min-height: 3rem;
        height: 3rem;
    }

    .toast-container h3 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .modal-overlay .modal-header h2 {
        font-size: 1.2rem;
    }

    .modal-overlay .notes-content {
        padding: 15px;
    }

    .modal-overlay .notes-content h3 {
        font-size: 1rem;
    }
}

