/* ================================================= */
/* MYMOVIE - STILE MODERN V24 (Glassmorphism + Skeleton) */
/* ================================================= */

:root {
    --bg-dark: #0f0f0f;
    --bg-card: #161616;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent: #e50914;
    --new-blue: #007aff;
    --header-h: 60px;

    /* Glass Effect Variables */
    --glass-bg: rgba(22, 22, 22, 0.7);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --glass-blur: blur(12px);
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    padding-top: var(--header-h);
    overflow-x: hidden;
}

/* --- HEADER GLASS --- */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: rgba(15, 15, 15, 0.8);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    border-bottom: var(--glass-border);
    transition: background 0.3s;
}

.logo {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.5px;
}

.search-bar {
    flex: 1;
    margin: 0 20px;
    display: flex;
    gap: 10px;
    position: relative;
}

.search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 0.9rem;
}

.search-bar input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid transparent;
    color: white;
    border-radius: 20px;
    padding: 10px 10px 10px 38px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s;
}

.search-bar input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.top-menu-link {
    color: #ccc;
    margin-right: 18px;
    text-decoration: none;
    font-size: 1.25rem;
    transition: color 0.2s, transform 0.2s;
}

.top-menu-link:hover {
    color: white;
    transform: scale(1.1);
}

/* --- PULSANTE INDIETRO --- */
.header-btn-back {
    color: #fff;
    font-size: 1.4rem;
    padding: 10px 15px;
    margin-left: -10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: opacity 0.2s;
}

.header-btn-back:active {
    opacity: 0.7;
}

/* --- SEGMENTED CONTROL --- */
.segmented-control {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    margin: 15px;
    border-radius: 12px;
    padding: 4px;
    border: var(--glass-border);
}

.segment-btn {
    flex: 1;
    text-align: center;
    padding: 9px 0;
    color: #888;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.segment-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* --- FILTRI PILL --- */
.filter-bar {
    display: flex;
    padding: 0 15px 15px 15px;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.filter-bar::-webkit-scrollbar {
    display: none;
}

.filter-pill,
.custom-select-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: #ddd;
    border: var(--glass-border);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    position: relative;
    height: 36px;
    box-sizing: border-box;
}

.filter-pill:hover,
.custom-select-wrapper:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.filter-pill.active {
    background: var(--text-primary);
    color: black;
    border-color: white;
    font-weight: 600;
}

/* Custom Select Style */
.custom-select-wrapper {
    padding-right: 10px;
}

.pill-select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    outline: none;
    cursor: pointer;
    padding-right: 5px;
    /* Spazio per la freccia custom */
}

.pill-select option {
    background: #222;
    color: white;
    padding: 10px;
}

.round-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    flex-shrink: 0;
}

/* --- GRIGLIA --- */
.container {
    padding: 20px 50px;
}

.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    padding: 0 10px 80px 10px;
    transform: translateZ(0);
    /* Hardware Acceleration */
}

/* --- MOVIE CARD GLASS --- */
.movie-card {
    background-color: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s, border-color 0.3s;
    cursor: pointer;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.movie-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.3);
    z-index: 10;
}

.poster {
    position: relative;
    aspect-ratio: 2/3;
    background: #202020;
    overflow: hidden;
}

.poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.movie-card:hover .poster img {
    transform: scale(1.05);
}

.no-poster {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #444;
    font-size: 2rem;
}

/* --- BADGES --- */
.badge,
.badge-new-style,
span[class*="badge-"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    /* box-shadow removed */
    line-height: 1;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

.badge-serie-tv {
    background: rgba(183, 28, 28, 0.75);
    color: white;
    border: 1px solid rgba(255, 82, 82, 0.5);
}

.badge-4k {
    background: rgba(0, 0, 0, 0.65);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.6);
}

.badge-bluray {
    background: rgba(13, 71, 161, 0.75);
    color: white;
    border: 1px solid rgba(66, 165, 245, 0.6);
}

.badge-dvd {
    background: rgba(51, 51, 51, 0.75);
    color: #ccc;
    border: 1px solid rgba(85, 85, 85, 0.6);
}

