/* ================================
   Color Palette (Dark Gray / Mint-Teal)
================================ */
:root {
  --bg-dark: #121212;
  --bg-medium: #1e1e1e;
  --bg-light: #2c2c2c;
  --text-primary: #ffffff;
  --text-secondary: #aaaaaa;
  --accent-color: #00e676; /* Mint-Teal Accent */
  --accent-hover: #00c853;
  --nav-bar-bg: #000000;
  --hero-accent-text: #020e08;
  --shadow-color: rgba(0, 0, 0, 0.4);
}

/* ================================
   General Reset
================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 13px;
}

/* ================================
   Navigation Bar (FINAL FIXED VERSION)
================================ */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center; /* This is the "magic" line that snaps them onto one horizontal line */
  height: 60px;
  padding: 0 30px;
  background-color: var(--nav-bar-bg);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-left {
  flex: 1; 
  display: flex;
  align-items: center; 
  justify-content: flex-start;
}

/* This handles the Login side */
.header-right {
  flex: 1;
  display: flex;
  align-items: center; 
  justify-content: flex-end;
}

/* This handles the Search Bar */
.search-container {
  flex: 0 0 320px; /* Keeps search bar at a fixed width */
  height: 40px;    
  display: flex;
  align-items: center;
  margin: 0 20px; /* Adds space on the sides */
}

/* --- RIGHT SIDE (Login) --- */
.header-right {
  flex: 1;
  display: flex;
  align-items: center; 
  justify-content: flex-end;
}

/* ================================
   Updated POEM PlayHub Logo 
================================ */
.logo {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
  font-family: 'Russo One', sans-serif;
  text-transform: uppercase;
  margin-right: 20px;
  position: relative;
}

.brand-poem {
  font-size: 28px;
  letter-spacing: 1.5px;
  color: var(--text-primary);
  margin-bottom: -2px;
}

.brand-playhub {
  font-size: 14px;
  color: var(--accent-color);
  letter-spacing: 2px;
}

/* ================================
   Search Bar (Centered)
================================ */
.search-container {
  flex: 0 0 320px; /* Keeps the search bar at a fixed size */
  height: 30px;    
  display: flex;
  align-items: center;
  background-color: var(--bg-medium);
  border-radius: 50px;
  padding: 0 15px;
  border: 1px solid #3d5166;
  margin: 0 20px;
}

.search-container input {
  border: none;
  background: transparent;
  color: var(--text-primary);
  outline: none;
  flex-grow: 1;
  font-size: 14px;
  height: 100%; 
}

.search-container i {
  color: var(--accent-color);
  margin-left: 10px;
  font-size: 13px;
}

/* ================================
   Login Button
================================ */
.login-btn {
  background-color: var(--accent-color);
  color: var(--nav-bar-bg);
  border: none;
  padding: 7px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  transition: background-color 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 12px;
  box-shadow: none;
}

.login-btn:hover {
  background-color: var(--accent-hover);
  box-shadow: 0 0 5px rgba(0, 230, 118, 0.5);
}

.logo {
  display: flex;
  align-items: center; /* Keeps the image centered vertically */
  cursor: pointer;
}

.logo-img {
  height: 40px;      /* Adjust this to fit your new shorter navbar */
  width: auto;       /* This keeps the logo from looking stretched */
  display: block;
}

/* ... KEEP THE REST OF YOUR CSS (Game Grid, etc.) FROM HERE DOWN ... */

/* ================================
   Game Grid Styling
================================ */
/* ===== CATEGORY BAR ===== */
.category-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.category-btn {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--accent-color);
    background: transparent;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.category-btn.active,
.category-btn:hover {
    background-color: var(--accent-color);
    color: var(--nav-bar-bg);
}


.game-grid-container {
  padding: 20px;
  width: 100%;
  margin: 0;
  transition: opacity 0.3s ease-out;
}

.game-grid-container.hidden {
  display: none;
  opacity: 0;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 15px;
  margin: 0 auto;
}

/* Tablet */
@media (max-width: 1024px) {
  .game-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .game-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .game-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ================================
   Game Card
================================ */
.game-card {
  background-color: var(--bg-medium);
  border: 1px solid rgba(0, 230, 118, 0.1);
  border-radius: 5px;
  padding: 0; /* important */
  text-align: center;
  box-shadow: 0 4px 10px var(--shadow-color);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
  overflow: hidden;
  position: relative;
  color: var(--text-primary);
  aspect-ratio: 1 / 1;
}

.game-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.game-card:hover {
    transform: scale(1.03); /* ✅ grows in same place */
    box-shadow: 0 10px 18px var(--shadow-color),
                0 0 12px rgba(0, 230, 118, 0.4);
    background-color: var(--bg-light);
    border-color: rgba(0, 230, 118, 0.3);
    z-index: 2; /* ✅ prevents overlap issues */
}

.game-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  transition: transform 0.2s;
}

