/* CSS Variables */
:root {
  --primary-font: "Oswald", sans-serif;
  --secondary-font: "Limelight", serif;
  --primary-color: #ffffff;
  --secondary-color: #000000; 
  --body-background-color: #2f3c4b;
  --card-background-colour: #1a1a1a;
  --rating-color: #ffcf33;
  --hover-color: #99ffee;
  --search-button-color: #3700ff;
  --divider-color: #7a7a7a3d;
  --shadow-color: #0000006c;
  --primary-color-transparent: #ffffff8c;
}

/* Shelf Row & Scroll Layout */

.shelf-wrapper {
    position: relative;
}

.shelf-row {
    display: flex;
    gap: 22px;
    overflow-x: auto;
    padding: 0 60px 14px;
    scroll-behavior: smooth;
}

.shelf-row::-webkit-scrollbar {
    height: 8px;
}
.shelf-row::-webkit-scrollbar-thumb {
    background: var(--hover-color);
    border-radius: 4px;
}

/* Shelf Card */

.shelf-card {
    width: 160px;
    flex-shrink: 0;
    background: var(--card-background-colour);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 0 12px var(--shadow-color);
    border: 1px solid var(--secondary-color);
    justify-content: space-between;
}

/* Poster */

.shelf-card img {
    width: 140px;
    height: 210px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 6px;
}

/* Title (fixed height + scrollable) */

.shelf-title {
    font-size: 14px;
    font-weight: bold;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    text-align: center;
    width: 140px; /* consistent width */
    height: 60px; /* fixed height for alignment */
    overflow-y: auto; /* scroll only if text too long */
    padding-right: 4px;
    margin: 0 auto 10px;
}

/* Scrollbar styling for long titles */

.shelf-title::-webkit-scrollbar {
    width: 4px;
}
.shelf-title::-webkit-scrollbar-thumb {

    background: var(--hover-color);
    border-radius: 4px;
}

/* Buttons stay aligned at bottom */
.shelf-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

/* Scroll Arrows */

.scroll-left,
.scroll-right {
    position: absolute;
    top: 0;
    width: 45px;
    height: 100%;
    display: none;
    cursor: pointer;
    z-index: 5;
}

@media (pointer: fine) {
    .scroll-left,
    .scroll-right {
        display: block;
    }
}

.scroll-left {
    left: 0;
    background: linear-gradient(to right, var(--shadow-color), transparent);
}

.scroll-right {
    right: 0;
    background: linear-gradient(to left, var(--shadow-color), transparent);
}

.scroll-left::after,
.scroll-right::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    opacity: 0.8;
    pointer-events: none;
}

.scroll-left::after {
    left: 10px;
    border-top: 4px solid var(--primary-color);
    border-left: 4px solid var(--primary-color);
    transform: translateY(-50%) rotate(-45deg);
}

.scroll-right::after {
    right: 10px;
    border-top: 4px solid var(--primary-color);
    border-right: 4px solid var(--primary-color);
    transform: translateY(-50%) rotate(45deg);
}

.scroll-left:hover::after,
.scroll-right:hover::after {
    opacity: 1;
}

/* Accordion */

.accordion-item {
    margin-top: 20px;
    border: 1px solid var(--secondary-color);
    border-radius: 6px;
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    background: var(--secondary-color);
    color: var(--primary-color);
    padding: 12px;
    text-align: left;
    border: none;
    font-size: 18px;
    cursor: pointer;
    position: relative;
}

.accordion-header::after {
    content: "▼";
    position: absolute;
    right: 14px;
    transition: transform 0.3s;
}

.accordion-item.open .accordion-header::after {
    transform: rotate(180deg);
}

.accordion-content {
    background: var(--card-background-colour);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    padding: 0 12px;
}

.accordion-item.open .accordion-content {
    max-height: 900px;
    padding: 12px;
}

/*  WATCHED SHELF (FIXED ALIGNMENT) */

.watched-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 410px;
    position: relative;
}

/* Poster */

.watched-card img {
    margin-bottom: 6px;
}

/* Fixed-size scrollable title */

.watched-card .shelf-title {
    width: 140px;
    height: 60px; /* fixed height to align all cards */
    overflow-y: auto;
    text-align: center;
    padding-right: 4px;
    margin: 0 auto 8px;
}

/* buttons fixed above the yellow button */

.watched-card .rating-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
    margin-bottom: 6px;
}

/* Shelf buttons stay stacked below */

.watched-card .shelf-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.watched-card .btn {
    font-size: 14px;
    padding: 4px 10px;
}

/* Rating buttons */

.rating-btn {
    background: transparent;
    border: 2px solid var(--primary-color);
    padding: 6px;
    margin-top: 10px;
    border-radius: 6px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rating-btn img {
    width: 22px;
    height: 22px;
}

/* Active states */
.rating-btn.up.active {
    background: #198754; /* Bootstrap success */
    border-color: #198754;
}

.rating-btn.down.active {
    background: #dc3545; /* Bootstrap danger */
    border-color: #dc3545;
}

/* ============================
   MOBILE FIX — Reduce side padding
============================ */
@media (max-width: 768px) {
    .shelf-row {
        padding: 0 10px 14px;   /* was 60px — now fits mobile screens */
        gap: 16px;              /* slightly smaller gap for narrow view */
    }

    .shelf-card {
        width: 150px;           /* Fits more naturally */
    }
}