/* ==========================================================================
    MEDIA OVERLAY & CONTENT - Separated for better code organization
    ========================================================================== */

/* Overlay Container */
.media-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, var(--overlay-light) 0%, var(--overlay-dark) 100%);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: white;
    padding: 0;
    opacity: 0;
    transition: opacity var(--transition-slow);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    overflow: visible;
    z-index: 10;
    box-sizing: border-box;
    pointer-events: none;
    border-radius: 0.5rem;
    will-change: opacity, transform;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.media-card {
    position: relative;
    transition: transform var(--transition-medium), box-shadow var(--transition-medium);
    will-change: transform;
    border-radius: 0.5rem;
    overflow: visible;
    z-index: 1;
}

.media-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    z-index: 100; /* Ensure hovered card is on top of neighbors */
}

.media-card:hover .media-overlay,
.media-card:focus-within .media-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Overlay Content */
.media-overlay-content {
    padding: 2.5rem 1rem 4rem 1rem;
    width: 100%;
    height: calc(100% - 2rem);
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    scroll-behavior: smooth;

    /* Custom Scrollbar for Overlay */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;

    /* Premium Slide-Up Animation */
    transform: translateY(15px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.4s ease;
}

/* Webkit Scrollbar */
.media-overlay-content::-webkit-scrollbar {
    width: 4px;
}
.media-overlay-content::-webkit-scrollbar-track {
    background: transparent;
}
.media-overlay-content::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}
.media-overlay-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.media-card:hover .media-overlay-content {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.trailer-embed {
    pointer-events: auto !important;
}

/* Media Text Content */
.media-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 0.3rem 0;
    padding: 0.3rem 0;
    line-height: 1.3;
    color: var(--color-white, #fff);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    width: 100%;
    word-wrap: normal;
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
    pointer-events: auto;
    position: relative;
    background: transparent;
    z-index: 2;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    order: 1;
    font-family: Georgia, 'Times New Roman', serif;
}

.media-author {
    font-size: 1rem;
    margin: 0 0 0.3rem 0;
    color: var(--accent-color);
    font-weight: 600;
    width: 100%;
    pointer-events: auto;
    opacity: 0.98;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.02em;
    order: 2;
    font-family: Georgia, 'Times New Roman', serif;
}

.media-overlay-desc {
    font-size: 1rem;
    font-weight: 400;
    color: var(--border-light, #e8dcc0);
    line-height: 1.4;
    margin-bottom: 0.5em;
    overflow-y: auto;
    overflow-x: hidden;
    font-family: Georgia, 'Times New Roman', serif;
}

.media-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-light);
    width: 100%;
    flex: 1;
    text-align: left;
    pointer-events: auto;
    scroll-behavior: smooth;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
    order: 3;
    margin-bottom: 0.5rem;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
    font-family: Georgia, 'Times New Roman', serif;
}

/* Media Date Bottom */
.media-date-bottom {
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 0.75rem;
    color: var(--accent-color);
    font-weight: 500;
    text-align: center;
    background: var(--overlay-medium);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 0.5rem 0.5rem;
    opacity: 0.9;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.02em;
    z-index: 5;
    order: 6;
}

/* ==========================================================================
    RATING & ACTIONS (IMDB, ROTTEN TOMATOES, YOUTUBE TRAILER)
    ========================================================================== */

/* Bottom Actions Container - now positioned at top row */
.media-bottom-actions {
    display: none;
}

/* Webkit Scrollbar for Bottom Actions - hidden */
.media-bottom-actions::-webkit-scrollbar {
    display: none;
}

.media-card:hover .media-bottom-actions {
    opacity: 0;
    transform: scale(0);
}

/* Top Right Actions Container (for all buttons) */
.media-top-right-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem;
    pointer-events: auto;
    z-index: 50;
    opacity: 0;
    transform: scale(0.8) translateY(-10px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: visible;
    max-width: 100%;
    justify-content: flex-end;
}

.media-card:hover .media-top-right-actions {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.action-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 22px;
    width: auto;
    min-width: 24px;
    padding: 2px 3px;
    border-radius: 3px;
    font-size: 0.6em;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: rgba(0, 0, 0, 0.5); /* Unified background */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer !important;
    position: relative;
    overflow: visible;
    z-index: 50;
    gap: 1px;
    pointer-events: auto !important;
}

.video-card .action-btn {
    height: 18px;
    min-width: 20px;
    padding: 1px 2px;
    font-size: 0.55em;
}

.action-btn i {
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
    margin-bottom: 1px;
}

.action-btn .link-label-initial {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #ff0000;
    color: white;
    font-size: 0.45em;
    font-weight: 700;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.4);
    z-index: 10;
}

.action-btn:hover .link-label-initial {
    transform: scale(1.1);
}

.action-btn .rating-text {
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
    line-height: 1;
    text-align: center;
    text-shadow: 0 1px 1px rgba(0,0,0,0.5);
    width: 100%;
}

