/* ═══════════════════════════════════════════════════════════
   screens-menu-library.css — Library interaction screen
   Purple/cozy scholarly theme with #8e44ad accent
   ═══════════════════════════════════════════════════════════ */

/* ─── Container ──────────────────────────────────────── */

.libraryInteractionContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 1.5rem 2rem;
    gap: 1rem;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow-y: auto;
}

.libraryInteractionContainer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgb(106 13 173 / 65%) 0%, rgb(106 13 173 / 45%) 50%, rgb(30 10 50 / 80%) 100%);
    pointer-events: none;
    z-index: 0;
}

.libraryInteractionContainer > * {
    position: relative;
    z-index: 1;
}

.libraryInteractionContainer h2 {
    font-size: 2rem;
    color: #fff;
    text-shadow: 0 2px 12px rgb(106 13 173 / 60%);
    margin-bottom: 0.25rem;
    letter-spacing: 2px;
}

/* ─── Needs Panel (character portrait + bars) ────────── */

.libraryNeedsPanel {
    display: flex;
    gap: 1.5rem;
    background: rgb(0 0 0 / 55%);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    width: 100%;
    max-width: 700px;
    border: 1px solid rgb(142 68 173 / 40%);
    box-shadow: 0 4px 24px rgb(0 0 0 / 30%);
}

.libraryNeedsChar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 180px;
}

.libraryNeedsCharImg {
    width: 64px;
    height: 80px;
    object-fit: contain;
    border-radius: 10px;
    background: rgb(255 255 255 / 5%);
    border: 2px solid rgb(142 68 173 / 50%);
}

.libraryNeedsCharInfo {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.libraryNeedsCharName {
    font-weight: bold;
    font-size: 1rem;
    color: #e8d5f5;
}

.libraryNeedsCharLevel {
    font-size: 0.8rem;
    color: rgb(255 255 255 / 60%);
}

.libraryNeedsCharMood {
    font-size: 0.8rem;
    color: rgb(200 160 240 / 80%);
}

.libraryNeedsBars {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}

.libraryNeedBarRow {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
}

.libraryNeedBarIcon {
    width: 16px;
    text-align: center;
    font-size: 0.75rem;
}

.libraryNeedBarLabel {
    width: 44px;
    font-size: 0.65rem;
    color: rgb(255 255 255 / 65%);
    text-align: right;
}

.libraryNeedBarTrack {
    flex: 1;
    height: 10px;
    background: rgb(255 255 255 / 10%);
    border-radius: 6px;
    overflow: hidden;
}

.libraryNeedBar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.4s ease;
}

.libraryNeedBarHunger {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}
.libraryNeedBarFun {
    background: linear-gradient(90deg, #f39c12, #e67e22);
}
.libraryNeedBarSocial {
    background: linear-gradient(90deg, #3498db, #2980b9);
}
.libraryNeedBarHygiene {
    background: linear-gradient(90deg, #1abc9c, #16a085);
}
.libraryNeedBarEnergy {
    background: linear-gradient(90deg, #f1c40f, #f39c12);
}

.libraryNeedBar.low {
    animation: libraryLowPulse 1s infinite;
}

@keyframes libraryLowPulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.libraryNeedBar.heal-flash {
    animation: libraryHealFlash 0.6s ease;
}

@keyframes libraryHealFlash {
    0% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.8) drop-shadow(0 0 6px rgb(81 207 102 / 60%));
    }
    100% {
        filter: brightness(1);
    }
}

.libraryNeedBarValue {
    width: 24px;
    text-align: right;
    font-size: 0.65rem;
    color: rgb(255 255 255 / 70%);
    font-variant-numeric: tabular-nums;
}

.libraryNeedBarValue.flash-green {
    animation: libraryValFlash 0.5s ease;
}

@keyframes libraryValFlash {
    0% {
        color: inherit;
    }
    50% {
        color: #51cf66;
        font-weight: bold;
    }
    100% {
        color: inherit;
    }
}

/* ─── Activities Grid ────────────────────────────────── */

.libraryActivitiesGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    width: 100%;
    max-width: 700px;
}

.libraryActivityCard {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 1.2rem 0.8rem 0.8rem;
    background: linear-gradient(145deg, rgb(142 68 173 / 25%), rgb(106 13 173 / 15%));
    border: 1px solid rgb(142 68 173 / 35%);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    overflow: hidden;
}

.libraryActivityCard::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgb(142 68 173 / 0%) 0%, rgb(200 160 240 / 5%) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.libraryActivityCard:not(.used):hover {
    transform: translateY(-3px);
    border-color: rgb(142 68 173 / 70%);
    box-shadow:
        0 6px 20px rgb(106 13 173 / 30%),
        inset 0 1px 0 rgb(255 255 255 / 10%);
}

.libraryActivityCard:not(.used):hover::before {
    opacity: 1;
}

.libraryActivityCard:not(.used):active {
    transform: translateY(1px) scale(0.97);
    transition: all 0.05s ease;
}

.libraryActivityCard.used {
    opacity: 0.45;
    cursor: default;
    filter: grayscale(0.6);
}

.libraryActivityEmoji {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 0.2rem;
}

.libraryActivityName {
    font-weight: bold;
    font-size: 0.95rem;
    color: #e8d5f5;
}

.libraryActivityDesc {
    font-size: 0.72rem;
    color: rgb(255 255 255 / 55%);
    line-height: 1.3;
}

.libraryActivityCost {
    font-size: 0.8rem;
    font-weight: bold;
    color: #f1c40f;
    margin-top: 0.15rem;
}

.libraryActivityEffect {
    font-size: 0.72rem;
    color: rgb(142 68 173 / 90%);
    background: rgb(142 68 173 / 15%);
    padding: 2px 10px;
    border-radius: 100px;
    font-weight: 600;
    margin-top: 0.1rem;
}

.libraryActivityUsed {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.65rem;
    font-weight: bold;
    color: #51cf66;
    background: rgb(81 207 102 / 15%);
    padding: 2px 8px;
    border-radius: 100px;
    display: none;
}

.libraryActivityCard.used .libraryActivityUsed {
    display: block;
}

/* ─── Bottom bar ─────────────────────────────────────── */

.libraryBottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 700px;
    margin-top: 0.5rem;
}

.libraryMoneyDisplay {
    font-size: 1.1rem;
    font-weight: bold;
    color: #f1c40f;
    text-shadow: 0 1px 6px rgb(0 0 0 / 50%);
}

.libraryLeaveBtn {
    padding: 0.7rem 1.8rem;
    font-size: 0.95rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    background: linear-gradient(135deg, #8e44ad, #6c3483);
    color: #fff;
    transition: all 0.2s ease;
    box-shadow: 0 3px 12px rgb(106 13 173 / 40%);
    letter-spacing: 0.5px;
}

.libraryLeaveBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 18px rgb(106 13 173 / 55%);
    filter: brightness(1.1);
}

.libraryLeaveBtn:active {
    transform: translateY(1px) scale(0.97);
    transition: all 0.05s ease;
}

/* ─── Responsive adjustments ──────────────────────────── */

@media (max-width: 600px) {
    .libraryInteractionContainer {
        padding: 1rem;
    }

    .libraryNeedsPanel {
        flex-direction: column;
        gap: 0.75rem;
    }

    .libraryNeedsChar {
        min-width: unset;
    }

    .libraryActivitiesGrid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 400px) {
    .libraryActivitiesGrid {
        grid-template-columns: 1fr;
    }
}