.badge-digital {
    background: rgba(142, 68, 173, 0.75);
    color: white;
    border: 1px solid rgba(155, 89, 182, 0.6);
}

.badge-streaming {
    background: rgba(52, 152, 219, 0.25);
    /* Già trasparente */
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.5);
}

.badge-new-style {
    background: var(--new-blue);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.4);
}

.badge-area-left {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 30;
    display: flex;
}

.badge-area-right {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 20;
    display: flex;
    flex-direction: row-reverse;
    /* Keeps correct order */
    gap: 4px;
    flex-wrap: wrap;
    pointer-events: none;
    max-width: 80%;
    /* Prevent overflow */
    justify-content: flex-start;
    /* Fix align */
}

/* Ensure badges are visible and stack properly */
.badge-area-right .badge,
.badge-area-right span[class*="badge-"] {
    position: static !important;
    margin: 0 !important;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.wishlist-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 10;
    color: #f1c40f;
    font-size: 1.2rem;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.8));
    transition: transform 0.2s;
}

.dropped-badge {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.award-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.72);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.55);
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 0.72rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.info {
    padding: 12px;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.2));
}

.info h3 {
    margin: 0;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #f0f0f0;
    font-weight: 600;
}

.meta {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.75rem;
    color: #999;
}

.progress-bar-thin {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
}

.progress-bar-fill-thin {
    height: 100%;
    background: #e50914;
    box-shadow: 0 0 8px #e50914;
}

/* --- SKELETON LOADING ANIMATION --- */
.p-skeleton {
    background: #222;
    position: relative;
    overflow: hidden;
}

.p-skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.05) 20%, rgba(255, 255, 255, 0.1) 60%, rgba(255, 255, 255, 0) 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* --- ANIMATIONS --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.5s ease-out forwards;
}

.anim-out-left {
    transform: translateX(-100vw);
    opacity: 0;
    transition: transform 0.3s ease-in, opacity 0.3s;
}

.anim-out-right {
    transform: translateX(100vw);
    opacity: 0;
    transition: transform 0.3s ease-in, opacity 0.3s;
}

.anim-in-left {
    animation: slideInLeft 0.3s ease-out forwards;
}

.anim-in-right {
    animation: slideInRight 0.3s ease-out forwards;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100vw);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100vw);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* --- MODALE INFO GLASS --- */
.info-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    backdrop-filter: blur(8px);
    /* Heavy Blur Background */
    -webkit-backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.info-content {
    background: rgba(25, 25, 25, 0.95);
    /* Quasi opaco per leggibilità */
    width: 90%;
    max-width: 450px;
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.info-modal[style*="display: flex"] {
    opacity: 1;
}

.info-modal[style*="display: flex"] .info-content {
    transform: scale(1);
}

/* --- FAB BUTTON --- */
.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #e50914, #b20710);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 8px 20px rgba(229, 9, 20, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    text-decoration: none;
    z-index: 1000;
    transition: transform 0.2s, box-shadow 0.2s;
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 10px 25px rgba(229, 9, 20, 0.6);
}

.fab:active {
    transform: scale(0.9);
}

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 768px) {
    .movie-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .info h3 {
        font-size: 0.75rem;
    }

    .meta {
        font-size: 0.65rem;
    }

    .badge-area-left {
        top: 4px;
        left: 4px;
    }

    .badge-area-right {
        top: 4px;
        right: 4px;
        gap: 2px;
    }

    .badge,
    .badge-new-style,
    span[class*="badge-"] {
        font-size: 0.55rem !important;
        padding: 2px 4px !important;
    }

    /* Force icon visibility and size */
    .badge i,
    span[class*="badge-"] i {
        display: inline-block !important;
        font-size: 0.65rem !important;
        vertical-align: middle;
    }



    .filter-bar {
        padding-bottom: 10px;
    }
}
/* --- LOADER CENTERED (Added via Refactor) --- */
#loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1500;
    color: var(--accent);
    pointer-events: none;
    display: none;
}
