/* =============================================================
   User Project Modal  —  "Add to Library / Kütüphaneme Ekle"
   Mobile  : bottom-sheet (slides up from bottom)
   Desktop : centered card (≥ 768 px)
   ============================================================= */

/* ─── Variables ─────────────────────────────────────────────── */
:root {
    --upl-blue: #105580;
    --upl-blue-dark: #0d4566;
    --upl-slate: #2D4F6C;
    --upl-orange: #fd8d00;
    --upl-border: #e5e7eb;
    --upl-hover-bg: #f9fafb;
    --upl-row-border: #f3f4f6;
    --upl-radius-card: 1.5rem; /* top corners on mobile */
    --upl-radius-list: 0.75rem;
    --upl-radius-btn: 0.75rem;
}

/* ─── Modal backdrop & container ────────────────────────────── */
.upl-modal {
    padding-right: 0 !important; /* kill Bootstrap's scrollbar offset */
}

/* ─── Dialog shell ───────────────────────────────────────────── */
.upl-modal__dialog {
    margin: 0;
    width: 100%;
    max-width: 100%;
    pointer-events: none;
}

/* ─── Content card ───────────────────────────────────────────── */
.upl-modal__content {
    pointer-events: auto;
    border: 0;
    border-radius: var(--upl-radius-card) var(--upl-radius-card) 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ─── Drag handle (mobile only) ─────────────────────────────── */
.upl-modal__drag-handle {
    width: 2.5rem;
    height: 4px;
    background: #d1d5db;
    border-radius: 9999px;
    margin: 0.75rem auto 0;
    flex-shrink: 0;
}

/* ─── Header ─────────────────────────────────────────────────── */
.upl-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem 0.5rem;
    flex-shrink: 0;
}

.upl-modal__header-spacer {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
}

.upl-modal__title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    text-align: center;
    flex: 1;
}

.upl-modal__close-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f3f4f6;
    color: #4b5563;
    border: 0;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.upl-modal__close-btn:hover {
    background: #e5e7eb;
    color: #111827;
}

/* ─── Body (scrollable inner) ────────────────────────────────── */
.upl-modal__body {
    padding: 0 1.5rem 2rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
}

/* ─── Scroll wrapper for project list ───────────────────────── */
.upl-modal__scroll {
    max-height: 40vh;
    overflow-y: auto;
}

/* ─── Project list (rendered by project/list.html.twig) ──────── */
.user-project-box .user-project-list__article-title {
    margin: 1rem 0 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--upl-slate);
    line-height: 1.45;
    text-align: center;
}

.user-project-list-content {
    border: 1px solid var(--upl-border);
    border-radius: var(--upl-radius-list);
    overflow: hidden;
    margin-bottom: 1rem;
}

.user-project-list__item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.8rem 1rem;
    background: #fff;
    border: 0;
    border-bottom: 1px solid var(--upl-row-border);
    cursor: pointer;
    font-size: 0.9375rem;
    text-align: left;
    transition: background 0.12s ease;
}

.user-project-list__item:last-child {
    border-bottom: 0;
}

.user-project-list__item:hover,
.user-project-list__item:focus {
    background: var(--upl-hover-bg);
    outline: none;
}

.user-project-list__icon {
    font-size: 1rem;
    width: 1.5rem;
    margin-right: 0.75rem;
    color: var(--upl-blue);
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.user-project-list__item:hover .user-project-list__icon {
    transform: scale(1.15);
}

.user-project-list__icon--check {
    color: #10b981;
}

.user-project-list__label {
    font-weight: 500;
    color: #111827;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-project-list__label.text-success {
    color: #10b981 !important;
}

/* ─── Favorites section (rendered by favorite_article_modal_view) ─ */
.upl-modal__favorites-wrap {
    margin-top: 0;
}

/* Added via JS when the project-list feature is enabled (separator line) */
.upl-modal__favorites-wrap--bordered {
    border-top: 1px solid var(--upl-row-border);
    padding-top: 0.25rem;
}

/* Favorites container rendered by the AJAX view */
.upl-modal__favorites-wrap .upl-favorite-box {
    border: 1px solid var(--upl-border);
    border-radius: var(--upl-radius-list);
    overflow: hidden;
    margin-bottom: 1rem;
}

.user-project-favorite__article-title {
    margin: 1rem 0 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--upl-slate);
    line-height: 1.45;
}

.user-project-favorite__item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.8rem 1rem;
    background: #fff;
    border: 0;
    cursor: pointer;
    font-size: 0.9375rem;
    text-align: left;
    transition: background 0.12s ease;
}

.user-project-favorite__item:hover,
.user-project-favorite__item:focus {
    background: var(--upl-hover-bg);
    outline: none;
}

.user-project-favorite__icon {
    font-size: 1rem;
    width: 1.5rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.user-project-favorite__item:hover .user-project-favorite__icon {
    transform: scale(1.15);
}

.user-project-favorite__icon--active {
    color: var(--upl-orange);
}

.user-project-favorite__icon--inactive {
    color: var(--upl-blue);
}

.user-project-favorite__label {
    font-weight: 500;
}

.user-project-favorite__label--active {
    color: var(--upl-orange);
}

.user-project-favorite__label--inactive {
    color: #111827;
}

.user-project-favorite__spinner {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--upl-orange);
    margin-right: 0.75rem;
    flex-shrink: 0;
}

/* ─── Action buttons ─────────────────────────────────────────── */
.upl-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-top: 0.25rem;
}

.upl-modal__btn-create {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--upl-blue);
    color: #fff !important;
    font-size: 0.9375rem;
    font-weight: 600;
    border: 0;
    border-radius: var(--upl-radius-btn);
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: background 0.15s ease;
}

.upl-modal__btn-create:hover {
    background: var(--upl-blue-dark);
    color: #fff !important;
}

.upl-modal__btn-close {
    width: 100%;
    padding: 0.625rem 1rem;
    background: transparent;
    color: var(--upl-blue);
    font-size: 0.9375rem;
    font-weight: 600;
    border: 0;
    cursor: pointer;
    transition: color 0.15s ease;
}

.upl-modal__btn-close:hover {
    color: var(--upl-blue-dark);
}

/* ─── MOBILE  (< 768 px)  :  bottom-sheet ───────────────────── */
@media (max-width: 767.98px) {

    /*
     * Bootstrap sets display:block inline via JS when showing the modal.
     * We override the inner dialog positioning instead — the modal backdrop
     * stays full-screen and the dialog card sits at the bottom via flex
     * applied to a wrapper class we add via JS.
     */
    .upl-modal__dialog {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        width: 100%;
        max-width: 100%;
        /* Slide-up entry animation */
        transform: translateY(8px);
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1),
        opacity 0.28s ease;
    }

    .upl-modal.show .upl-modal__dialog {
        transform: translateY(0);
    }

    .upl-modal__content {
        border-radius: var(--upl-radius-card) var(--upl-radius-card) 0 0;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
    }

    .upl-modal__drag-handle {
        display: block;
    }

    .upl-modal__scroll {
        max-height: 35vh;
    }
}

/* ─── DESKTOP  (≥ 768 px)  :  centered card ─────────────────── */
@media (min-width: 768px) {

    .upl-modal__drag-handle {
        display: none;
    }

    .upl-modal__dialog {
        margin: 1.75rem auto;
        max-width: 440px;
        width: 100%;
        /* Remove the slide-up; just let Bootstrap's default fade handle it */
        transform: none !important;
        transition: none;
    }

    .upl-modal__content {
        border-radius: 1rem;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
        max-height: 80vh;
    }

    .upl-modal__scroll {
        max-height: 45vh;
    }
}
