/* MastiPlay - CSS Design System */

:root {
    --bg-main: #07090e;
    --bg-card: rgba(18, 22, 33, 0.75);
    --bg-card-hover: rgba(26, 32, 47, 0.9);
    --border-card: rgba(255, 255, 255, 0.08);
    --border-card-hover: rgba(var(--primary-rgb), 0.3);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Fallback Cyan Theme */
    --primary: #00f2fe;
    --secondary: #4facfe;
    --primary-rgb: 0, 242, 254;
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 10% 20%, rgba(var(--primary-rgb), 0.05) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(var(--primary-rgb), 0.03) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

a {
    color: inherit;
    text-decoration: none;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Glassmorphism utility */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass:hover {
    border-color: var(--border-card-hover);
    box-shadow: 0 8px 32px 0 rgba(var(--primary-rgb), 0.1);
}

/* Header */
header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    margin-top: 15px;
    margin-bottom: 30px;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border-radius: 8px;
    display: inline-block;
    position: relative;
    box-shadow: 0 0 15px var(--primary);
}

.logo-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background-color: var(--bg-main);
    border-radius: 3px;
}

nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

nav a {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

nav a:hover, nav a.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.btn-admin {
    border: 1px solid var(--primary);
    color: var(--primary) !important;
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.1);
}

.btn-admin:hover {
    background: var(--primary) !important;
    color: var(--bg-main) !important;
    box-shadow: 0 0 15px var(--primary);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 60px 20px;
    margin-bottom: 40px;
    position: relative;
}

.hero h1 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 15px;
    line-height: 1.2;
}

.hero h1 span {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--text-secondary);
    font-size: 18px;
    max-width: 600px;
    margin: 0 auto 30px auto;
}

/* Search Bar */
.search-container {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    background: rgba(18, 22, 33, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 30px;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: all 0.3s;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.2);
    background: rgba(18, 22, 33, 0.8);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Category Filters */
.categories {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.cat-btn {
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    transition: all 0.2s;
}

.cat-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.cat-btn.active {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: var(--bg-main);
    border-color: transparent;
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.3);
}

/* Game Grid */
.section-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 24px;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
    border-radius: 2px;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
    margin-bottom: 60px;
}

.game-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
}

.game-card:hover .game-img img {
    transform: scale(1.08);
}

.game-img {
    position: relative;
    width: 100%;
    aspect-ratio: 16/11;
    overflow: hidden;
    border-radius: 12px;
    background-color: #161b26;
}

.game-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.game-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    background: rgba(7, 9, 14, 0.85);
    border: 1px solid var(--primary);
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
    border-radius: 6px;
    text-transform: uppercase;
}

.game-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.game-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 34px;
    margin-bottom: 12px;
}

.btn-play-sm {
    margin-top: auto;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.game-card:hover .btn-play-sm {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: var(--bg-main);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.2);
}

/* Dynamic Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-weight: 500;
    display: none;
}

.spinner {
    display: inline-block;
    width: 25px;
    height: 25px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Game Detail & Play View */
.game-play-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    margin-bottom: 50px;
}

@media (max-width: 900px) {
    .game-play-container {
        grid-template-columns: 1fr;
    }
}

.game-viewport {
    width: 100%;
    aspect-ratio: 16/10;
    position: relative;
    overflow: hidden;
    background: #000;
    border-radius: 20px;
}

.game-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Native Canvas Wrapper */
.canvas-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.game-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 25px;
    margin-top: 15px;
}

.game-details-card {
    padding: 25px;
    margin-bottom: 30px;
}

.game-details-card h2 {
    font-size: 22px;
    margin-bottom: 12px;
}

.game-details-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 15px;
    margin-bottom: 20px;
}

.controls-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
}

.controls-box h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--primary);
}

.controls-box ul {
    list-style: none;
    font-size: 13px;
    color: var(--text-secondary);
}

.controls-box li {
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

/* Sidebar Ads / Recs */
.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.ad-wrapper {
    min-height: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 12px;
}

/* Policy Pages Layout */
.page-card {
    padding: 40px;
    margin-bottom: 50px;
    line-height: 1.7;
}

.page-card h1 {
    font-size: 32px;
    margin-bottom: 25px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-card h2 {
    font-size: 20px;
    margin-top: 30px;
    margin-bottom: 15px;
}

.page-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 15px;
}

.page-card ul {
    margin-left: 20px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.page-card li {
    margin-bottom: 8px;
}

/* Admin Panel Styling */
.admin-grid {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
    margin-bottom: 50px;
}

@media (max-width: 768px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

.admin-sidebar {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-tab {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.admin-tab:hover, .admin-tab.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.admin-tab.active {
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
}

.admin-content {
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(7, 9, 14, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
}

.btn-submit {
    padding: 12px 30px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: var(--bg-main);
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.2);
}

.btn-submit:hover {
    box-shadow: 0 0 20px var(--primary);
}

.color-picker {
    display: flex;
    gap: 15px;
}

.color-option {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.color-option.active {
    border-color: #fff;
    transform: scale(1.1);
}

/* Footer */
footer {
    padding: 40px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 50px;
}

footer .links {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
}

footer a {
    color: var(--text-secondary);
    transition: color 0.2s;
}

footer a:hover {
    color: var(--primary);
}

/* Media Queries for Mobile Responsiveness */
@media (max-width: 768px) {
    header {
        height: auto;
        min-height: 70px;
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px 20px;
    }
    
    header .logo {
        margin-bottom: 5px;
    }

    nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        width: 100%;
    }

    nav a {
        font-size: 14px;
        padding: 6px 12px;
    }
    
    .hero {
        padding: 40px 15px;
        margin-bottom: 25px;
    }
    
    .hero h1 {
        font-size: 32px;
    }
    
    .hero p {
        font-size: 15px;
    }
    
    .grid-filters {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
        margin-bottom: 25px;
    }
    
    .filter-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
    
    .game-card h3 {
        font-size: 14px;
    }
    
    .game-card p {
        font-size: 12px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

@media (max-width: 480px) {
    header {
        padding: 15px 12px;
    }
    
    nav {
        gap: 5px;
    }
    
    nav a {
        font-size: 13px;
        padding: 5px 8px;
    }
    
    .hero h1 {
        font-size: 26px;
    }
    
    .hero {
        padding: 30px 10px;
    }
    
    .game-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
    
    .game-card {
        padding: 10px;
    }
    
    .game-card img {
        height: 100px;
    }
}
