/*
 * Revival — March 2017 Roblox aesthetic
 * Blue header (#0074BD), grey body (#e3e3e3), white sections
 */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600;700;900&display=swap');

:root {
  --header-blue: #0074BD;
  --header-hover: rgba(25,25,25,0.1);
  --body-bg: #e3e3e3;
  --card-bg: #fff;
  --border-color: #c3c3c3;
  --text-primary: #191919;
  --text-secondary: #606162;
  --text-muted: #999;
  --text-link: #00a2ff;
  --text-link-hover: #0085d4;
  --green: #02b757;
  --green-hover: #029946;
  --red: #e34c4c;
  --vote-bg: #e3e3e3;
  --header-height: 40px;
  --container-width: 970px;
  --t: 0.15s ease;
}
@media (max-width: 991px) { :root { --header-height: 80px; } }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body { font-family: 'Source Sans Pro', Arial, Helvetica, sans-serif; background: var(--body-bg); color: var(--text-primary); line-height: 1.4; min-height: 100vh; }
a { color: var(--text-link); text-decoration: none; }
a:hover { color: var(--text-link-hover); }

/* ── HEADER ── */
.rbx-header { background-color: var(--header-blue); height: var(--header-height); position: fixed; top: 0; left: 0; right: 0; z-index: 1030; font-size: 16px; }
.rbx-header-inner { max-width: 1100px; margin: 0 auto; height: 100%; display: flex; align-items: center; padding: 0 12px; }
.navbar-brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; padding: 5px 0; margin-right: 12px; flex-shrink: 0; }
.navbar-brand:hover { color: #fff; text-decoration: none; }
.logo-icon { width: 28px; height: 28px; background: #fff; border-radius: 3px; display: flex; align-items: center; justify-content: center; }
.logo-icon svg { width: 18px; height: 18px; fill: var(--header-blue); }
.brand-text { font-weight: 900; font-size: 18px; letter-spacing: -0.5px; }

.rbx-navbar { display: flex; align-items: center; gap: 2px; margin-right: auto; }
.nav-menu-title { color: #fff; font-weight: 400; font-size: 15px; padding: 6px 12px; border-radius: 5px; text-decoration: none; transition: background var(--t); white-space: nowrap; user-select: none; }
.nav-menu-title:hover { background: var(--header-hover); color: #fff; text-decoration: none; }
.nav-menu-title.active { background: var(--header-hover); }

.rbx-navbar-search { margin: 0 12px; flex: 0 1 240px; }
.search-wrapper { position: relative; display: flex; }
.search-input { width: 100%; padding: 4px 32px 4px 10px; background: #fff; border: none; border-radius: 2px; color: var(--text-primary); font-size: 14px; font-family: inherit; height: 28px; box-shadow: inset 0 1px 2px rgba(0,0,0,0.08); }
.search-input::placeholder { color: #bbb; }
.search-input:focus { outline: none; }
.search-btn { position: absolute; right: 0; top: 0; height: 28px; width: 28px; background: #0066a6; border: none; border-radius: 0 2px 2px 0; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #fff; }
.search-btn:hover { background: #005a94; }

.rbx-navbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; position: relative; }
.btn-nav { padding: 5px 14px; font-family: inherit; font-weight: 600; font-size: 13px; border: none; border-radius: 3px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; transition: all var(--t); white-space: nowrap; }
.btn-nav-login { background: transparent; border: 1px solid rgba(255,255,255,0.5); color: #fff; }
.btn-nav-login:hover { border-color: #fff; color: #fff; text-decoration: none; }
.btn-nav-signup { background: var(--green); color: #fff; }
.btn-nav-signup:hover { background: var(--green-hover); color: #fff; text-decoration: none; }

.navbar-user { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 5px; cursor: pointer; transition: background var(--t); color: #fff; }
.navbar-user:hover { background: var(--header-hover); }
.user-avatar { width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,0.25); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: #fff; }
.user-name { font-size: 14px; font-weight: 600; }
.user-menu { position: absolute; top: 100%; right: 0; margin-top: 4px; background: #fff; border: 1px solid var(--border-color); border-radius: 3px; min-width: 160px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1050; }
.user-menu-item { display: block; padding: 8px 14px; color: var(--text-primary); font-size: 13px; transition: background var(--t); text-decoration: none; }
.user-menu-item:hover { background: #f2f2f2; text-decoration: none; color: var(--text-primary); }
.user-menu-item.text-danger { color: var(--red); }

/* ── MAIN ── */
.container-main { min-height: calc(100vh - 80px); margin: calc(var(--header-height) + 12px) auto 0; max-width: var(--container-width); padding: 0 15px 40px; position: relative; }

/* ── GAME SORTS ── */
.games-list-container { background: var(--card-bg); border: 1px solid var(--border-color); margin-bottom: 12px; overflow: hidden; }
.container-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; }
.container-header h3 { font-size: 16px; font-weight: 700; margin: 0; }
.btn-more { font-size: 11px; font-weight: 600; color: var(--text-muted); text-decoration: none; padding: 4px 12px; border: 1px solid var(--border-color); border-radius: 3px; background: #fff; cursor: pointer; transition: background var(--t); }
.btn-more:hover { background: #f2f2f2; }
.game-cards { display: flex; overflow-x: auto; padding: 10px 8px; gap: 0; scrollbar-width: thin; scrollbar-color: rgba(25,25,25,0.2) transparent; }
.game-cards::-webkit-scrollbar { height: 6px; }
.game-cards::-webkit-scrollbar-thumb { background: rgba(25,25,25,0.2); border-radius: 3px; }

/* ── GAME CARDS ── */
.game-card { flex: 0 0 auto; width: 150px; margin: 0 5px; cursor: pointer; text-decoration: none; color: var(--text-primary); }
.game-card:hover { text-decoration: none; }
.game-card:hover .game-card-name { color: var(--text-link); }
.game-card-thumb-container { width: 150px; height: 150px; border-radius: 3px; overflow: hidden; background: #c3c3c3; }
.game-card-thumb-container img { width: 100%; height: 100%; object-fit: cover; }
.game-card-name { font-size: 13px; font-weight: 600; line-height: 1.3; max-height: 2.6em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-top: 4px; transition: color var(--t); }
.game-card-name-secondary { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.game-card-vote { margin-top: 4px; height: 6px; background: var(--vote-bg); border-radius: 3px; overflow: hidden; }
.vote-percentage { height: 100%; background: var(--green); border-radius: 3px; }
.game-card-stats { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.game-card-era { font-size: 10px; font-weight: 700; color: var(--text-muted); background: #eee; padding: 1px 5px; border-radius: 2px; text-transform: uppercase; }

/* ── FILTERS ── */
.games-page-filters { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filter-tabs { display: flex; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 3px; overflow: hidden; }
.filter-tab { padding: 6px 14px; font-family: inherit; font-weight: 600; font-size: 12px; color: var(--text-secondary); cursor: pointer; border: none; background: none; transition: all var(--t); border-right: 1px solid #eee; }
.filter-tab:last-child { border-right: none; }
.filter-tab:hover { color: var(--text-primary); background: #f2f2f2; }
.filter-tab.active { background: var(--text-link); color: #fff; }
.filter-select { padding: 6px 28px 6px 10px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 3px; color: var(--text-primary); font-size: 12px; font-family: inherit; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.filter-select:focus { outline: none; border-color: var(--text-link); }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 20px; font-family: inherit; font-weight: 700; font-size: 13px; border: none; border-radius: 3px; cursor: pointer; transition: all var(--t); text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--text-link); color: #fff; }
.btn-primary:hover { background: var(--text-link-hover); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: var(--green-hover); color: #fff; }
.btn-secondary { background: #c3c3c3; color: var(--text-primary); }
.btn-secondary:hover { background: #aaa; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-ghost:hover { background: #f2f2f2; color: var(--text-primary); }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── SECTION CARD ── */
.section-card { background: var(--card-bg); border: 1px solid var(--border-color); }
.section-card-header { padding: 8px 14px; font-size: 13px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.3px; border-bottom: 1px solid #eee; background: #fafafa; }
.section-card-body { padding: 14px; }

/* ── UPLOAD ZONES ── */
.upload-zone {
  position: relative;
  border: 2px dashed var(--border-color);
  border-radius: 3px;
  background: #fafafa;
  text-align: center;
  cursor: pointer;
  transition: all var(--t);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.upload-zone:hover { border-color: var(--text-link); background: #f0f8ff; }
.upload-zone.drag-over { border-color: var(--green); background: #f0fff4; }
.upload-zone.has-file { border-style: solid; border-color: var(--green); }

.upload-zone-sm { min-height: 100px; }

.upload-zone-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

.upload-zone-content { padding: 16px; }
.upload-zone-icon { font-size: 2rem; margin-bottom: 6px; }
.upload-zone-text { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.upload-zone-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.upload-preview-img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }

.upload-zone-selected { display: flex; align-items: center; gap: 8px; padding: 12px 16px; width: 100%; }
.upload-file-icon { font-size: 1.5rem; }
.upload-file-name { font-size: 13px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: left; }
.upload-file-size { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── UPLOAD PROGRESS ── */
.upload-progress { margin-bottom: 12px; }
.upload-progress-bar { height: 4px; background: #eee; border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.upload-progress-bar::after { content: ''; display: block; height: 100%; background: var(--green); border-radius: 2px; animation: progressPulse 1.5s ease infinite; width: 60%; }
@keyframes progressPulse { 0% { transform: translateX(-100%); } 100% { transform: translateX(200%); } }
.upload-progress-text { font-size: 12px; color: var(--text-muted); }

/* ── CREATE PAGE LAYOUT ── */
.create-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
@media (max-width: 768px) { .create-layout { grid-template-columns: 1fr; } }

.form-row { display: flex; gap: 12px; }
@media (max-width: 480px) { .form-row { flex-direction: column; gap: 0; } }

/* ── GAME DETAIL ── */
.game-detail { background: var(--card-bg); border: 1px solid var(--border-color); overflow: hidden; }
.game-detail-header { display: flex; gap: 16px; padding: 16px; }
.game-detail-thumb { width: 420px; height: 236px; flex-shrink: 0; border-radius: 3px; overflow: hidden; background: #c3c3c3; }
.game-detail-thumb img { width: 100%; height: 100%; object-fit: cover; }
.game-detail-info { flex: 1; min-width: 0; }
.game-detail-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.game-detail-creator { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }
.game-detail-creator a { font-weight: 600; }
.game-detail-stats { display: flex; gap: 24px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid #eee; }
.game-stat { text-align: center; }
.game-stat-value { font-size: 20px; font-weight: 700; }
.game-stat-value.playing { color: var(--green); }
.game-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.play-button { width: 100%; padding: 14px; font-size: 16px; text-transform: uppercase; letter-spacing: 0.5px; }
.owner-actions { display: flex; gap: 8px; margin-top: 12px; }
.game-detail-desc { padding: 16px; border-top: 1px solid #eee; }
.game-detail-desc h3 { font-size: 14px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; margin-bottom: 8px; }
.game-detail-desc p { font-size: 14px; line-height: 1.6; }

/* ── AUTH ── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--body-bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 3px; padding: 28px; }
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-logo { display: block; font-size: 28px; font-weight: 900; color: var(--header-blue); margin-bottom: 4px; letter-spacing: -1px; text-decoration: none; }
.auth-logo:hover { text-decoration: none; color: var(--header-blue); }
.auth-title { font-size: 16px; font-weight: 400; color: var(--text-secondary); }

.form-group { margin-bottom: 14px; }
.form-label { display: block; margin-bottom: 4px; font-weight: 600; font-size: 13px; color: var(--text-primary); }
.form-input { width: 100%; padding: 10px 12px; background: #fff; border: 1px solid var(--border-color); border-radius: 3px; color: var(--text-primary); font-size: 14px; font-family: inherit; transition: border-color var(--t); }
.form-input:focus { outline: none; border-color: var(--text-link); }
.form-input::placeholder { color: var(--text-muted); }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-error { color: var(--red); font-size: 13px; margin-top: 4px; }
.auth-submit { width: 100%; margin-top: 6px; padding: 10px; font-size: 15px; }
.auth-footer { text-align: center; margin-top: 16px; padding-top: 16px; border-top: 1px solid #eee; color: var(--text-muted); font-size: 13px; }
.auth-footer a { font-weight: 600; }

/* ── FOOTER ── */
.rbx-footer { background: var(--card-bg); border-top: 1px solid var(--border-color); padding: 12px; text-align: center; }
.footer-text { font-size: 12px; color: var(--text-muted); }

/* ── LOADING ── */
.loading { display: flex; flex-direction: column; align-items: center; padding: 40px; color: var(--text-muted); }
.loading-spinner { width: 28px; height: 28px; border: 3px solid #ddd; border-top-color: var(--header-blue); border-radius: 50%; animation: spin 0.7s linear infinite; margin-bottom: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.empty-state-icon { font-size: 2.5rem; margin-bottom: 8px; opacity: 0.5; }
.empty-state-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; color: var(--text-secondary); }

/* ── TOASTS ── */
.toast-container { position: fixed; top: 52px; right: 16px; display: flex; flex-direction: column; gap: 6px; z-index: 3000; }
.toast { padding: 10px 16px; border-radius: 3px; font-size: 13px; font-weight: 600; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.2); animation: toastIn 0.2s ease-out; max-width: 320px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-info { background: var(--header-blue); }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(25,25,25,0.6); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 2000; opacity: 0; visibility: hidden; transition: all 0.2s; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { background: #fff; border: 1px solid var(--border-color); border-radius: 3px; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #eee; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px; display: flex; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid #eee; }

/* ── RESPONSIVE ── */
@media (max-width: 991px) { .rbx-navbar { display: none; } .rbx-navbar-search { flex: 1; } }
@media (max-width: 768px) { .game-detail-header { flex-direction: column; } .game-detail-thumb { width: 100%; height: auto; aspect-ratio: 16/9; } }
@media (max-width: 480px) { .auth-card { padding: 20px; } .game-card { width: 130px; } .game-card-thumb-container { width: 130px; height: 130px; } }

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.mt-4 { margin-top: 16px; }