.game-card:hover img {
  transform: scale(1.05);
}

/* ================================
   Modal Buttons & Inputs
================================ */
.submit-btn {
  width: 100%;
  margin-top: 12px;
  padding: 8px 0;
  background-color: var(--accent-color);
  color: var(--nav-bar-bg);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.submit-btn:hover {
  background-color: var(--accent-hover);
  box-shadow: 0 0 8px rgba(0, 230, 118, 0.6);
}

.form-group input {
  width: 100%;
  padding: 6px 8px;
  background-color: var(--bg-light);
  border: 1px solid #3d5166;
  border-radius: 3px;
  color: var(--text-primary);
  font-size: 12px;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 5px rgba(0, 230, 118, 0.4);
}

/* ================================
   Modal Styling
================================ */
.modal {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  z-index: 9999;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  background-color: rgba(0, 0, 0, 0.95);
}

#loginModal,
#signupModal {
  display: none;
}

.modal-content {
  background-color: var(--bg-dark);
  padding: 20px;
  border: 1px solid var(--accent-color);
  max-width: 320px;
  border-radius: 4px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.8);
  position: relative;
}

.modal-content h3 {
  font-size: 18px;
  color: var(--accent-color);
  margin-bottom: 12px;
  text-align: center;
}

.close-btn {
  font-size: 24px;
  color: var(--text-secondary);
  position: absolute;
  top: 5px;
  right: 10px;
  cursor: pointer;
}

.close-btn:hover,
.close-btn:focus {
  color: var(--accent-color);
}

/* ================================
   Game Player & Sidebar
================================ */
#game-player-container {
  padding: 20px 25px;
  max-width: 1300vmin;
  margin: 0 auto;
}

.game-area-layout {
  display: flex;
  gap: 10px;
}

.game-area-main {
    flex-grow: 0;            /* STOP growing! This keeps the sidebar close to the game */
    width: 100%;             /* Allows it to be full width up to its max */
    max-width: 1100px;       /* Optional limit */
}

.game-player-wrapper {
  display: flex;
  flex-direction: column;
  width: 150vmin;
  height: 80vmin;
  background: #000;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--bg-light);
  margin-bottom: 20px;
}

#game-player-frame {
  flex-grow: 1;
  width: 150vmin;
  border: none;
}

/* Bottom Bar */
.game-bottom-bar {
  flex-shrink: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: #1e1e1e;
  color: var(--accent-color);
  font-weight: 600;
}

.fullscreen-toggle {
  background: none;
  border: none;
  color: var(--accent-color);
  font-size: 16px;
  cursor: pointer;
}

/* Sidebar */
.game-area-sidebar {
  width: 310px;
  flex-shrink: 0;
}

.sidebar-game-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sidebar-game-card {
  background-color: var(--bg-medium);
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  border: 1px solid var(--bg-medium);
  aspect-ratio: 16 / 9;
  overflow: hidden;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px;
  text-align: center;
}

.sidebar-game-card:hover {
  background-color: var(--bg-light);
  border-color: var(--accent-color);
}

.sidebar-game-card .game-icon {
  font-size: 24px;
  color: var(--accent-color);
}

.sidebar-game-card p {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 8px;
  line-height: 1.2;
}

/* ================================
   Fullscreen Mode
================================ */
body.game-fullscreen {
  overflow: hidden;
}

body.game-fullscreen .navbar,
body.game-fullscreen .game-area-sidebar,
body.game-fullscreen .ad-box-bottom-banner {
  display: none;
}

body.game-fullscreen .game-player-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9998;
  border-radius: 0;
  border: none;
}

body.game-fullscreen #game-player-frame {
  height: 100vh;
}

