
/* ===========================
GLOBAL MODAL SYSTEM
=========================== */

#globalModal {
    position: relative;
}


/* ===========================
MODAL OVERLAY
=========================== */

.modal-overlay {

    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: .25s ease;
    z-index: 99999;
}


.modal-overlay.active {

    opacity: 1;

    visibility: visible;

    pointer-events: auto;

}


/* ===========================
MODAL CONTAINER
=========================== */

.modal-container {

    width: min(500px, 100%);

    max-height: 90vh;

    overflow-y: auto;

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: 20px;

    padding: 2rem;

    transform: scale(.95);

    transition: .25s ease;

    box-shadow:
        0 25px 80px rgba(0, 0, 0, .45);

}


.modal-overlay.active .modal-container {

    transform: scale(1);

}


/* ===========================
MODAL HEADER
=========================== */

.modal-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 1rem;

    margin-bottom: 1rem;

}


.modal-title {

    margin: 0;

    font-size: 1.4rem;

    color: var(--text);

}


.modal-close {

    width: 36px;

    height: 36px;

    display: flex;

    align-items: center;

    justify-content: center;

    background: rgba(255,255,255,.05);

    border: none;

    border-radius: 10px;

    color: var(--text);

    font-size: 1.5rem;

    cursor: pointer;

    transition: .2s ease;

}


.modal-close:hover {

    background: rgba(255,255,255,.1);

    transform: rotate(90deg);

}


/* ===========================
MODAL CONTENT
=========================== */

.modal-content {

    color: var(--text);

    line-height: 1.5;

}


.modal-content p {

    margin: 0 0 1rem;

}


/* ===========================
LIST OPTIONS
=========================== */

.modal-list-container {

    display: flex;

    flex-direction: column;

    gap: .65rem;

    margin-top: 1rem;

    max-height: 300px;

    overflow-y: auto;
    overflow-x: hidden;

}


.modal-list-option {

    width: 100%;

    padding: .9rem 1rem;

    border: 1px solid transparent;

    border-radius: 12px;

    background: rgba(255,255,255,.05);

    color: var(--text);

    text-align: left;

    cursor: pointer;

    transition: .2s ease;
    overflow: hidden;

}


.modal-list-option:hover {

    background: rgba(139,92,246,.15);

    border-color: rgba(139,92,246,.35);

    transform: translateX(3px);

}


/* ===========================
CREATE LIST BUTTON
=========================== */

.modal-create-list-btn {

    width: 100%;

    margin-top: 1rem;

    padding: .9rem 1rem;

    border: 1px dashed rgba(139,92,246,.5);

    border-radius: 12px;

    background: rgba(139,92,246,.08);

    color: #b892ff;

    font-weight: 600;

    cursor: pointer;

    transition: .2s ease;

}


.modal-create-list-btn:hover {

    background: rgba(139,92,246,.16);

    border-color: #8b5cf6;

}


/* ===========================
CREATE LIST FORM
=========================== */

.create-list-form {

    display: flex;

    flex-direction: column;

    gap: .6rem;

}


.create-list-form label {

    margin-top: .5rem;

    color: var(--text);

    font-size: .9rem;

    font-weight: 600;

}


.create-list-form input,
.create-list-form textarea {

    width: 100%;

    box-sizing: border-box;

    padding: .85rem 1rem;

    border: 1px solid var(--border);

    border-radius: 12px;

    background: rgba(255,255,255,.05);

    color: var(--text);

    outline: none;

    font: inherit;

    transition: .2s ease;

}


.create-list-form textarea {

    min-height: 110px;

    resize: vertical;

}


.create-list-form input::placeholder,
.create-list-form textarea::placeholder {

    color: rgba(255,255,255,.4);

}


.create-list-form input:focus,
.create-list-form textarea:focus {

    border-color: #8b5cf6;

    background: rgba(139,92,246,.07);

    box-shadow:
        0 0 0 3px rgba(139,92,246,.1);

}


/* ===========================
CREATE LIST SUBMIT
=========================== */

.modal-create-submit {

    width: 100%;

    margin-top: 1rem;

    padding: .9rem 1rem;

    border: none;

    border-radius: 12px;

    background: #8b5cf6;

    color: white;

    font-weight: 700;

    cursor: pointer;

    transition: .2s ease;

}


.modal-create-submit:hover {

    background: #7c3aed;

    transform: translateY(-1px);

}


.modal-create-submit:disabled {

    opacity: .6;

    cursor: not-allowed;

    transform: none;

}


