/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: #141827;
    color: #f3f4f6;
    line-height: 1.5;
}

/* Color Variables */
:root {
    --cg-bg: #141827;
    --cg-sidebar: #1a1f33;
    --cg-card: #232942;
    --cg-blue: #4f86f7;
    --cg-orange: #ff6b35;
    --cg-green: #22c55e;
    --cg-red: #ef4444;
    --cg-purple: #a855f7;
    --cg-yellow: #FFD700;
    --cg-pink: #FFC0CB;
    --border-color: #2d3748;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--cg-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--cg-card);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--cg-blue);
}

/* Main App Layout */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background-color: var(--cg-sidebar);
    border-bottom: 1px solid var(--border-color);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    background-color: var(--cg-blue);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.125rem;
}

.logo-text {
    color: white;
    font-weight: bold;
    font-size: 1.125rem;
    line-height: 1;
}

.header-search {
    flex: 1;
    max-width: 28rem;
    margin: 0 2rem;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    background-color: var(--cg-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: white;
    font-size: 0.875rem;
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-input:focus {
    outline: none;
    border-color: var(--cg-blue);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.login-btn {
    padding: 0.5rem 1rem;
    background-color: var(--cg-blue);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.login-btn:hover {
    background-color: #3b72d4;
}

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
}

/* Sidebar */
.sidebar {
    width: 16rem;
    background-color: var(--cg-sidebar);
    border-right: 1px solid var(--border-color);
    min-height: calc(100vh - 73px);
}

.sidebar-nav a.sidebar-item {
    text-decoration: none;
    color: inherit;
}

.sidebar-content {
    padding: 1rem;
}

.welcome-section {
    margin-bottom: 1.5rem;
}

.welcome-section h2 {
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #d1d5db;
}

.feature-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
}

.feature-dot.blue { background-color: var(--cg-blue); }
.feature-dot.green { background-color: var(--cg-green); }
.feature-dot.orange { background-color: var(--cg-orange); }
.feature-dot.purple { background-color: var(--cg-purple); }

/* Sidebar Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #d1d5db;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.sidebar-item:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-item.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-icon {
    font-size: 1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
}

.games-section {
    margin-bottom: 2rem;
}

.section-title {
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

@media (min-width: 768px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .games-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.games-grid.featured {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

@media (min-width: 1024px) {
    .games-grid.featured {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Game Cards */
.game-card {
    position: relative;
    aspect-ratio: 16 / 9;
    background-color: var(--cg-card);
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

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

.card-background {
    position: absolute;
    inset: 0;
    opacity: 0.2;
}

.card-background.has-image {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 1;
  transition: transform 0.4s ease;
  transform: scale(1.2);
}

.game-card:hover .card-background.has-image {
  transform: scale(1);
}

.card-background.blue-purple {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

.card-background.green-blue {
    background: linear-gradient(135deg, #10b981, #3b82f6);
}

.card-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    z-index: 1;
}

.game-title {
    font-size: 1.125rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.game-subtitle {
    font-size: 0.875rem;
    opacity: 0.75;
}

/* Badges */
.badge {
    position: relative;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    border-radius: 0.25rem;
    z-index: 2;
}

.badge.hot {
    background-color: var(--cg-orange);
}

.badge.new {
    background-color: var(--cg-purple);
}

.badge.updated {
    background-color: var(--cg-blue);
}

.badge.top-rated {
    background-color: var(--cg-green);
}

.badge.developer-rated {
    background-color: var(--cg-yellow);
}

.badge.not-working {
    background-color: var(--cg-red);
}

.badge.only-here {
    background-color: var(--cg-pink);
}

.game-card > .badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
}

.game-card {
  position: relative; /* ← This is the missing piece */
  aspect-ratio: 16 / 9;
  background-color: var(--cg-card);
  border-radius: 0.5rem;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}

.game-button {
  position: relative;
  width: 200px;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  text-shadow: 0 0 4px black;
  background-color: #000; /* fallback */
}

.game-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(8px) brightness(0.6);
  z-index: 0;
}

.game-button .game-label {
  position: relative;
  z-index: 1;
}


/* Responsive Design */
@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-height: auto;
    }

    .header {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .header-search {
        order: 3;
        flex-basis: 100%;
        margin: 0;
    }

    .sidebar-content {
        padding: 1rem;
    }

    .sidebar-nav {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.5rem;
    }

    .main-content {
        padding: 1rem;
    }
}

.link-card {
    display: block;
    text-decoration: none;
    color: inherit;
    margin: 10px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #4f86f7, #8e44ad);
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.link-card:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.link-card::before {
    content: "🎮 ";
    font-size: 1.2em;
    margin-right: 6px;
}

.link-card b, .link-card p {
    margin: 0;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
}

.settings-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
}

.settings-icon {
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.settings-dropdown {
  display: none;
  position: absolute;
  top: 40px;
  right: 0;
  background-color: #2e3440;
  border: 1px solid #4c566a;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  color: #eceff4;
  font-size: 0.9rem;
  width: 240px;
}

.settings-dropdown label {
  display: block;
  margin-bottom: 0.75rem;
}

.settings-dropdown input {
  width: 100%;
  padding: 0.4rem;
  margin-top: 0.25rem;
  border: 1px solid #4c566a;
  border-radius: 4px;
  background-color: #3b4252;
  color: #eceff4;
}

.settings-dropdown button {
  width: 100%;
  padding: 0.5rem;
  background-color: #00f2ff;
  color: #000;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

.settings-dropdown button:hover {
  background-color: #00c2cc;
}

.settings-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
}

.settings-toggle {
  font-size: 1.5rem;
  background: none;
  border: none;
  color: #eceff4;
  cursor: pointer;
}

.settings-dropdown {
  display: none;
  position: absolute;
  top: 40px;
  right: 0;
  background-color: #2e3440;
  border: 1px solid #4c566a;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  color: #eceff4;
  font-size: 0.9rem;
  width: 240px;
}

.settings-dropdown label {
  display: block;
  margin-bottom: 0.75rem;
}

.settings-dropdown input {
  width: 100%;
  padding: 0.4rem;
  margin-top: 0.25rem;
  border: 1px solid #4c566a;
  border-radius: 4px;
  background-color: #3b4252;
  color: #eceff4;
}

.settings-dropdown button {
  width: 100%;
  padding: 0.5rem;
  background-color: #00f2ff;
  color: #000;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

.settings-dropdown button:hover {
  background-color: #00c2cc;
}

.settings-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.settings-actions button {
  width: 50%;
  padding: 0.5rem;
  background-color: #bf616a; /* soft red tone */
  color: #eceff4;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

.settings-actions button:hover {
  background-color: #d08770;
}

.apply-btn {
  margin-top: 1rem;
  width: 100%;
  padding: 0.5rem;
  background-color: #00f2ff;
  color: #000;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

.apply-btn:hover {
  background-color: #00c2cc;
}

/* Notification CSS */
.notif {
  position: fixed;
  right: 20px;
  top: 24px;
  bottom: auto;
  width: 320px;
  max-width: calc(100% - 48px);
  background: linear-gradient(180deg,#0b1530,#06102a);
  color: #e6f7ff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
  overflow: hidden;
  z-index: 20000;
  transform: translateY(16px) scale(0.995);
  opacity: 0;
  transition: transform 260ms cubic-bezier(.2,.9,.3,1), opacity 260ms;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  border: 1px solid rgba(255,255,255,0.04);
}
.notif-inner {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
}
.notif-left { display:flex; flex-direction:column; gap:6px; }
.notif-title { font-size:14px; color:#b7f7b7; }
.notif-message { font-size:13px; color:#dbeeff; line-height:1.15; }

/* Buttons */
.notif-actions { display:flex; gap:8px; align-items:center; }
.notif-btn {
  background: transparent;
  border: none;
  color: #cde8ff;
  padding:6px 8px;
  font-size:13px;
  cursor:pointer;
  border-radius:8px;
}
.notif-btn:hover { background: rgba(255,255,255,0.03); }

/* Visible state */
.notif.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Hidden state */
.notif.hidden {
  pointer-events: none;
  display: block;
}

/* Small view */
@media (max-width:420px){
  .notif { right: 12px; left: 12px; width:auto; bottom:16px; }
  .notif-message { font-size:12px; }
}

:root{--accent1:#3b82f6;--accent2:#8b5cf6}
html,body{height:100%;margin:0;font-family:Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial}

/* OVERLAY — now above the entire website */
.overlay{
  position:fixed;
  inset:0;
  background:rgba(2,6,23,0.6);
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:none;
  opacity:0;
  transition:opacity .35s ease;
  z-index:999999;      /* ← FIX ADDED */
}

.overlay.visible{
  opacity:1;
  pointer-events:auto;
}

/* BANNER — now highest element on page */
.banner{
  width:min(680px,92%);
  background:linear-gradient(135deg,var(--accent1),var(--accent2));
  border-radius:14px;
  box-shadow:0 20px 40px rgba(2,6,23,0.6);
  transform:translateY(-30vh) scale(.98);
  opacity:0;
  transition:transform .6s cubic-bezier(.2,.9,.25,1),opacity .6s ease;
  padding:22px;
  position:relative;
  z-index:1000000;     /* ← FIX ADDED */
}

.overlay.visible .banner{
  transform:translateY(0) scale(1);
  opacity:1;
}

.banner-inner{
  background:linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  padding:22px;
  border-radius:10px;
  backdrop-filter:blur(6px);
}

.top-title{
  text-align:center;
  font-weight:800;
  font-size:1.35rem;
  letter-spacing:0.6px;
  margin:4px 0 10px;
}

.message{
  display:flex;
  gap:14px;
  align-items:center;
}

.message .text{flex:1}
.message p{margin:0;color:rgba(235,240,255,0.95)}

.thumb{
  width:74px;
  height:74px;
  border-radius:8px;
  background:rgba(255,255,255,0.08);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  flex-shrink:0;
}

.thumb img{
  max-width:100%;
  height:auto;
  display:block;
}

.btn{
  background:#02122b;
  border:none;
  padding:10px 14px;
  border-radius:10px;
  color:white;
  font-weight:700;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap:8px;
}

.btn.secondary{
  background:transparent;
  border:1px solid rgba(255,255,255,0.14);
}

.close{
  position:absolute;
  right:10px;
  top:8px;
  background:transparent;
  border:0;
  color:rgba(255,255,255,0.9);
  font-size:18px;
  cursor:pointer;
}

@media (max-width:520px){
  .message{flex-direction:column;align-items:flex-start}
  .top-title{font-size:1.1rem}
  .thumb{width:60px;height:60px}
}

/* --- POPUP GAME CONSOLE (Add to bottom of styles.css) --- */

/* Dark overlay covering the whole screen */
.modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); /* Darker dim */
    backdrop-filter: blur(5px);       /* Blur the background site */
    z-index: 99999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* The actual game window */
.game-window {
    background: var(--cg-bg); /* Matches your site background */
    width: 90%;
    height: 85%;
    max-width: 1100px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0,0,0,0.7);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

/* Animation classes */
.modal-overlay.active { display: flex; opacity: 1; }
.modal-overlay.active .game-window { transform: scale(1); }

/* The top bar */
.window-bar {
    background: var(--cg-sidebar);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

/* The Green "Saved" Text */
.save-status {
    color: var(--cg-green); /* Uses your green variable */
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0; /* Hidden until logged in */
    transition: opacity 0.3s;
}

/* Controls (Fullscreen / Close) */
.window-controls { display: flex; gap: 10px; }

.btn-control {
    background: var(--cg-card);
    color: #fff;
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.btn-control:hover { background: var(--cg-blue); border-color: var(--cg-blue); }
.btn-close:hover { background: var(--cg-red); border-color: var(--cg-red); }

/* The Game Area */
.iframe-container {
    flex-grow: 1;
    background: #000;
    position: relative;
}
iframe#game-frame {
    width: 100%; height: 100%; border: none; display: block;
}

#auth-modal {
    z-index: 100001 !important; /* Higher than game modal */
}
.error-msg {
    color: #ff6b6b;
    font-size: 0.85rem;
    margin-top: 10px;
    display: none; /* Hidden by default */
    background: rgba(255,0,0,0.1);
    padding: 8px;
    border-radius: 4px;
}