/* ================================
   Responsive
================================ */
@media (max-width: 900px) {
  .game-area-layout {
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

 .game-area-main {
    flex: 0 0 auto;         /* Prevents the game area from growing or shrinking */
    width: 1100px;          /* Matches your current max-width */
}

/* 2. This tells the Sidebar to grow and take up all the leftover space */
.game-area-sidebar {
    flex-grow: 1;           /* This forces the sidebar to fill the gap */
    width: auto;            /* Removes the fixed 310px width */
    min-width: 310px;       /* Keeps a minimum size for the icons */
}
}

@media (max-width: 600px) {
  .navbar {
    padding: 0 15px; /* Smaller padding for mobile */
    height: 70px;    /* Slightly smaller bar */
  }

  /* Fix Logo Size for Mobile */
  .brand-poem { font-size: 20px; }
  .brand-playhub { font-size: 11px; }

  /* Hide search text on tiny screens if needed, or make it smaller */
  .search-container {
    width: 100%;
    max-width: 200px; /* Shrink search bar */
  }
  
  .search-container input {
    font-size: 12px;
  }

  .login-btn {
    padding: 5px 10px;
    font-size: 10px;
  }
}


/* ================================
   Mobile & Tablet FIX (Safe)
================================ */
@media (max-width: 1024px) {

  .game-area-layout {
    flex-direction: column;
    align-items: center;
  }

  .game-player-wrapper {
    width: 100vw;
    height: calc(100vw * (80 / 150)); /* SAME DESKTOP RATIO */
    max-height: 70vh;
    margin: 0;
    border-radius: 0;
  }

  #game-player-frame {
    width: 100%;
    height: 100%;
  }

  .game-area-sidebar {
    width: 100%;
    max-width: 400px;
    padding: 16px 10px;
  }
}

.page-section {
  padding: 50px 20px;
  display: flex;
  justify-content: center;
  animation: fadeIn 0.5s ease;
}

.content-box {
  background-color: var(--bg-medium);
  border: 1px solid var(--accent-color);
  padding: 30px;
  border-radius: 8px;
  max-width: 600px;
  width: 100%;
  text-align: center;
}

.content-box h2 {
  color: var(--accent-color);
  margin-bottom: 20px;
}

.contact-form {
  text-align: left;
}

.contact-form textarea {
  width: 100%;
  height: 100px;
  background-color: var(--bg-light);
  border: 1px solid #3d5166;
  border-radius: 3px;
  color: var(--text-primary);
  padding: 10px;
  margin-top: 5px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.main-footer {
  background-color: var(--nav-bar-bg);
  color: var(--text-primary);
  padding: 40px 20px 20px 20px;
  border-top: 1px solid rgba(0, 230, 118, 0.1);
  margin-top: 50px;
}

.footer-content {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-section h3, .footer-section h4 {
  color: var(--accent-color);
  margin-bottom: 15px;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 8px;
}

.footer-section ul li a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-section ul li a:hover {
  color: var(--accent-color);
}

.social-icons {
  display: flex;
  gap: 15px;
  font-size: 20px;
}

.social-icons a {
  color: var(--text-secondary);
  transition: color 0.2s;
}

.social-icons a:hover {
  color: var(--accent-color);
}

.footer-bottom {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--bg-light);
  color: var(--text-secondary);
  font-size: 11px;
}

/* --- GAME DETAILS SECTION --- */
.game-details-box {
    background-color: #1e1e1e;
    padding: 30px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid #333;
    color: #ddd;
    max-width: 1920px;      /* 1. Limits how wide the box can grow */
    width: 96%;            /* 2. Ensures it doesn't touch the edges on mobile */

}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#detail-title {
    color: #00e676; /* Green Title */
    font-size: 2rem;
    margin: 0;
}

.badge {
    background: #333;
    color: #00e676;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    border: 1px solid #00e676;
}