.action-btn .rating-label {
    font-size: 0.45rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1;
    letter-spacing: 0.5px;
}

.action-btn:hover .rating-text {
    color: white;
}

/* Rating text colors */
.imdb-btn { 
    color: #f5c518; 
    background: rgba(0, 0, 0, 0.7); 
    padding: 4px 10px;
    border-color: rgba(245, 197, 24, 0.3);
}
.imdb-btn .rating-label { 
    color: rgba(245, 197, 24, 0.9);
}
.imdb-btn .rating-text { 
    color: #f5c518; 
}
.imdb-btn:hover { 
    background: #f5c518; 
    border-color: #f5c518;
    box-shadow: 0 0 20px rgba(245, 197, 24, 0.4);
}
.imdb-btn:hover :is(.rating-label, .rating-text) { 
    color: #000;
}

.rt-btn { 
    color: #fa3d21; 
    background: rgba(0, 0, 0, 0.7); 
    border-color: rgba(250, 61, 33, 0.3);
}
.rt-btn .rating-label { 
    color: rgba(250, 61, 33, 0.9);
}
.rt-btn .rating-text { 
    color: #fa3d21; 
}
.rt-btn:hover { 
    background: #fa3d21; 
    border-color: #fa3d21;
    box-shadow: 0 0 20px rgba(250, 61, 33, 0.4);
}
.rt-btn:hover :is(.rating-label, .rating-text) { 
    color: white; 
}

/* Trailer button */
.trailer-btn { 
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 3px;
    min-width: 22px;
    height: 20px;
}
.trailer-btn .fa-youtube {
    font-size: 0.9em;
    color: #ff0000;
}
.trailer-btn:hover { 
    background: #ff0000; 
    border-color: #ff0000;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.4);
}
.trailer-btn:hover .fa-youtube {
    color: white;
}
.trailer-btn:hover .link-label-initial {
    background: white;
    color: #ff0000;
    transform: scale(1.1);
}

.spotify-link-btn:hover { background: #1DB954; border-color: #1DB954; }
.apple-link-btn:hover { background: #000000; border-color: #333; }
.soundcloud-link-btn:hover { background: #ff5500; border-color: #ff5500; }
.amazon-link-btn:hover { background: #FF9900; border-color: #FF9900; }
.x-btn:hover { background: #000000; border-color: #333; }
.youtube-link-btn:hover { background: #ff0000; border-color: #ff0000; }
.rss-link-btn:hover { background: #f26522; border-color: #f26522; }

.trailer-embed {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    margin: 0.6rem 0 0.6rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    order: 0;
    pointer-events: auto !important;
    z-index: 60;
}

.trailer-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: auto !important;
    z-index: 10;
}
/* ==========================================================================
    MOBILE RESPONSIVE - OVERLAY ADJUSTMENTS
    ========================================================================== */

/* Tablet (768px and below) */
@media (max-width: 768px) {
    .media-overlay-desc { font-size: 0.95rem; }
    .media-description { font-size: 0.9rem; }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    .media-title { font-size: 1.1rem; }
    .media-overlay-desc { font-size: 0.85rem; line-height: 1.4; }
    .media-description { font-size: 0.85rem; line-height: 1.4; }
    .media-author { font-size: 0.9rem; }
    .media-date-bottom { font-size: 0.65rem; }
    
    .corner-action { padding: 0.35rem; }
    .action-btn { height: 20px; min-width: 20px; padding: 1px 2px; border-radius: 2px; font-size: 0.55em;}
    .media-top-right-actions { gap: 0.2rem; }
}

/* Extra small (414px and below) */
@media (max-width: 414px) {
    .media-title { font-size: 1rem; }
    .media-overlay-desc { font-size: 0.75rem; line-height: 1.3; }
    .media-description { font-size: 0.85rem; line-height: 1.4; hyphens: none; }
    .media-author { font-size: 0.8rem; }
    .media-date-bottom { font-size: 0.6rem; padding: 0.15rem 0; }

    .corner-action { padding: 0.25rem; }
    .action-btn { height: 18px; min-width: 18px; padding: 1px 2px; border-radius: 2px; font-size: 0.5em;}
    .media-top-right-actions { gap: 0.15rem; }
}

/* ==========================================================================
    DARK MODE - OVERLAY OVERRIDES
    ========================================================================== */

@media (prefers-color-scheme: dark) {
    .media-overlay {
        background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.95) 100%);
    }
}

/* Remove underlines on all hyperlinks in media overlays */
.media-overlay a,
.media-overlay a:hover,
.media-overlay a:focus,
.media-overlay a:active,
.media-overlay a:visited {
    text-decoration: none !important;
}

.media-highlights {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  order: 4;
}

.media-highlight-link {
  color: var(--text-light);
  font-size: 0.85rem;
  text-decoration: underline;
  opacity: 0.9;
}

.media-highlight-link:hover {
  opacity: 1;
}


/* Specialized card styles (e.g., Coachella) moved to dedicated CSS files for better modularity */

