/**
 * Shared CSS for Video Game and Board Game Ranking Pages
 * This file contains all the common styles to ensure 1:1 match between both pages
 */

.video-games-master-list,
.board-games-master-list {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 60px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #1a1a1a;
    color: #e0e0e0;
    position: relative;
    /* Wavy borders on all four sides (reused from game-single.css .game-single) */
    clip-path: polygon(0% 0.5%, 20% 0%, 40% 0.5%, 60% 0%, 80% 0.5%, 100% 0%, 98% 5%, 99% 10%, 97% 15%, 100% 20%, 98% 25%, 99% 30%, 97% 35%, 100% 40%, 98% 45%, 99% 50%, 97% 55%, 100% 60%, 98% 65%, 99% 70%, 97% 75%, 100% 80%, 98% 85%, 99% 90%, 97% 95%, 100% 99.5%, 80% 100%, 60% 99.5%, 40% 100%, 20% 99.5%, 0% 100%, 2% 95%, 1% 90%, 3% 85%, 0% 80%, 2% 75%, 1% 70%, 3% 65%, 0% 60%, 2% 55%, 1% 50%, 3% 45%, 0% 40%, 2% 35%, 1% 30%, 3% 25%, 0% 20%, 2% 15%, 1% 10%, 3% 5%);
}

/* Top torn edge - green accent like header */
.video-games-master-list::before,
.board-games-master-list::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 20px;
    background: #4da44b;
    clip-path: polygon(0% 0%, 10% 80%, 20% 60%, 30% 90%, 40% 50%, 50% 85%, 60% 40%, 70% 75%, 80% 55%, 90% 80%, 100% 0%, 100% 0%, 0% 0%);
    z-index: 1;
}

/* Bottom torn edge - green accent like header */
.video-games-master-list::after,
.board-games-master-list::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20px;
    background: #4da44b;
    clip-path: polygon(0% 100%, 10% 20%, 20% 40%, 30% 10%, 40% 50%, 50% 15%, 60% 60%, 70% 25%, 80% 45%, 90% 20%, 100% 100%, 100% 100%, 0% 100%);
    z-index: 1;
}

.page-header {
    text-align: center;
    margin-bottom: 50px;
    padding: 30px 0;
    background: linear-gradient(135deg, #2d2d2d 0%, #1f1f1f 100%);
    border-radius: 12px;
    border: 1px solid #404040;
    position: relative;
}

.page-header::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, #4da44b 0%, #059669 100%);
    border-radius: 2px;
}

.page-title {
    color: #ffffff;
    margin-bottom: 10px;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.page-description {
    color: #b0b0b0;
    font-size: 1.1rem;
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

.games-count {
    margin-bottom: 25px;
    text-align: right;
    color: #b0b0b0;
    font-weight: 500;
    padding: 12px 20px;
    background: #2d2d2d;
    border-radius: 8px;
    border: 1px solid #404040;
}

.video-games-list,
.board-games-list {
    display: grid;
    gap: 16px;
}

.game-entry {
    display: flex;
    align-items: center;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 12px;
    padding: 20px 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    position: relative;
}

.game-entry.has-banner::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--banner-url);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.15;
    border-radius: 12px;
    z-index: 1;
    pointer-events: none;
}

.game-entry > * {
    position: relative;
    z-index: 2;
}

.game-entry:hover {
    background: #333333;
    border-color: #4da44b;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(77, 164, 75, 0.25);
}