.game-meta-row {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.game-meta-row strong {
    color: #fff;
    margin-right: 20px;
}

.game-details-box h3 {
    color: #fff;
    margin-top: 25px;
    margin-bottom: 10px;
    font-size: 1.2rem;
    border-bottom: 2px solid #00e676; /* Green underline */
    display: inline-block;
    padding-bottom: 5px;
}

.game-details-box p {
    line-height: 1.6;
    color: #cccccc;
    margin-bottom: 15px;
}

.game-details-box hr {
    border: 0;
    border-top: 1px solid #333;
    margin: 20px 0;
}

/* SIDEBAR CARD FIXES */
.sidebar-game-card {
    position: relative; /* Needed for image positioning */
    height: 80px; /* Specific height for sidebar items */
}

/* =========================================
   RESPONSIVE LAYOUT (Mobile & Tablet)
   Reduced Margins & Tighter Spacing
   ========================================= */
@media (max-width: 1024px) {

    /* 1. Reduce Outer Container Padding (Top & Sides) */
    #game-player-container {
        padding: 10px 5px !important; /* Reduced from 20px */
        width: 100%;
        max-width: 100%;
    }

    /* 2. Stack Everything Vertically */
    .game-area-layout {
        flex-direction: column;
        align-items: center;
        width: 100%;
        gap: 15px; /* Adds small space between Game and Details */
    }

    /* 3. Make the Main Area Full Width */
    .game-area-main {
        width: 100%;
        max-width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* 4. Game Player: Rounded Corners & Full Width */
    .game-player-wrapper {
        width: 100%;
        max-width: 800px; 
        aspect-ratio: 16 / 9;
        height: auto;
        margin-bottom: 0; /* Removed extra bottom margin */
        
        border-radius: 12px !important; 
        overflow: hidden;
        box-shadow: 0 4px 10px rgba(0,0,0,0.5);
        border: 1px solid #333;
    }
    
    #game-player-frame {
        width: 100%;
        height: 100%;
    }

    /* 5. Details Box: Tighter Spacing */
    .game-details-box {
        width: 100%;
        max-width: 800px;
        margin: 10px auto 20px auto; /* Less space above */
        padding: 15px; /* Slightly less padding inside */
        box-sizing: border-box;
    }

    /* 6. Smaller Fonts for Mobile */
    #detail-title {
        font-size: 1.4rem;
        line-height: 1.2;
        margin-bottom: 5px;
    }

    .game-details-box h3 {
        font-size: 1.1rem;
        margin-top: 15px;
    }

    .game-details-box p, 
    .game-meta-row {
        font-size: 0.85rem;
    }

    /* 7. Sidebar (Suggested Games) */
    .game-area-sidebar {
        width: 100%;
        max-width: 800px;
        margin-top: 10px;
        border-top: 1px solid #333;
        padding-top: 20px;
    }

    .sidebar-game-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important; 
    gap: 1px;
    width: 100%;            /* Forces the grid to use all available sidebar space */
}
    
    .game-area-sidebar::before {
        content: "You may also like:";
        color: #00e676;
        font-weight: bold;
        display: block;
        margin-bottom: 10px;
        text-align: center;
    }
}

/* Extra tweak for very small phones */
@media (max-width: 480px) {
    .sidebar-game-list {
        grid-template-columns: 1fr; /* 1 game per row on tiny screens */
    }
}

@media (max-width: 1024px) {
    /* ... */
    .game-area-layout {
        flex-direction: column; /* This forces vertical stacking */
    }
    /* ... */
}

/* =========================================
   UPDATED SIDEBAR (Square Icons, 3 Columns)
   ========================================= */

/* 1. Force 3 Columns Grid */
.sidebar-game-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important; /* 3 games per row */
    gap: 10px;
}

/* =========================================
   FINAL SIDEBAR: Full Image Icons (No Borders/Gaps)
   ========================================= */

/* 1. The Grid (3 Columns) */
.sidebar-game-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important; 
    gap: 10px;
}

/* 2. The Card (Perfect Square, No Background) */
.sidebar-game-card {
    aspect-ratio: 1 / 1;          /* Forces square shape */
    width: 100%;
    height: auto !important;
    
    background: transparent !important; /* Removes grey box */
    border: none !important;            /* Removes border */
    padding: 0 !important;              /* Removes gap inside */
    
    border-radius: 10px;                /* Rounded corners */
    overflow: hidden;
    transition: transform 0.2s;
    cursor: pointer;
}

/* 3. The Image (Fills 100% of the square) */
.sidebar-game-card img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* Stretches image to edges */
    display: block;
    margin: 0;
}

/* 4. Hover Effect (Zoom Only) */
.sidebar-game-card:hover {
    transform: scale(1.08); /* slight zoom */
    z-index: 5;
}

/* 5. Mobile Adjustment (Keep 3 columns on mobile too) */
@media (max-width: 1024px) {
    .sidebar-game-list {
        grid-template-columns: repeat(3, 1fr); /* Keeps 3 columns on mobile */
    }
}

/* =========================================
   MOBILE FIXES: 3-Column Grid & Search Bar
   Paste at the very bottom of style.css
   ========================================= */

/* 1. Fix the Search Bar Icon Overflow */
@media (max-width: 600px) {
    .search-container {
        flex: 1 1 auto !important;   /* Allows the box to shrink */
        max-width: 140px !important; /* Prevents it from taking too much space */
        margin: 0 10px !important;   /* Reduces space around it */
        padding: 0 10px !important;  /* Keeps the icon inside */
    }
    
    .search-container input {
        min-width: 0 !important;     /* CRITICAL: Stops the text box from pushing the icon out */
        width: 100%;
        font-size: 12px;
    }

    /* Make logo slightly smaller so search bar has room */
    .brand-poem { font-size: 18px !important; }
    .brand-playhub { font-size: 10px !important; }
}

/* 2. Make the Main Game Grid 3 Columns on Mobile */
@media (max-width: 480px) {
    .game-grid {
        grid-template-columns: repeat(3, 1fr) !important; /* Forces 3 games per row */
        gap: 10px !important; /* Slightly smaller gap so they fit nicely */
    }
}