/**
 * posterActionOverlay.css - Reusable Poster Action Overlay Component
 *
 * A configurable hover/touch overlay for poster cards with common actions:
 * - View Details, Watch Trailer, Add to Watchlist, Add Viewing, Mark Owned, etc.
 *
 * Uses CSS variables for easy customization per-page or globally.
 */

/* ============================================================
   CSS VARIABLES - Override these to customize
   ============================================================ */
:root {
    /* Button sizes */
    --pao-btn-size-sm: 32px;
    --pao-btn-size-md: 40px;
    --pao-btn-size-lg: 48px;

    /* Icon sizes */
    --pao-icon-size-sm: 0.9rem;
    --pao-icon-size-md: 1.1rem;
    --pao-icon-size-lg: 1.3rem;

    /* Overlay background */
    --pao-overlay-bg: rgba(0, 0, 0, 0.65);

    /* Transition speed */
    --pao-transition-speed: 0.2s;

    /* Button gap */
    --pao-gap-sm: 6px;
    --pao-gap-md: 8px;
    --pao-gap-lg: 10px;

    /* Action colors - using Bootstrap palette */
    --pao-color-primary: #0d6efd;
    --pao-color-danger: #dc3545;
    --pao-color-success: #198754;
    --pao-color-warning: #ffc107;
    --pao-color-info: #0dcaf0;
    --pao-color-secondary: #6c757d;
    --pao-color-light: #f8f9fa;
    --pao-color-purple: #6f42c1;
    --pao-color-teal: #14b8a6;
    --pao-color-orange: #f59e0b;
    --pao-color-pink: #ec4899;
}

/* ============================================================
   CONTAINER - Must be position:relative
   ============================================================ */
.pao-container {
    position: relative;
}

/* ============================================================
   OVERLAY - Appears on hover/touch
   ============================================================ */
.pao-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--pao-overlay-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    /* Reserve space at the bottom for absolute-positioned links
       (.pao-see-riyl, .pao-see-reviews, .pao-viewed-date) so the
       flex-centered action icons sit higher and don't overlap them. */
    padding-bottom: 96px;
    opacity: 0;
    transition: opacity var(--pao-transition-speed) ease;
    pointer-events: none;
    border-radius: inherit;
}

.pao-container:hover .pao-overlay,
.pao-container.pao-active .pao-overlay {
    opacity: 1;
}

/* Touch device support - toggle active class */
.pao-container.pao-touch-active .pao-overlay {
    opacity: 1;
}

/* Make interactive elements inside the overlay clickable */
.pao-container:hover .pao-btn,
.pao-container.pao-active .pao-btn,
.pao-container.pao-touch-active .pao-btn,
.pao-container:hover .pao-see-reviews-link,
.pao-container.pao-active .pao-see-reviews-link,
.pao-container.pao-touch-active .pao-see-reviews-link,
.pao-container:hover .pao-see-riyl-link,
.pao-container.pao-active .pao-see-riyl-link,
.pao-container.pao-touch-active .pao-see-riyl-link {
    pointer-events: auto;
}

/* ============================================================
   ACTION BUTTONS CONTAINER - Layout variants
   ============================================================ */
.pao-actions {
    display: flex;
    gap: var(--pao-gap-md);
}

/* Layout: Row (horizontal) */
.pao-actions.pao-layout-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

/* Layout: 2x2 Grid */
.pao-actions.pao-layout-grid-2x2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--pao-gap-sm);
}

/* Layout: 3 column grid */
.pao-actions.pao-layout-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--pao-gap-sm);
}

/* Layout: Vertical stack */
.pao-actions.pao-layout-vertical {
    flex-direction: column;
    align-items: center;
}

/* ============================================================
   ACTION BUTTON - Base styles
   ============================================================ */
.pao-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    color: white;
    padding: 0;
}

.pao-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.pao-btn:active {
    transform: scale(0.95);
}

/* Anchor buttons - remove default link styling */
a.pao-btn {
    text-decoration: none;
}

a.pao-btn:hover {
    text-decoration: none;
}

/* Button shape: Circle (default) */
.pao-btn.pao-shape-circle {
    border-radius: 50%;
}

/* Button shape: Rounded */
.pao-btn.pao-shape-rounded {
    border-radius: 8px;
}

/* ============================================================
   BUTTON SIZES
   ============================================================ */
.pao-btn.pao-size-sm {
    width: var(--pao-btn-size-sm);
    height: var(--pao-btn-size-sm);
}

.pao-btn.pao-size-sm i {
    font-size: var(--pao-icon-size-sm);
}

