/* Game Statistics Page Styles - Bento Box Layout */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

/* Override WordPress theme constraints for full width */
.site-main,
#main,
.content-area,
#primary {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.site-content,
#content {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.game-stats-container {
    width: 100%;
    margin: 0;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0f0f0f;
    min-height: 100vh;
    color: #ffffff;
    box-sizing: border-box;
}

.stats-header {
    margin-bottom: 30px;
    padding: 30px;
    background: #1a1a1a;
    color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid #333333;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.logo-container {
    flex-shrink: 0;
}

.header-logo {
    height: 60px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

.title-container {
    text-align: center;
    flex: 1;
    min-width: 300px;
}

/* Align title text to right on non-mobile devices */
@media (min-width: 769px) {
    .title-container {
        text-align: right;
    }
}

.stats-header h1 {
    margin: 0 0 10px 0;
    font-size: 2.2em;
    font-weight: 600;
    color: #ffffff;
}

.stats-header p {
    margin: 0;
    font-size: 1.1em;
    color: #cccccc;
}

/* Bento Box Grid Layout */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

/* Large Chart Section - Spans 8 columns */
.stats-section.large {
    grid-column: span 8;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid #333333;
    overflow: hidden;
}

/* Medium Chart Section - Spans 6 columns */
.stats-section.medium {
    grid-column: span 6;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid #333333;
    overflow: hidden;
}

/* Small Stats Section - Spans 4 columns */
.stats-section.small {
    grid-column: span 4;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid #333333;
    overflow: hidden;
}

/* Full Width Section */
.stats-section.full {
    grid-column: span 12;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid #333333;
    overflow: hidden;
}

/* Empty placeholder section */
.stats-section.empty {
    background: #1a1a1a;
    border: 2px dashed #444444;
    opacity: 0.7;
}

.stats-section.empty .chart-container {
    background: #2a2a2a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 320px;
}

.placeholder-content {
    text-align: center;
    color: #888888;
}

.placeholder-icon {
    font-size: 3em;
    margin-bottom: 10px;
    opacity: 0.5;
}

.placeholder-content p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.7;
}

.stats-chart {
    padding: 20px;
}

.chart-container {
    text-align: center;
    padding: 15px;
    background: #2a2a2a;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    height: 400px;
    display: flex;
    flex-direction: column;
}

.chart-container h3 {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-size: 1.2em;
    font-weight: 600;
}

.chart-container canvas {
    flex: 1;
    width: 100% !important;
    max-width: 100%;
    max-height: 320px;
}

.chart-container p {
    margin: 0 0 10px 0;
    color: #cccccc;
    font-size: 0.85em;
    font-style: italic;
}

/* Retention Section */
.retention-container {
    padding: 20px;
}

.retention-header {
    text-align: center;
    margin-bottom: 15px;
}

.retention-header h3 {
    margin: 0 0 6px 0;
    color: #ffffff;
    font-size: 1.2em;
    font-weight: 600;
}

.retention-header p {
    margin: 0;
    color: #cccccc;
    font-size: 0.85em;
}

.retention-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 15px;
}

.retention-chart-container {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    width: 100%;
    border: 1px solid #333333;
}

.retention-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
}

.retention-table-container {
    overflow-x: auto;
    border-radius: 8px;
    background: #2a2a2a;
    border: 1px solid #333333;
}

.retention-table {
    width: 100%;
    border-collapse: collapse;
    background: #2a2a2a;
}

.retention-table th {
    background: #333333;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #ffffff;
    border-bottom: 1px solid #444444;
    font-size: 0.9em;
}

.retention-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #444444;
    vertical-align: middle;
    font-size: 0.9em;
    color: #ffffff;
}

.retention-table tr:hover {
    background-color: #333333;
}

.interval-name {
    font-weight: 500;
    color: #ffffff;
}

.retention-rate {
    text-align: center;
    font-weight: 600;
    border-radius: 6px;
    padding: 6px 10px;
    color: #333333;
    transition: background-color 0.3s ease;
}

.retention-rate.high {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    color: #333333;
}

.retention-rate.medium {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    color: #1976d2;
}

.retention-rate.low {
    background: #bbdefb;
    border: 1px solid #90caf9;
    color: #0d47a1;
}

/* User Statistics */
.user-stats-container {
    padding: 20px;
}

.user-stats-header {
    text-align: center;
    margin-bottom: 15px;
}

.user-stats-header h3 {
    margin: 0 0 6px 0;
    color: #ffffff;
    font-size: 1.2em;
    font-weight: 600;
}

.user-stats-header p {
    margin: 0;
    color: #cccccc;
    font-size: 0.85em;
}

