/* =====================================================================
   RESET & BASE
   ===================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  background: #000;              /* pitch-black for max contrast */
  color: #f5f5f5;
  font-family: Arial, sans-serif;
  text-align: center;
  line-height: 1.4;
  min-height: 100vh;
}

/* =====================================================================
   GLOBAL LOGO
   ===================================================================== */
.site-logo {
  display: block;
  margin: 1rem auto;
  width: 300px;    /* normalized across all pages */
  height: auto;
}

/* =====================================================================
   Per‐system logo on emulator pages (replaces the red text)
   ===================================================================== */
.system-logo {
  display: block;
  margin: 1rem auto;
  width: 200px;   /* or whatever size you prefer */
  height: auto;
}


/* =====================================================================
   LINKS & HEADERS
   ===================================================================== */
a {
  color: #66ccff;
  text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2 {
  color: #ff0033;
  margin: 1rem 0;
}

/* =====================================================================
   UTILITY
   ===================================================================== */
.top-right {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.9rem;
}
.back-link {
  display: block;
  margin: 1rem auto;
  font-size: 0.9rem;
}

/* =====================================================================
   EMBEDDED LOGIN / REGISTER PAGES
   ===================================================================== */
/* hide any ES-generated “.card” wrappers except our own */
body .card { display: none !important; }
/* but always show our #login-card or #register-card */
#login-card,
#register-card {
  display: block !important;
}

/* center the form vertically/horizontally */
body.login-page,
body.register-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
}

/* form inputs & buttons (login & register) */
#login-card input,
#login-card button,
#register-card input,
#register-card button {
  width: 300px;
  max-width: 90vw;
  margin: 0.5rem auto;
  display: block;
  font-size: 1rem;
  border-radius: 4px;
  border: none;
  box-sizing: border-box;
}

/* dark background for inputs */
#login-card input,
#register-card input {
  background: #2a2a2a;
  color: #fff;
  padding: 0.6rem;
}

/* red “action” buttons */
#login-card button,
#register-card button {
  background: #e01e3d;
  color: #fff;
  padding: 0.7rem;
  cursor: pointer;
  transition: background 0.2s;
}
#login-card button:hover,
#register-card button:hover {
  background: #c01b35;
}

/* error banners inside those cards */
#login-card .error,
#register-card .error {
  background: #a00;
  color: #fff;
  padding: 0.5rem;
  border-radius: 4px;
  margin: 0 auto 1rem;
  max-width: 300px;
  text-align: center;
}

/* “already have an account” link */
#login-card .register,
#register-card .register {
  margin-top: 1rem;
  font-size: 0.9rem;
}
#login-card .register a,
#register-card .register a {
  color: #4ea0e6;
}

/* =====================================================================
   INDEX & SEARCH
   ===================================================================== */
/* pull card styling off the ES wrapper */
form#rom-search-form {
  background: transparent !important;
  box-shadow: none          !important;
  padding: 0                !important;
  margin: 1rem auto;
  width: 300px;              /* cap form width */
}

/* unified search-input styling for both pages */
.index-page #rom-search,
.emulator-page #emulator-search {
  display: block;
  width: 300px;              /* same sized container */
  max-width: 90vw;
  margin: 1rem auto;
  padding: 0.5em;
  font-size: 1em;
  box-sizing: border-box;

  background: #2a2a2a;
  color: #fff;
  border: none;
  border-radius: 4px;
}

/* search results grid */
.search-results {
  max-width: 1000px;
  margin: 1rem auto;
}
.search-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  justify-content: center;
}
.search-card {
  background: #1e1e1e;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
  overflow: hidden;
  width: 200px;
  text-align: center;
  transition: transform .1s;
}
.search-card:hover {
  transform: translateY(-4px);
}
.search-card img {
  width: 100%;
  height: auto;
  display: block;
}
.search-card .info {
  padding: 0.5em;
}
.search-card .info .system {
  font-size: 0.85em;
  color: #888;
  margin-bottom: 0.25em;
  display: block;
}
.search-card .info a {
  color: #4ea0e6;
}

/* =====================================================================
   FRONT-PAGE EMULATOR GRID
   ===================================================================== */
.emulator-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 2rem;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}
.emulator-card {
  background: #1e1e1e;
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s;
}
.emulator-card:hover {
  background: #222;
  transform: translateY(-4px);
}
.emulator-card img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
}

/* =====================================================================
   PER-SYSTEM GAME GRID
   ===================================================================== */
/* only when we're on emulator.php (we add class="emulator-page" to <body>) */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.game-card {
  background: #1e1e1e;
  padding: 0.5rem;
  border-radius: 8px;
  text-align: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.game-card:hover {
  transform: scale(1.03);
  background: #222;
}

.game-card img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.game-card .game-title {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #ddd;
}

/* =====================================================================
   ADMIN PANEL
   ===================================================================== */
.admin-page .top-right {
  color: #66ccff;
}
.tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1rem 0;
}
.tab {
  background: #333;
  color: #f5f5f5;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 5px;
  font-size: 1rem;
}
.tab.active {
  background: #ff0033;
}
.section {
  display: none;
  margin: 1rem auto;
  max-width: 90vw;
}
.section.active { display: block; }
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}
th,td {
  padding: 0.5rem;
  border: 1px solid #444;
  text-align: left;
}
form.inline {
  display: inline;
}
input[type=text],
input[type=email],
select {
  width: 90%;
}
.upload-button {
  background: #ff0033;
  color: white;
  padding: 0.6rem 1.2rem;
  font-size: 1.1rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.upload-button:hover {
  background: #cc0029;
}

/* =====================================================================
   Protected admin account (non-editable)
   ===================================================================== */
.admin-page table tr.protected {
  opacity: 0.6;
}
.admin-page table tr.protected input,
.admin-page table tr.protected select,
.admin-page table tr.protected button {
  pointer-events: none;
}
/* =====================================================================
   ERROR MESSAGES
   ===================================================================== */
.error {
  color: #ff0033;    /* match your red headers */
  margin: 1rem auto;
  font-weight: bold;
}


/* =====================================================================
   Buttons
   ===================================================================== */
.button-red {
  display: inline-block;
  background: #ff0033;
  color: white;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease;
}
.button-red:hover {
  background: #cc0029;
}