.pao-btn.pao-size-md {
    width: var(--pao-btn-size-md);
    height: var(--pao-btn-size-md);
}

.pao-btn.pao-size-md i {
    font-size: var(--pao-icon-size-md);
}

.pao-btn.pao-size-lg {
    width: var(--pao-btn-size-lg);
    height: var(--pao-btn-size-lg);
}

.pao-btn.pao-size-lg i {
    font-size: var(--pao-icon-size-lg);
}

/* ============================================================
   BUTTON COLORS - Using Bootstrap naming convention
   ============================================================ */
.pao-btn.pao-color-primary {
    background-color: var(--pao-color-primary);
}

.pao-btn.pao-color-primary:hover {
    background-color: #0b5ed7;
}

.pao-btn.pao-color-danger {
    background-color: var(--pao-color-danger);
}

.pao-btn.pao-color-danger:hover {
    background-color: #bb2d3b;
}

.pao-btn.pao-color-success {
    background-color: var(--pao-color-success);
}

.pao-btn.pao-color-success:hover {
    background-color: #157347;
}

.pao-btn.pao-color-warning {
    background-color: var(--pao-color-warning);
    color: #000;
}

.pao-btn.pao-color-warning:hover {
    background-color: #ffca2c;
}

.pao-btn.pao-color-info {
    background-color: var(--pao-color-info);
    color: #000;
}

.pao-btn.pao-color-info:hover {
    background-color: #31d2f2;
}

.pao-btn.pao-color-secondary {
    background-color: var(--pao-color-secondary);
}

.pao-btn.pao-color-secondary:hover {
    background-color: #5c636a;
}

.pao-btn.pao-color-purple {
    background-color: var(--pao-color-purple);
    color: white;
}

.pao-btn.pao-color-purple:hover {
    background-color: #5a32a3;
}

.pao-btn.pao-color-teal {
    background-color: var(--pao-color-teal);
    color: white;
}

.pao-btn.pao-color-teal:hover {
    background-color: #0d9488;
}

.pao-btn.pao-color-orange {
    background-color: var(--pao-color-orange);
    color: white;
}

.pao-btn.pao-color-orange:hover {
    background-color: #d97706;
}

.pao-btn.pao-color-pink {
    background-color: var(--pao-color-pink);
    color: white;
}

.pao-btn.pao-color-pink:hover {
    background-color: #db2777;
}

.pao-btn.pao-color-light {
    background-color: var(--pao-color-light);
    color: #212529;
}

.pao-btn.pao-color-light:hover {
    background-color: #e2e6ea;
}

/* Outline variants for inactive toggle states */
.pao-btn.pao-outline-secondary {
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--pao-color-secondary);
    border: 1px solid var(--pao-color-secondary);
}

.pao-btn.pao-outline-secondary:hover {
    background-color: var(--pao-color-secondary);
    color: white;
}

/* ============================================================
   SPECIAL HOVER COLOR (e.g., exclude button turns red on hover)
   ============================================================ */
.pao-btn.pao-hover-danger:hover {
    background-color: var(--pao-color-danger) !important;
    color: white !important;
}

/* ============================================================
   TOOLTIP (optional - uses title attribute by default)
   ============================================================ */
.pao-btn[title] {
    position: relative;
}

/* ============================================================
   MOBILE/TOUCH ADJUSTMENTS
   ============================================================ */
@media (max-width: 576px) {
    .pao-actions {
        gap: var(--pao-gap-sm);
    }

    /* Slightly smaller buttons on mobile */
    .pao-btn.pao-size-md {
        width: calc(var(--pao-btn-size-md) - 4px);
        height: calc(var(--pao-btn-size-md) - 4px);
    }
}

/* ============================================================
   HIDDEN STATE (for conditional actions like trailer)
   ============================================================ */
.pao-btn.pao-hidden {
    display: none !important;
}

/* ============================================================
   STATUS INDICATORS - Always visible at top-left of poster
   Shows: Owned (disc), Watched (eye), Watchlist (bookmark)
   ============================================================ */
.pao-status-indicators {
    position: absolute;
    top: 6px;
    left: 6px;
    display: flex;
    flex-direction: row;
    gap: 4px;
    z-index: 5;
    pointer-events: none;
}

.pao-status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.6rem;
}

/* Watched - Blue (viewing family) */
.pao-status-indicator.pao-status-watched {
    background: rgba(13, 110, 253, 0.85);
    color: white;
}

/* Watchlist - Cyan (viewing family) */
.pao-status-indicator.pao-status-watchlist {
    background: rgba(13, 202, 240, 0.85);
    color: #000;
}