.user-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.stat-card {
    border: 1px solid #333333;
    color: white;
    padding: 16px;
    border-radius: 10px;
    text-align: center;
    
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.stat-number {
    font-family: 'EB Garamond', serif;
    font-size: 1.8em;
    font-weight: 600;
    margin-bottom: 6px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    color: orange
}

.stat-label {
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.95;
}

.stat-description {
    font-size: 0.8em;
    opacity: 0.8;
    line-height: 1.2;
}

/* Hours Played Section */
.hours-played-container {
    padding: 24px;
}

.hours-played-header {
    text-align: center;
    margin-bottom: 20px;
}

.hours-played-header h3 {
    color: #ffffff;
    margin: 0 0 8px 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.hours-played-header p {
    color: #cccccc;
    margin: 0;
    font-size: 0.9rem;
}

.update-summary-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.update-summary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.update-summary-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Admin Controls */
.admin-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

.cache-btn {
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cache-btn:hover {
    transform: translateY(-1px);
}

.cache-btn:disabled {
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.regenerate-btn {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.regenerate-btn:hover {
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

.regenerate-btn:disabled {
    background: #6c757d;
}

.clear-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.clear-btn:hover {
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.clear-btn:disabled {
    background: #6c757d;
}

.status-btn {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.status-btn:hover {
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.status-btn:disabled {
    background: #6c757d;
}

.hours-played-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.hours-played-grid .stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.hours-played-grid .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.hours-played-grid .stat-number {
    font-family: 'EB Garamond', serif;
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.hours-played-grid .stat-label {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
    opacity: 0.95;
}

.hours-played-grid .stat-description {
    font-size: 0.85rem;
    opacity: 0.8;
    line-height: 1.3;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #cccccc;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .stats-section.large {
        grid-column: span 12;
    }
    
    .stats-section.medium {
        grid-column: span 6;
    }
    
    .stats-section.small {
        grid-column: span 6;
    }
    
    .stats-section.full {
        grid-column: span 12;
    }
}

@media (max-width: 768px) {
    .game-stats-container {
        padding: 15px;
    }
    
    .stats-grid {
        gap: 15px;
    }
    
    .stats-section.large,
    .stats-section.medium,
    .stats-section.small,
    .stats-section.full {
        grid-column: span 12;
    }
    
    .header-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .header-logo {
        height: 50px;
        max-width: 150px;
    }
    
    .title-container {
        min-width: auto;
    }
    
    .stats-header h1 {
        font-size: 1.8em;
    }
    
    .stats-header p {
        font-size: 1em;
    }
    
    .chart-container {
        padding: 15px;
        height: 350px;
    }
    
    .chart-container canvas {
        max-height: 280px;
    }
    
    .retention-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .retention-chart-container {
        height: 350px;
        width: 100%;
    }
    
    .retention-table th,
    .retention-table td {
        padding: 10px 12px;
        font-size: 0.85em;
    }
    
    .retention-rate {
        padding: 4px 8px;
        font-size: 0.8em;
    }
    
    .stat-card {
        padding: 18px;
    }
    
    .stat-number {
        font-size: 1.8em;
    }
    
    .stat-label {
        font-size: 0.95em;
    }
    
    .stat-description {
        font-size: 0.8em;
    }
    
    .placeholder-icon {
        font-size: 2.5em;
    }
    
    .admin-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .cache-btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .stats-header h1 {
        font-size: 1.5em;
    }
    
    .chart-container h3,
    .retention-header h3,
    .user-stats-header h3,
    .hours-played-header h3 {
        font-size: 1.1em;
    }
    
    .chart-container {
        height: 300px;
    }
    
    .chart-container canvas {
        max-height: 240px;
    }
    
    .retention-chart-container {
        height: 300px;
    }
    
    .retention-table {
        font-size: 0.8em;
    }
    
    .retention-table th,
    .retention-table td {
        padding: 8px 10px;
    }
    
    .stat-number {
        font-size: 1.6em;
    }
}

/* Print Styles */
@media print {
    .game-stats-container {
        max-width: none;
        padding: 0;
        background: white;
        color: black;
    }
    
    .stats-header {
        background: white !important;
        color: black !important;
        border: 2px solid #333;
    }
    
    .stats-section {
        break-inside: avoid;
        margin-bottom: 20px;
        box-shadow: none;
        border: 1px solid #ccc;
        background: white !important;
        color: black !important;
    }
    
    .chart-container {
        background: white !important;
        color: black !important;
    }
    
    .retention-table-container {
        box-shadow: none;
        border: 1px solid #ccc;
        background: white !important;
    }
    
    .retention-table {
        background: white !important;
        color: black !important;
    }
    
    .retention-table th,
    .retention-table td {
        color: black !important;
    }
    
    .stat-card {
        background: white !important;
        color: black !important;
        border: 1px solid #ccc;
    }
}

/* Level Distribution Chart Styles */
.level-distribution-container {
    height: 450px;
}

.level-distribution-container canvas {
    max-height: 380px;
}

@media (max-width: 768px) {
    .level-distribution-container {
        height: 400px;
    }
    
    .level-distribution-container canvas {
        max-height: 330px;
    }
}

@media (max-width: 480px) {
    .level-distribution-container {
        height: 350px;
    }
    
    .level-distribution-container canvas {
        max-height: 280px;
    }
}

/* Game Screenshot and Try Button Styles */
.game-screenshot-container {
    padding: 20px;
    text-align: center;
}

.game-screenshot-container h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.4em;
    font-weight: 600;
}

.screenshot-button-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.screenshot-link {
    display: block;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.screenshot-link:hover {
    transform: scale(1.02);
}

.game-screenshot {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid #e0e0e0;
}

.try-button {
    display: inline-block;
    background: #4CAF50;
    color: white;
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    border: none;
    cursor: pointer;
    min-width: 200px;
}

.try-button:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
    color: white;
    text-decoration: none;
}

.try-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

/* Responsive styles for screenshot and button */
@media (max-width: 768px) {
    .game-screenshot-container {
        padding: 15px;
    }
    
    .game-screenshot-container h3 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
    
    .screenshot-button-wrapper {
        gap: 15px;
    }
    
    .try-button {
        padding: 12px 24px;
        font-size: 1.1em;
        min-width: 180px;
    }
}

@media (max-width: 480px) {
    .game-screenshot-container {
        padding: 10px;
    }
    
    .game-screenshot-container h3 {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
    
    .try-button {
        padding: 10px 20px;
        font-size: 1em;
        min-width: 160px;
    }
}