/* ===========================
SHARE MODAL
=========================== */

.share-link-input {

    width: 100%;

    box-sizing: border-box;

    padding: .85rem 1rem;

    margin-top: .5rem;

    border: 1px solid var(--border);

    border-radius: 12px;

    background: rgba(255,255,255,.05);

    color: var(--text);

    outline: none;

    font-size: .9rem;

}


.share-actions {

    display: flex;

    gap: .75rem;

    margin-top: 1rem;

}


.share-copy-btn,
.share-native-btn {

    flex: 1;

    padding: .85rem 1rem;

    border: none;

    border-radius: 12px;

    cursor: pointer;

    font-weight: 600;

    transition: .2s ease;

}


.share-copy-btn {

    background: rgba(255,255,255,.07);

    color: var(--text);

}


.share-native-btn {

    background: #8b5cf6;

    color: white;

}


.share-copy-btn:hover {

    background: rgba(255,255,255,.12);

}


.share-native-btn:hover {

    background: #7c3aed;

    transform: translateY(-1px);

}











/* ===========================
   LIBRARY LIST MODAL
=========================== */

.library-list-modal {

    display:grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(170px, 1fr)
        );

    gap:1rem;

    max-height:65vh;

    overflow-y:auto;

    overflow-x:hidden;

    padding:.5rem;

}


/* ===========================
   LIBRARY ANIME CARD
=========================== */

.library-anime-card {

    position:relative;

    background:var(--surface);

    border:1px solid var(--border);

    border-radius:16px;

    overflow:hidden;

    min-width:0;

    transition:
        transform .2s ease,
        border-color .2s ease,
        box-shadow .2s ease;

}


.library-anime-card:hover {

    transform:translateY(-4px);

    border-color:
        rgba(139,92,246,.45);

    box-shadow:
        0 10px 30px
        rgba(0,0,0,.25);

}


/* ===========================
   LIBRARY ANIME IMAGE
=========================== */

.library-anime-card img {

    display:block;

    width:100%;

    aspect-ratio:2 / 3;

    object-fit:cover;

}


/* ===========================
   CARD CONTENT
=========================== */

.library-anime-content {

    padding:.8rem;

}


/* ===========================
   TITLE ROW
=========================== */

.library-anime-title-row {

    display:flex;

    align-items:center;

    gap:.5rem;

}


.library-anime-title-row h3 {

    flex:1;

    min-width:0;

    margin:0;

    color:var(--text);

    font-size:.9rem;

    font-weight:600;

    line-height:1.3;

    white-space:nowrap;

    overflow:hidden;

    text-overflow:ellipsis;

}


/* ===========================
   THREE DOT MENU
=========================== */

.library-anime-menu {

    display:flex;

    align-items:center;

    justify-content:center;

    flex-shrink:0;

    width:30px;

    height:30px;

    padding:0;

    border:none;

    border-radius:8px;

    background:transparent;

    color:var(--text);

    font-size:1.25rem;

    line-height:1;

    cursor:pointer;

    transition:
        background .2s ease,
        color .2s ease;

}


.library-anime-menu:hover {

    background:
        rgba(255,255,255,.08);

    color:#b892ff;

}


/* ===========================
   EMPTY LIST
=========================== */

.empty-list {

    grid-column:1 / -1;

    margin:0;

    padding:3rem 1rem;

    text-align:center;

    color:
        var(--text-muted, #999);

}


/* ===========================
   MODAL SCROLLBAR
=========================== */

.library-list-modal {

    scrollbar-width:thin;

    scrollbar-color:
        rgba(139,92,246,.55)
        transparent;

}


.library-list-modal::-webkit-scrollbar {

    width:6px;

}


.library-list-modal::-webkit-scrollbar-track {

    background:transparent;

}


.library-list-modal::-webkit-scrollbar-thumb {

    background:
        rgba(139,92,246,.55);

    border-radius:999px;

}


.library-list-modal::-webkit-scrollbar-thumb:hover {

    background:
        rgba(139,92,246,.8);

}


/* ===========================
   MOBILE
=========================== */

@media (max-width:600px) {

    .library-list-modal {

        grid-template-columns:
            repeat(
                2,
                minmax(0,1fr)
            );

        gap:.75rem;

        max-height:65vh;

    }


    .library-anime-content {

        padding:.65rem;

    }


    .library-anime-title-row h3 {

        font-size:.8rem;

    }

}