/* Owned - Green (owning family) */
.pao-status-indicator.pao-status-owned {
    background: rgba(25, 135, 84, 0.85);
    color: white;
}

/* Want List - Teal (owning family) */
.pao-status-indicator.pao-status-want {
    background: rgba(20, 184, 166, 0.85);
    color: white;
}

/* Reviewed - Orange (standalone) */
.pao-status-indicator.pao-status-reviewed {
    background: rgba(245, 158, 11, 0.85);
    color: white;
}

/* RIYL/Recommendations - Purple */
.pao-status-indicator.pao-status-riyl {
    background: rgba(111, 66, 193, 0.85);
    color: white;
}

/* Plex badge - bottom left of poster */
.pao-plex-badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #e5a00d;
    font-size: 0.7rem;
    text-decoration: none;
    z-index: 5;
    transition: transform 0.15s;
    pointer-events: auto;
}
.pao-plex-badge:hover {
    color: #f0b429;
    transform: scale(1.2);
}

/* Responsive - smaller indicators on mobile */
@media (max-width: 576px) {
    .pao-status-indicators {
        top: 4px;
        left: 4px;
        gap: 2px;
    }

    .pao-status-indicator {
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
    }

    .pao-plex-badge {
        bottom: 4px;
        left: 4px;
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
    }
}

/* ============================================================
   VIEWED DATE - Shows in overlay when title has been watched
   ============================================================ */
.pao-viewed-date {
    position: absolute;
    bottom: 32px;  /* Above the release strip */
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

@media (max-width: 576px) {
    .pao-viewed-date {
        font-size: 0.65rem;
        bottom: 28px;
    }
}

/* ============================================================
   SEE REVIEWS LINK - Shows in overlay when reviews exist
   ============================================================ */
.pao-see-reviews {
    position: absolute;
    bottom: 52px;  /* Above the viewed date */
    left: 0;
    right: 0;
    text-align: center;
    padding: 4px 0;
    font-size: 0.75rem;
}

.pao-see-reviews a {
    color: #0dcaf0 !important;
    text-decoration: none;
}

.pao-see-reviews a:hover {
    text-decoration: underline;
}

@media (max-width: 576px) {
    .pao-see-reviews {
        font-size: 0.65rem;
        bottom: 48px;
    }
}

/* ============================================================
   SEE RECOMMENDATIONS LINK - Always visible in overlay
   ============================================================ */
.pao-see-riyl {
    position: absolute;
    bottom: 72px;  /* Above the see reviews */
    left: 0;
    right: 0;
    text-align: center;
    padding: 4px 0;
    font-size: 0.75rem;
}

.pao-see-riyl a {
    color: #a78bfa !important;  /* Light purple */
    text-decoration: none;
}

.pao-see-riyl a:hover {
    text-decoration: underline;
    color: #c4b5fd !important;
}

@media (max-width: 576px) {
    .pao-see-riyl {
        font-size: 0.65rem;
        bottom: 68px;
    }
}

/* ============================================================
   RELEASE DATE STRIP - Shows upcoming release/episode dates
   Always visible at bottom of poster (not inside overlay)
   ============================================================ */
.pao-release-strip {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.7));
    color: white;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 4px 6px;
    text-align: center;
    z-index: 4;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

.pao-release-strip .pao-release-icon {
    margin-right: 5px;
    font-size: 0.75rem;
    opacity: 0.9;
    cursor: help;
}

.pao-release-strip .pao-release-label {
    color: #adb5bd;
    margin-right: 3px;
}

.pao-release-strip .pao-release-date {
    color: #ffc107;
    font-weight: 600;
}

/* Movie release - cyan accent */
.pao-release-strip.pao-release-movie .pao-release-date {
    color: #0dcaf0;
}

.pao-release-strip.pao-release-movie .pao-release-icon {
    color: #0dcaf0;
}

/* TV episode - green accent */
.pao-release-strip.pao-release-tv .pao-release-date {
    color: #20c997;
}

.pao-release-strip.pao-release-tv .pao-release-icon {
    color: #20c997;
}

/* Owned badge in release strip */
.pao-owned-badge {
    color: #198754;
    font-weight: 600;
    font-size: 0.7rem;
}

.pao-owned-badge i {
    margin-right: 2px;
}

.pao-release-strip.pao-release-owned {
    background: linear-gradient(to top, rgba(25, 135, 84, 0.9), rgba(25, 135, 84, 0.7));
}

.pao-release-strip.pao-release-owned .pao-owned-badge {
    color: white;
}

.pao-release-separator {
    margin: 0 6px;
    color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 576px) {
    .pao-release-strip {
        font-size: 0.6rem;
        padding: 3px 4px;
    }
}
