/**
 * Tier Ranker Styles
 * Styling for the tier ranker page layout
 * 
 * @package Genesis Sample
 * @subpackage Wakasm
 * @version 1.0.0
 * @since 2025-09-02
 */

/* ==========================================================================
   Tier Ranker Container
   ========================================================================== */

.tier-ranker-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.tier-subtitle {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
    text-align: center;
}

/* ==========================================================================
   Filters & Stats
   ========================================================================== */

.tier-filters {
    background: var(--wakasm-darker, #2d2d2d);
    border: 2px solid var(--wakasm-border, #444444);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.total-count,
.tier-count {
    background: #4da44b;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}

.filter-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-controls label {
    font-weight: bold;
    color: var(--wakasm-light, #e0e0e0);
}

.filter-controls select,
.filter-controls input {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.filter-controls select:focus,
.filter-controls input:focus {
    border-color: #4da44b;
    outline: none;
    box-shadow: 0 0 0 2px rgba(77, 164, 75, 0.2);
}

.tier-stats {
    display: flex;
    justify-content: space-around;
    background: #2d2d2d;
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #4da44b;
}

/* ==========================================================================
   Tier Sections
   ========================================================================== */

.tier-section {
    margin-bottom: 40px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tier-header {
    padding: 20px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.tier-title {
    font-size: 28px;
    font-weight: bold;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.tier-description {
    font-size: 16px;
    opacity: 0.9;
    font-style: italic;
}

.tier-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    backdrop-filter: blur(5px);
}

/* ==========================================================================
   View Toggle Controls
   ========================================================================== */

.view-toggle-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 30px 0;
    padding: 20px;
    background: var(--wakasm-darker, #2d2d2d);
    border-radius: 10px;
    border: 2px solid var(--wakasm-border, #444444);
}

.view-toggle-controls label {
    color: var(--wakasm-light, #e0e0e0);
    font-weight: bold;
    margin-right: 10px;
}

.view-button {
    padding: 10px 20px;
    border: 2px solid var(--wakasm-border, #444444);
    background: var(--wakasm-dark, #1a1a1a);
    color: var(--wakasm-light, #e0e0e0);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: bold;
}

.view-button:hover {
    background: var(--wakasm-green, #4da44b);
    border-color: var(--wakasm-green, #4da44b);
    color: white;
}

.view-button.active {
    background: var(--wakasm-green, #4da44b);
    border-color: var(--wakasm-green, #4da44b);
    color: white;
}

/* ==========================================================================
   Play-mode / filter toggle (segmented pill group)
   ========================================================================== */

/* Outer wrap just centers the pill group horizontally. */
.tier-filter-toggle-wrap {
    text-align: center;
    margin-bottom: 20px;
}

/* The pill group itself — inline-flex so it sizes to its content, plus a
   border + padding that makes the children look like segments of a single
   control. Extensible: add more .tier-filter-option children and they all
   get the same styling. */
.tier-filter-toggle {
    display: inline-flex;
    background: #2d2d2d;
    border: 1px solid var(--wakasm-border, #444);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.tier-filter-option {
    padding: 8px 22px;
    border-radius: 6px;
    color: var(--wakasm-light, #e0e0e0);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: background-color 0.18s ease, color 0.18s ease;
    white-space: nowrap;
}

.tier-filter-option:hover,
.tier-filter-option:focus-visible {
    background: rgba(77, 164, 75, 0.18);
    color: #fff;
    outline: none;
}

.tier-filter-option.is-active {
    background: var(--wakasm-green, #4da44b);
    color: #fff;
}

.tier-filter-option.is-active:hover,
.tier-filter-option.is-active:focus-visible {
    background: var(--wakasm-green-dark, #059669);
}

/* Mobile: shrink the pill padding slightly so two options fit comfortably
   even on ~360px screens. */
@media (max-width: 480px) {
    .tier-filter-option {
        padding: 6px 14px;
        font-size: 13px;
    }
}

/* ==========================================================================
   Simple View - Box Art Only
   ========================================================================== */

/* Base thumbnail frame */
.tier-game-simple {
    display: inline-block;
    margin: 4px;
    transition: transform 0.2s ease;
    vertical-align: top;
    overflow: hidden;
    border-radius: 6px;
    /* Default to vertical box-art proportions so images don't render at
       their full natural size on initial paint before tier-ranker.js
       classifies each image by aspect ratio and applies .thumb--v /
       .thumb--sq / .thumb--h (which override width/height below). Most
       box art is vertical; non-vertical items briefly use vertical
       dimensions before JS adjusts to their actual aspect — ~50ms
       flicker max, far less jarring than 400px -> 124px snap. */
    width: 89px;
    height: 124px;
}

.tier-game-simple:hover {
    transform: scale(1.05);
    z-index: 10;
}

/* Three target box sizes based on aspect ratio */
.tier-game-simple.thumb--v  { width: 89px;  height: 124px; }  /* vertical */
.tier-game-simple.thumb--sq { width: 104px; height: 104px; } /* square */
.tier-game-simple.thumb--h  { width: 124px; height: 94px;  } /* horizontal */

/* Make the image fill the container completely */
.simple-game-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: 2px solid var(--wakasm-border, #444444);
    border-radius: 4px;
}

.tier-game-simple:hover .simple-game-thumb {
    border-color: var(--wakasm-green, #4da44b);
}

.simple-no-image-placeholder {
    /* Match typical game box proportions */
    width: 80px;
    height: 110px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: bold;
    border-radius: 6px;
    border: 2px solid var(--wakasm-border, #444444);
    transition: border-color 0.3s ease;
    flex-shrink: 0;
}

.tier-game-simple:hover .simple-no-image-placeholder {
    border-color: var(--wakasm-green, #4da44b);
}

/* Compact grid for simple view */
.tier-games {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 15px;
    min-height: 100px;
    align-content: flex-start;
}

/* When detailed view is active, switch to detailed grid */
.detailed-view-active .tier-games {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
}

/* ==========================================================================
   Game Cards (Detailed View)
   ========================================================================== */

/* Updated in Simple View section above */

/* Tier-specific backgrounds - darkened versions of tier colors */
.tier-section[data-tier="S"] .tier-games {
    background: rgba(255, 68, 68, 0.15); /* S-tier red with low opacity */
}

.tier-section[data-tier="A"] .tier-games {
    background: rgba(255, 119, 0, 0.15); /* A-tier orange with low opacity */
}

.tier-section[data-tier="B"] .tier-games {
    background: rgba(255, 187, 0, 0.15); /* B-tier yellow with low opacity */
}

.tier-section[data-tier="C"] .tier-games {
    background: rgba(119, 204, 0, 0.15); /* C-tier green with low opacity */
}

.tier-section[data-tier="D"] .tier-games {
    background: rgba(0, 204, 136, 0.15); /* D-tier teal with low opacity */
}

.tier-section[data-tier="E"] .tier-games {
    background: rgba(0, 136, 204, 0.15); /* E-tier blue with low opacity */
}

.tier-section[data-tier="F"] .tier-games {
    background: rgba(68, 0, 204, 0.15); /* F-tier purple with low opacity */
}

.tier-game-card {
    background: var(--wakasm-darker, #2d2d2d);
    border: 2px solid var(--wakasm-border, #444444);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tier-game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
    border-color: #4da44b;
}

.game-image {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: var(--wakasm-dark, #1a1a1a);
}

.tier-game-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Game media container for box art + optional showcase video side by side */
.game-media {
    display: flex;
    gap: 8px;
    height: 160px;
    overflow: hidden;
    background: var(--wakasm-dark, #1a1a1a);
}

.game-media .game-image {
    flex: 0 0 auto;
    width: auto;
    height: 100%;
    min-width: 100px;
}

.game-media .game-image img {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.game-media .game-showcase-video {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
}

.game-media .tier-game-video {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

/* When no video, let box art fill the space */
.game-media .game-image:only-child {
    width: 100%;
}

.game-media .game-image:only-child img {
    width: 100%;
    object-fit: cover;
}

.no-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 48px;
    font-weight: bold;
}

.game-info {
    padding: 15px;
}

.game-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    line-height: 1.3;
}

.game-title a {
    color: var(--wakasm-light, #e0e0e0);
    text-decoration: none;
    transition: color 0.3s ease;
}

.game-title a:hover {
    color: #4da44b;
}

.game-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.game-score {
    background: #4da44b;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.game-type-label {
    background: #6c757d;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    text-transform: uppercase;
}

.game-excerpt {
    font-size: 13px;
    color: var(--wakasm-gray, #999999);
    line-height: 1.4;
    margin: 0;
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.no-tiers-message {
    text-align: center;
    padding: 60px 20px;
    background: var(--wakasm-darker, #2d2d2d);
    border-radius: 10px;
    margin: 40px 0;
}

.no-tiers-message h3 {
    color: #4da44b;
    font-size: 24px;
    margin-bottom: 15px;
}

.no-tiers-message p {
    color: var(--wakasm-light, #e0e0e0);
    font-size: 16px;
    max-width: 600px;
    margin: 0 auto 15px;
}

.no-tiers-message code {
    background: var(--wakasm-dark, #1a1a1a);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    color: var(--wakasm-green, #4da44b);
}

.empty-tiers-toggle {
    text-align: center;
    margin: 40px 0 20px;
}

#toggle-empty-tiers {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#toggle-empty-tiers:hover {
    background: #5a6268;
}

.empty-tier {
    opacity: 0.6;
    margin-bottom: 20px;
}

.empty-tier .tier-games {
    padding: 40px;
    text-align: center;
    /* Empty tiers still get their color backgrounds */
}

.no-games {
    color: #999;
    font-style: italic;
    margin: 0;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .tier-ranker-container {
        padding: 10px;
    }

    .tier-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-stats {
        justify-content: center;
        flex-wrap: wrap;
    }

    .filter-controls {
        justify-content: center;
    }

    /* Tier header: more compact */
    .tier-section {
        margin-bottom: 20px;
    }

    .tier-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 12px 15px;
        gap: 4px;
    }

    .tier-title {
        font-size: 20px;
    }

    .tier-description {
        font-size: 13px;
    }

    .tier-count {
        padding: 3px 10px;
        font-size: 12px;
    }

    /* Box art thumbnails: smaller on mobile */
    .tier-game-simple {
        margin: 3px;
    }

    .tier-game-simple.thumb--v  { width: 70px;  height: 98px; }
    .tier-game-simple.thumb--sq { width: 80px;  height: 80px; }
    .tier-game-simple.thumb--h  { width: 98px;  height: 74px; }

    .simple-no-image-placeholder {
        width: 65px;
        height: 90px;
        font-size: 18px;
    }

    .tier-games {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 10px;
    }

    .game-image {
        height: 140px;
    }

    /* Page header: smaller title on mobile */
    .page-header .page-title {
        font-size: 1.4rem !important;
        padding-top: 10px !important;
    }

    .page-header p {
        font-size: 0.85em !important;
        margin: 5px 0 0 0 !important;
    }

    /* Stats: single horizontal row */
    .tier-stats {
        flex-direction: row;
        gap: 8px;
        padding: 10px 8px;
        margin-bottom: 20px;
    }

    .stat-item {
        flex: 1;
        min-width: 0;
    }

    .stat-label {
        font-size: 9px;
        margin-bottom: 2px;
    }

    .stat-value {
        font-size: 14px;
    }

    /* Empty tier sections: less padding */
    .empty-tier .tier-games {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .page-header .page-title {
        font-size: 1.2rem !important;
    }

    .stat-label {
        font-size: 8px;
    }

    .stat-value {
        font-size: 12px;
    }

    .tier-title {
        font-size: 18px;
    }

    .tier-description {
        font-size: 12px;
    }

    /* Force exactly 4 per row on small phones */
    .tier-games {
        gap: 4px !important;
        padding: 8px !important;
    }

    .tier-game-simple {
        margin: 0 !important;
        width: calc(25% - 3px) !important;
        height: auto !important;
        box-sizing: border-box;
    }

    .tier-game-simple.thumb--v,
    .tier-game-simple.thumb--sq,
    .tier-game-simple.thumb--h {
        width: calc(25% - 3px) !important;
        height: auto !important;
    }

    .tier-game-simple img {
        width: 100% !important;
        height: auto !important;
        object-fit: cover;
    }

    .simple-no-image-placeholder {
        width: 100% !important;
        height: 72px;
        font-size: 14px;
    }

    .game-image {
        height: 120px;
    }

    .game-info {
        padding: 12px;
    }

    .game-title {
        font-size: 14px;
    }
}

/* ==========================================================================
   Dark Mode Support (if theme supports it)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .tier-filters {
        background: #2d2d2d;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .filter-controls label {
        color: #e0e0e0;
    }
    
    .filter-controls select,
    .filter-controls input {
        background: #1a1a1a;
        border-color: #555;
        color: #e0e0e0;
    }
    
    .tier-game-card {
        background: #2d2d2d;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .game-title a {
        color: #e0e0e0;
    }
    
    .game-title a:hover {
        color: #4da44b;
    }
    
    .game-excerpt {
        color: #ccc;
    }
    
    .no-image-placeholder {
        background: linear-gradient(135deg, #444 0%, #666 100%);
    }
    
    .no-tiers-message {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .no-tiers-message code {
        background: #444;
        color: #4da44b;
    }
}

/* ==========================================================================
   Shared tier ranker page wrapper styling
   Extracted from inline <style> blocks in page-tier-ranker.php +
   page-boardgame-tier-ranks.php on 2026-04-21. Applied via the shared
   .tier-ranker-page class on the <article> element.
   ========================================================================== */

.tier-ranker-page {
    min-height: 100vh;
    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;
}

.tier-ranker-page::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;
}

.tier-ranker-page::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;
}

.tier-ranker-page .page-header {
    text-align: center;
    margin-bottom: 15px;
    padding: 30px 0;
    background: linear-gradient(135deg, #2d2d2d 0%, #1f1f1f 100%);
    border-radius: 12px;
    border: 1px solid #404040;
    position: relative;
}

.tier-ranker-page .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;
}

.tier-ranker-page .page-title {
    color: #ffffff;
    margin-bottom: 10px;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

@media (max-width: 768px) {
    .tier-ranker-page .page-title {
        font-size: 2rem;
    }
}