/* ===================== */
/* KIDFUN - PREMIUM CSS  */
/* ===================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700;800&display=swap');

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --pink:   #ff5b92;
    --purple: #845ef7;
    --blue:   #4dabf7;
    --green:  #69db7c;
    --yellow: #ffd43b;
    --orange: #ff922b;
    --white:  #ffffff;
    --bg:     #0d0d2b;
    --card:   rgba(255,255,255,0.08);
    --text:   #f0f0ff;
    --radius: 24px;
    --shadow: 0 8px 32px rgba(0,0,0,0.3);
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(132,94,247,0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(255,91,146,0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(77,171,247,0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.sidebar {
    width: 88px;
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    gap: 8px;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
}

.logo {
    font-family: 'Fredoka One', cursive;
    font-size: 24px;
    background: linear-gradient(135deg, #ff5b92, #845ef7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    text-align: center;
    padding: 0 8px;
}

.sidebar a {
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    font-size: 22px;
    text-decoration: none;
    transition: all 0.2s;
    color: rgba(255,255,255,0.5);
    position: relative;
}

.sidebar a:hover, .sidebar a.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    transform: scale(1.1);
}

.sidebar a.active::before {
    content: '';
    position: absolute;
    left: -4px;
    width: 4px;
    height: 30px;
    background: linear-gradient(#ff5b92, #845ef7);
    border-radius: 0 4px 4px 0;
}

.main {
    flex: 1;
    padding: 24px;
    overflow-x: hidden;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.topbar input {
    flex: 1;
    padding: 14px 22px;
    border-radius: 40px;
    border: 1.5px solid rgba(255,255,255,0.12);
    outline: none;
    background: rgba(255,255,255,0.07);
    color: #fff;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    transition: border-color 0.2s, background 0.2s;
}
.topbar input::placeholder { color: rgba(255,255,255,0.35); }
.topbar input:focus {
    border-color: #845ef7;
    background: rgba(255,255,255,0.11);
}

.btn {
    background: linear-gradient(135deg, #ff5b92, #845ef7);
    padding: 12px 22px;
    border-radius: 30px;
    text-decoration: none;
    color: white;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    font-family: 'Nunito', sans-serif;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255,91,146,0.4); }

.banner {
    background: linear-gradient(135deg, #1a0533 0%, #2a0a4a 50%, #0a1a3a 100%);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    padding: 36px 32px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(132,94,247,0.3), rgba(255,91,146,0.2));
    border-radius: 24px;
}

.banner > * { position: relative; z-index: 1; }

.banner h2 {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(22px, 4vw, 36px);
    color: #fff;
    margin-bottom: 8px;
}
.banner p { color: rgba(255,255,255,0.7); font-size: 15px; margin-bottom: 20px; }

.banner .play-btn {
    background: linear-gradient(135deg, #ff5b92, #ff922b);
    padding: 12px 28px;
    border-radius: 30px;
    text-decoration: none;
    color: white;
    font-weight: 800;
    font-size: 15px;
    display: inline-block;
    box-shadow: 0 4px 20px rgba(255,91,146,0.4);
    transition: transform 0.15s;
}
.banner .play-btn:hover { transform: scale(1.05); }

.banner-img {
    font-size: clamp(36px, 6vw, 64px);
    letter-spacing: 8px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.section-title {
    font-family: 'Fredoka One', cursive;
    font-size: 22px;
    color: #fff;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-slider {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    margin-bottom: 32px;
    padding-bottom: 6px;
    scrollbar-width: none;
}
.category-slider::-webkit-scrollbar { display: none; }

.cat-card {
    background: rgba(255,255,255,0.07);
    border: 1.5px solid rgba(255,255,255,0.1);
    padding: 10px 22px;
    border-radius: 30px;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 14px;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    transition: all 0.2s;
}
.cat-card:hover, .cat-card.active {
    background: linear-gradient(135deg, #ff5b92, #845ef7);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
}

.games {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 18px;
    margin-bottom: 32px;
}

.card {
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.08);
    border-radius: 24px;
    padding: 14px;
    text-align: center;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, #ff5b92, #845ef7, #4dabf7);
    opacity: 0;
    transition: opacity 0.2s;
}
.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.2);
}
.card:hover::before { opacity: 1; }

.card img {
    width: 100%;
    border-radius: 16px;
    aspect-ratio: 1;
    object-fit: cover;
    background: rgba(255,255,255,0.05);
}

.card h4 {
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    margin: 10px 0 6px;
    line-height: 1.3;
}

.card .stars { color: #ffd43b; font-size: 12px; margin-bottom: 8px; }

.play-btn {
    display: inline-block;
    padding: 8px 18px;
    background: linear-gradient(135deg, #ff5b92, #845ef7);
    color: white;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    transition: transform 0.15s;
}
.play-btn:hover { transform: scale(1.05); }

.right-panel {
    width: 280px;
    background: rgba(255,255,255,0.04);
    border-left: 1px solid rgba(255,255,255,0.07);
    padding: 24px 20px;
    flex-shrink: 0;
}
.right-panel h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 18px;
    margin-bottom: 16px;
    color: #fff;
}

.points-widget {
    background: linear-gradient(135deg, rgba(132,94,247,0.3), rgba(255,91,146,0.2));
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}
.points-widget .pts {
    font-family: 'Fredoka One', cursive;
    font-size: 38px;
    color: #ffd43b;
}
.points-widget .pts-label {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.mini-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 12px 16px;
    border-radius: 16px;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.mini-card:hover {
    background: rgba(255,255,255,0.11);
    transform: translateX(4px);
}

.hamburger {
    display: none;
    font-size: 22px;
    color: white;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

.mobile-menu {
    position: fixed;
    top: 0; left: 0;
    transform: translateX(-100%);
    width: 260px;
    height: 100%;
    background: #120825;
    border-right: 1px solid rgba(255,255,255,0.1);
    padding: 48px 24px;
    transition: transform 0.3s ease;
    z-index: 1000;
}
.mobile-menu a {
    display: block;
    margin: 12px 0;
    text-decoration: none;
    color: rgba(255,255,255,0.8);
    font-weight: 700;
    font-size: 16px;
    padding: 12px 16px;
    border-radius: 14px;
    transition: all 0.2s;
}
.mobile-menu a:hover { background: rgba(255,255,255,0.08); color: white; }
.mobile-menu.show { transform: translateX(0); }

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
}
.overlay.show { display: block; }

/* LOGIN */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-box {
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 32px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(20px);
    text-align: center;
}
.login-box .icon { font-size: 64px; margin-bottom: 8px; }
.login-box h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 30px;
    color: #fff;
    margin-bottom: 8px;
}
.login-box p.sub { color: rgba(255,255,255,0.5); font-size: 14px; margin-bottom: 28px; }

