.item-details {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    overflow-y: auto;
    background: var(--primary);
    z-index: 1035;
    clip-path: inset(0 0 0 0);
}

.item-details.active {
    display: block;
}

.back-button {
    position: absolute;
    top: 2rem;
    left: 2rem;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 42px;
    height: 42px;
    background: var(--glass);
    color: var(--text-primary);
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    transition: var(--transition);
}

.back-button:hover {
    background: var(--accent);
    color: var(--primary);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 224, 255, 0.3);
}

.details-backdrop-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60vh;
    overflow: hidden;
    z-index: 0;
}

.details-backdrop-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    opacity: 0.4;
}

.details-backdrop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, var(--primary) 15%, transparent 50%),
                linear-gradient(to right, var(--primary) 10%, transparent 70%);
}

.item-details-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    padding: 8rem 2rem 5rem;
}

.item-details-header {
    display: flex;
    flex-direction: row;
    gap: 3rem;
    margin-bottom: 3rem;
    align-items: flex-start;
}

.item-details-poster-wrapper {
    flex-shrink: 0;
    width: 100%;
    max-width: 320px;
}

.item-details-poster {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.item-details-poster:hover {
    transform: scale(1.03);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

#item-details-content {
    opacity: 0;
}

.item-details-content {
    flex: 1;
    min-width: 0;
}

.item-details-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.item-details-tagline {
    font-size: 1.2rem;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-weight: 300;
}

.item-details-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.8rem;
    margin-bottom: 1.8rem;
    font-size: 0.95rem;
}

.item-details-meta-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-secondary);
}

.item-details-meta-item i {
    color: var(--accent);
    font-size: 1.05rem;
}

.item-details-overview {
    font-size: 1.05rem;
    margin-bottom: 2rem;
    line-height: 1.8;
    color: rgba(240, 240, 245, 0.85);
}

.item-details-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1.8rem;
}

.genre-badge {
    padding: 0.5rem 1.1rem;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    transition: var(--transition);
    cursor: default;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.item-details-crew p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.item-details-crew strong {
    color: var(--text-primary);
    margin-right: 0.5em;
}

.item-details-external-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    font-size: 0.85rem;
    background: var(--glass);
    transition: var(--transition);
}

.item-details-external-links a:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(0, 224, 255, 0.1);
}

.item-details-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
}

.item-details-section {
    margin-bottom: 3.5rem;
}

.cast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1.8rem;
}

.cast-card {
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: var(--secondary);
    padding: 1rem;
    border-radius: var(--border-radius-md);
}

.cast-card:hover {
    transform: translateY(-8px);
    background: var(--glass);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.cast-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem auto;
    border: 3px solid var(--glass-border);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.cast-card:hover .cast-photo {
    transform: scale(1.05);
    border-color: var(--accent);
    box-shadow: 0 6px 18px rgba(0, 224, 255, 0.25);
}

.cast-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

.cast-character {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.similar-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
}

.similar-item-card {
    background: transparent;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.similar-item-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.similar-item-card:hover .similar-item-poster {
    transform: scale(1.05);
}

.similar-item-poster {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--border-radius-md);
    aspect-ratio: 2 / 3;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.similar-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(to top, rgba(10, 10, 15, 0.95) 0%, transparent 100%);
    border-bottom-left-radius: var(--border-radius-md);
    border-bottom-right-radius: var(--border-radius-md);
}

.similar-item-title {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.seasons-accordion .accordion-item {
    background: transparent;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--glass-border);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.seasons-accordion .accordion-button {
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1.1rem;
    padding: 1.2rem 1.5rem;
    border: none;
    box-shadow: none !important;
    transition: background-color 0.3s ease;
}

.seasons-accordion .accordion-button:not(.collapsed) {
    background: var(--glass);
    color: var(--accent);
    border-bottom: 1px solid var(--glass-border);
}

.seasons-accordion .accordion-button:hover {
    background: var(--glass);
}

.seasons-accordion .accordion-button::after {
    filter: brightness(0) invert(1) opacity(0.7);
    transition: transform 0.3s ease;
}

.seasons-accordion .accordion-button:not(.collapsed)::after {
    filter: invert(1) opacity(1) brightness(1.5) contrast(200%);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2300e0ff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

.seasons-accordion .accordion-collapse {
    overflow: hidden;
    transition: height 0.35s ease;
}

.season-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.season-poster {
    width: 70px;
    height: 105px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
    flex-shrink: 0;
}

.season-details {
    flex-grow: 1;
    min-width: 0;
}

.season-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.season-meta {
    display: flex;
    gap: 1.2rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.season-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.season-overview {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.season-episodes {
    padding: 1rem 1.5rem;
    background: var(--secondary);
    border-top: 1px solid var(--glass-border);
    max-height: 500px;
    overflow-y: auto;
}

.episode-card {
    display: flex;
    gap: 1rem;
    padding: 1.2rem 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    transition: background-color 0.3s ease;
}

.episode-card:last-child {
    border-bottom: none;
    padding-bottom: 0.5rem;
}

.episode-card:first-child {
    padding-top: 0.5rem;
}

.episode-card:hover {
    background: var(--glass);
}

.episode-number {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 1rem;
    margin-top: 5px;
}

.episode-info {
    flex: 1;
    min-width: 0;
}

.episode-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.episode-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.episode-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.episode-overview {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-top: 0.7rem;
}

@media (max-width: 992px) {
    .item-details-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .item-details-container {
        padding-top: calc(5vh + var(--topbar-height));
    }

    .item-details-poster-wrapper {
        max-width: 350px;
        margin: 0 auto 1rem;
    }

    .item-details-content {
        text-align: center;
    }

    .item-details-meta,
    .item-details-genres,
    .item-details-crew,
    .item-details-actions,
    .item-details-external-links {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .item-details-title {
        font-size: 2rem;
    }

    .cast-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 1.5rem;
    }

    .similar-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 1rem;
    }

    .back-button {
        top: 1rem;
        left: 1rem;
        width: 38px;
        height: 38px;
    }

    .item-details-poster-wrapper {
        max-width: 280px;
    }

    .season-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        text-align: left;
    }

    .season-poster {
        width: 100%;
        max-width: 150px;
        height: auto;
        margin: 0;
    }

    .episode-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .episode-number {
        margin-bottom: 0.8rem;
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .item-details-poster-wrapper {
        max-width: 240px;
    }

    .item-details-title {
        font-size: 1.8rem;
    }

    .cast-grid {
        grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
        gap: 1rem;
    }

    .cast-photo {
        width: 80px;
        height: 80px;
    }

    .similar-items-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (min-width: 992px) {
    .back-button {
        left: calc(var(--sidebar-width) + 2rem);
    }
}

.item-details::-webkit-scrollbar {
    width: 12px;
}

.item-details::-webkit-scrollbar-track {
    background: var(--primary);
    border-left: 1px solid var(--glass-border);
}

.item-details::-webkit-scrollbar-thumb {
    background-color: var(--accent-dark);
    border-radius: 10px;
    border: 3px solid var(--primary);
}

.item-details::-webkit-scrollbar-thumb:hover {
    background-color: var(--accent);
}

body.light-theme .item-details::-webkit-scrollbar-track {
    background: var(--secondary);
    border-left: 1px solid var(--glass-border);
}

body.light-theme .item-details::-webkit-scrollbar-thumb {
    background-color: #bdc3c7;
    border-color: var(--secondary);
}

body.light-theme .item-details::-webkit-scrollbar-thumb:hover {
    background-color: #a3aab1;
}