.game-rank {
    font-size: 28px;
    font-weight: 800;
    color: #4da44b;
    margin-right: 24px;
    min-width: 70px;
    text-align: center;
    background: linear-gradient(135deg, #1f4a1f 0%, #0d2e0d 100%);
    border-radius: 12px;
    padding: 12px 8px;
    border: 2px solid #4da44b;
}

.game-rank.unranked {
    color: #999;
    background: linear-gradient(135deg, #444 0%, #222 100%);
    border-color: #666;
    font-size: 18px;
    font-style: italic;
    opacity: 0.8;
}

.game-thumbnail {
    margin-right: 20px;
    flex-shrink: 0;
}

.box-art-thumb {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #404040;
    transition: border-color 0.3s ease;
}

.game-entry:hover .box-art-thumb {
    border-color: #4da44b;
}

.box-art-placeholder {
    width: 60px;
    height: 80px;
    background: #404040;
    border: 2px solid #555555;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #888888;
    text-align: center;
}

/* Board game thumbnails: fixed width, flexible height for square/landscape art */
.boardgame-rankings .game-thumbnail {
    width: 84px;
    display: flex;
    align-items: center;
}

.boardgame-rankings .box-art-thumb {
    width: 80px;
    height: auto;
    max-height: 107px;
    object-fit: contain;
}

.boardgame-rankings .box-art-placeholder {
    width: 80px;
    height: 80px;
}

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

.game-title {
    margin: 0 0 8px 0;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
}

.game-title a {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.2s ease;
}

.game-title a:hover {
    color: #4da44b;
}

.game-platforms {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.platform-box {
    color: #b0b0b0;
    font-size: 0.75rem;
    font-weight: 500;
    background: #1a1a1a;
    padding: 3px 6px;
    border-radius: 3px;
    display: inline-block;
    border: 1px solid #333;
}

.game-ratings {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
    margin-left: 20px;
}

.badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tier-badge, .score-badge, .achievement-badge {
    padding: 6px 10px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.1);
    min-width: 55px;
    text-align: center;
}

.achievement-badge.retro {
    background: #FFCC01 !important;
}

/* Legacy placeholder styles - now handled by pooter badge functions */
/* .tier-placeholder, .score-placeholder handled by inline styles in badge-helpers.php */

.achievement-badge {
    font-size: 0.7rem;
    padding: 5px 8px;
    min-width: 65px;
}

.achievement-badge.placeholder {
    background: #444444 !important;
    color: #888888 !important;
    opacity: 0.8;
    font-size: 0.65rem;
    text-shadow: none;
}

.mastered-text {
    color: #FFD700;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* Ranking controls */
.ranking-controls {
    margin: 20px 0;
    text-align: center;
}

.view-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* Compact Filter Controls */
.filter-controls-compact {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
    background: #2d2d2d;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.toggle-switches {
    display: flex;
    gap: 30px;
    align-items: center;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-label {
    color: #e0e0e0;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Toggle Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #1a1a1a;
    border: 2px solid #404040;
    border-radius: 50px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 2px;
    background-color: #808080;
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.320, 1);
}

.switch input:checked + .slider {
    background: rgba(77, 164, 75, 0.2);
    border: 2px solid #4da44b;
    box-shadow: 0 0 15px rgba(77, 164, 75, 0.4);
}

.switch input:checked + .slider:before {
    transform: translateX(26px);
    background-color: #4da44b;
}

/* Filter Dropdowns */
.filter-dropdowns {
    display: flex;
    gap: 20px;
    align-items: center;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-label {
    color: #a0a0a0;
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff !important;
}

/* Active state for toggle filter buttons */
.toggle-link.active {
    background: #ff6b35;
    border-color: #ff6b35;
    color: #fff !important;
}

.toggle-link.active:hover {
    background: #ff7b45;
    border-color: #ff7b45;
    color: #fff !important;
}

/* Specific hover for inactive toggle buttons */
.toggle-link:not(.active):hover {
    background: #333;
    border-color: #ff6b35;
}

.active-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px 15px;
    background: rgba(255, 107, 53, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(255, 107, 53, 0.3);
}

.filter-label {
    color: #ccc;
    font-size: 12px;
    font-weight: 600;
}

.filter-badge {
    background: #ff6b35;
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

/* Sub-rankings styles */
.sub-rankings-container {
    margin: 0px 0 20px 0;
    padding: 15px;
    background: transparent;
    border-radius: 0;
    border: none;
    border-left: 3px solid #4da44b;
    padding-left: 25px;
}

.sub-rankings-header {
    margin-bottom: 20px;
}

.sub-rankings-title {
    color: #ffffff;
    font-size: 16px;
    margin: 0 0 15px 0;
    padding: 0;
    border-bottom: 1px solid #4da44b;
    text-align: left;
    font-weight: 600;
    opacity: 0.9;
}

.sub-rankings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.sub-game-entry {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 12px;
    padding: 20px;
    gap: 15px;
    transition: all 0.3s ease;
    position: relative;
    min-height: 300px;
    text-align: center;
}

.sub-game-entry:hover {
    background: rgba(77, 164, 75, 0.1);
    border-color: #4da44b;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(77, 164, 75, 0.2);
}

.sub-game-entry.unranked-item {
    opacity: 0.7;
    border-style: dashed;
}

.sub-game-rank {
    position: absolute;
    top: 15px;
    left: 15px;
    background: linear-gradient(135deg, #1f4a1f 0%, #0d2e0d 100%);
    color: #4da44b;
    border: 2px solid #4da44b;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.sub-game-rank.unranked {
    background: linear-gradient(135deg, #444 0%, #222 100%);
    color: #999;
    border-color: #666;
    font-style: italic;
}

.sub-game-thumbnail {
    width: 200px;
    height: 112px;  /* 16:9 aspect ratio */
    flex-shrink: 0;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    border-radius: 4px;
}

.sub-box-art-thumb {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;  /* Show full image without cropping */
    border-radius: 4px;
    border: 2px solid #404040;
    transition: border-color 0.3s ease;
}

.sub-game-entry:hover .sub-box-art-thumb {
    border-color: #4da44b;
}

.sub-box-art-placeholder {
    width: 100%;
    height: 100%;
    background: #333;
    border: 2px solid #555;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #666;
    text-align: center;
}

.sub-game-info {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.sub-game-title {
    color: #ffffff;
    font-size: 14px;
    margin: 0;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sub-game-ratings {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.sub-badges-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.sub-game-entry .tier-badge,
.sub-game-entry .score-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 1px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
}

/* Legacy sub-game placeholder style - now handled by pooter badge functions */

/* Infinite Scroll Controls */
.infinite-scroll-controls {
    margin-top: 30px;
    padding: 20px;
    background: #1a1a1a;
    border-radius: 8px;
    text-align: center;
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 15px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #333333;
    border-top: 3px solid #4da44b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #4da44b;
    font-size: 1rem;
    font-weight: 500;
}

.load-progress {
    color: #b0b0b0;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.all-loaded-message {
    color: #4da44b;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 15px;
    background: rgba(77, 164, 75, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(77, 164, 75, 0.3);
}

/* New Game Entry Animation */
.new-game-entry {
    transition: opacity 0.5s ease-in-out;
}

.new-game-entry.fade-in {
    opacity: 1 !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .video-games-master-list,
    .board-games-master-list {
        padding: 20px 15px;
    }

    .page-title {
        font-size: 2rem;
    }

    .game-entry {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .game-rank {
        margin: 0;
        font-size: 24px;
        padding: 8px 12px;
        min-width: 60px;
    }

    .game-thumbnail {
        margin: 0;
    }

    .game-ratings {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }

    .filter-controls-compact {
        flex-direction: column;
        gap: 20px;
        padding: 15px;
    }

    .toggle-switches {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }

    .toggle-item {
        width: 100%;
        justify-content: space-between;
    }

    .filter-dropdowns {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }

    .dropdown-item {
        width: 100%;
        justify-content: space-between;
    }

    .dropdown-item select {
        flex: 1;
        max-width: 200px;
    }

    .active-filters {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }

    .sub-rankings-container {
        margin: 10px 0 20px 0;
        padding: 15px;
    }

    .sub-rankings-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .sub-game-entry {
        padding: 15px;
        min-height: 250px;
    }

    .sub-game-thumbnail {
        width: 160px;
        height: 90px;  /* 16:9 aspect ratio */
    }

    .sub-game-rank {
        width: 40px;
        height: 40px;
        font-size: 12px;
        top: 10px;
        left: 10px;
    }

    .sub-game-title {
        font-size: 13px;
    }
}

@media (max-width: 1200px) {
    .sub-rankings-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 600px) {
    .loading-indicator {
        gap: 8px;
    }

    .loading-text {
        font-size: 0.9rem;
    }

    .all-loaded-message {
        font-size: 1rem;
        padding: 12px;
    }
}

/* ============================================
   INLINE BADGES ROW (System + Tier + Score + Achievements)
   ============================================ */

.inline-badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 6px;
}

/* Ensure Pooter badges have consistent spacing */
.inline-badges-row .wakasm-badge-image {
    flex-shrink: 0;
}

/* Fallback platform box styling when no badge exists */
.inline-badges-row .platform-box {
    color: #b0b0b0;
    font-size: 0.7rem;
    font-weight: 500;
    background: #1a1a1a;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    border: 1px solid #333;
}

/* ============================================
   VIDEO WRAPPER (Far Right Edge)
   ============================================ */

/* Position video wrapper at far right of the row */
.game-video-right {
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: stretch;
}

.right-video {
    height: 80px !important;
    width: auto !important;
    max-width: 160px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid #404040;
    transition: height 0.4s ease 1s,
                max-width 0.4s ease 1s,
                border-color 0.3s ease,
                box-shadow 0.4s ease 1s;
}

/* Video and container expand on hover after 1 second delay */
.game-entry {
    min-height: 100px;
    transition: min-height 0.4s ease 1s, padding 0.3s ease;
}

.game-entry:hover {
    min-height: 220px;
}

.game-entry:hover .right-video {
    height: 200px !important;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    border-color: #4da44b;
}

/* Responsive adjustments for inline badges + video */
@media (max-width: 768px) {
    .inline-badges-row {
        gap: 4px;
    }

    .game-video-wrapper {
        display: none; /* Hide video on mobile for cleaner layout */
    }
}

@media (max-width: 480px) {
    .inline-badges-row .wakasm-badge-image {
        transform: scale(0.85);
        margin-left: 12px !important;
    }
}

/* Board game badge group container (Solo/Multi) */
.badge-group {
    display: inline-flex;
    align-items: center;
    border-radius: 4px;
    padding: 1px 3px 1px 0;
    gap: 0;
}

.badge-group-solo {
    background: rgba(70, 130, 180, 0.35);
}

.badge-group-multi {
    background: rgba(180, 120, 70, 0.35);
}

/* Tighten the first badge inside the group - reduce the pooter overlap margin */
.badge-group > span:nth-child(2) {
    margin-left: 4px !important;
}

.badge-group .badge-group-label {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 12px 2px 5px;
    line-height: 1;
    align-self: center;
    white-space: nowrap;
}

.badge-group-solo .badge-group-label {
    color: rgba(160, 200, 240, 0.95);
}

.badge-group-multi .badge-group-label {
    color: rgba(230, 180, 130, 0.95);
}

/* Board game metadata line (players, time, weight, BGG link) */
.boardgame-meta-line {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
    letter-spacing: 0.3px;
}

.boardgame-meta-line .bgg-meta-link {
    color: #aaa;
    text-decoration: none;
}

.boardgame-meta-line .bgg-meta-link:hover {
    color: #ff6600;
    text-decoration: underline;
}

/* Board game rank box - play count inside */
.boardgame-rankings .game-rank {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.rank-play-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    border-top: 1px solid rgba(77, 164, 75, 0.4);
    padding-top: 4px;
    margin-top: 2px;
}

.rank-play-count .play-count-number {
    font-size: 15px;
    font-weight: 700;
    color: #e0c050;
}

.rank-play-count .play-count-label {
    font-size: 7px;
    text-transform: uppercase;
    color: #8cb88a;
    letter-spacing: 0.5px;
}

.boardgame-meta-line .reviewed-meta-link {
    color: #ff69b4;
    text-decoration: none;
    font-weight: 700;
}

.boardgame-meta-line .reviewed-meta-link:hover {
    color: #ff91cb;
    text-decoration: underline;
}

/* --- HIDE VIDEOS TOGGLE ---
   Toggled via JS class on the list container */
.hide-videos .game-video-right,
.hide-videos .game-video-wrapper {
    display: none !important;
}

/* --- PHASE 5: CATALOG ENTRIES ---
   Rows whose underlying wp_games / wp_boardgames row has
   entry_status='catalog'. They share the unranked layout but get a
   muted treatment so they read as "queued for review" rather than
   regular unranked entries. */
.game-entry.catalog-entry {
    opacity: 0.78;
    border-left: 3px solid #b08a4a;
}

.game-entry.catalog-entry .game-rank.unranked.catalog {
    background: #b08a4a;
    color: #1a1a1a;
}

/* Played indicator pill, sits just below the title inside .game-info.
   Two flavors: --yes (played, green) and --no (not played, muted). */
.catalog-played-indicator {
    display: inline-block;
    margin: 4px 0 6px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: 3px;
    line-height: 1.6;
}

.catalog-played-indicator--yes {
    background: rgba(77, 164, 75, 0.22);
    color: #8cd28a;
    border: 1px solid rgba(77, 164, 75, 0.6);
}

.catalog-played-indicator--no {
    background: rgba(176, 138, 74, 0.18);
    color: #d3b783;
    border: 1px solid rgba(176, 138, 74, 0.55);
}