.login-box input {
    width: 100%;
    padding: 14px 20px;
    border-radius: 16px;
    border: 1.5px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.07);
    color: white;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    margin-bottom: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.login-box input:focus { border-color: #845ef7; }
.login-box input::placeholder { color: rgba(255,255,255,0.35); }

.login-box button {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #ff5b92, #845ef7);
    color: white;
    font-family: 'Fredoka One', cursive;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    margin-top: 6px;
}
.login-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255,91,146,0.4);
}

.login-box .error {
    background: rgba(255,91,91,0.15);
    border: 1px solid rgba(255,91,91,0.3);
    border-radius: 12px;
    padding: 10px;
    color: #ff8a8a;
    margin-bottom: 16px;
    font-size: 14px;
}

.login-box .link {
    margin-top: 20px;
    font-size: 14px;
    color: rgba(255,255,255,0.5);
}
.login-box .link a { color: #845ef7; text-decoration: none; font-weight: 700; }

/* GAME PAGE */
/* ── Game player page styles removed ── */
/* play.php is now fully self-contained with its own inline CSS */
/* This avoids global body/html styles from interfering with the game iframe */

/* ADMIN */
.admin-wrapper { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 230px;
    background: rgba(255,255,255,0.04);
    border-right: 1px solid rgba(255,255,255,0.08);
    padding: 28px 20px;
    flex-shrink: 0;
}
.admin-sidebar h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 20px;
    color: #fff;
    margin-bottom: 24px;
}
.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    padding: 11px 14px;
    border-radius: 14px;
    margin-bottom: 6px;
    transition: all 0.2s;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}
.admin-content { flex: 1; padding: 36px; }
.admin-content h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 28px;
    color: #fff;
    margin-bottom: 24px;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255,255,255,0.04);
    border-radius: 16px;
    overflow: hidden;
}
.admin-table th {
    padding: 14px 18px;
    text-align: left;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.04);
}
.admin-table td {
    padding: 14px 18px;
    font-size: 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.8);
}
.admin-table tr:hover td { background: rgba(255,255,255,0.03); }

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-weight: 700;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-group input, .form-group select {
    width: 100%;
    max-width: 480px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1.5px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: white;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus { border-color: #845ef7; }
.form-group select option { background: #1a1a3e; }

.action-btn {
    padding: 7px 16px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    transition: all 0.15s;
}
.btn-danger { background: rgba(255,80,80,0.15); color: #ff8a8a; border: 1px solid rgba(255,80,80,0.2); }
.btn-danger:hover { background: rgba(255,80,80,0.25); }
.btn-success { background: rgba(105,219,124,0.15); color: #69db7c; border: 1px solid rgba(105,219,124,0.2); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 20px;
}
.stat-card .stat-val {
    font-family: 'Fredoka One', cursive;
    font-size: 36px;
    color: #fff;
}
.stat-card .stat-label { font-size: 13px; color: rgba(255,255,255,0.5); margin-top: 4px; }

/* RESPONSIVE */
@media (max-width: 1100px) { .right-panel { display: none; } }
@media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar { display: none; }
    .hamburger { display: flex; }
    .main { padding: 16px; }
    .banner { flex-direction: column; text-align: center; gap: 20px; }
    .games { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
    .login-box { padding: 32px 24px; }
    .admin-sidebar { display: none; }
    .admin-content { padding: 20px; }
}
@media (max-width: 400px) {
    .games { grid-template-columns: 1fr 1fr; }
}