/* ==========================================================================
   GameCreator - Landing / Dashboard Stylesheet
   Dark-mode dashboard with project grid, modals, and hosting badges.
   ========================================================================== */

/* ── Design Tokens ─────────────────────────────────────── */
:root {
  --bg-primary: #0c0e15;
  --bg-secondary: #12151e;
  --bg-tertiary: #1a1d2a;
  --bg-hover: #21253a;

  --border-color: rgba(255, 255, 255, 0.07);
  --border-active: rgba(99, 102, 241, 0.5);

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-active: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-danger: #ef4444;
  --accent-success: #22c55e;

  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;
}

/* ── Reset & Base ─────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ───────────────────────────────────────────── */
header {
  height: 60px;
  padding: 0 28px;
  background: rgba(12, 14, 21, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.logo-icon {
  color: var(--accent-active);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

/* ── Dashboard Container ──────────────────────────────── */
.dashboard-container {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 28px;
  flex: 1;
}

.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.welcome-text h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin-bottom: 4px;
}

.welcome-text p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Controls Row ─────────────────────────────────────── */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.tab-filters {
  display: flex;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.tab-filter-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
}

.tab-filter-btn:hover {
  color: var(--text-primary);
}

.tab-filter-btn.active {
  background: var(--accent-active);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ── Search ───────────────────────────────────────────── */
.search-container {
  position: relative;
  width: 280px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  z-index: 2;
}

.search-input {
  width: 100%;
  box-sizing: border-box;
  height: 38px;
  padding: 8px 14px 8px 38px !important;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all 0.15s ease;
}

.search-input:focus {
  border-color: var(--accent-active);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

/* ── Project Grid ─────────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

/* ── Create Project Card ──────────────────────────────── */
.create-project-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 200px;
  border: 2px dashed rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-lg);
  background: rgba(99, 102, 241, 0.04);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.create-project-card:hover {
  border-color: var(--accent-active);
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent-active);
  transform: none;
}

.plus-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.create-project-card:hover .plus-circle {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-active);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ── Project Card ─────────────────────────────────────── */
.project-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  position: relative;
}

.project-card:hover {
  transform: none;
  border-color: var(--border-active);
  box-shadow: 0 14px 35px -10px rgba(99, 102, 241, 0.18);
}

.project-card-preview {
  height: 150px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #171a26;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

.project-card-preview-icon {
  color: var(--text-muted);
  opacity: 0.3;
  transition: all 0.25s ease;
}

.project-card:hover .project-card-preview-icon {
  transform: scale(1.1);
  color: var(--accent-active);
  opacity: 0.7;
}

/* ── Card Action Buttons ──────────────────────────────── */
.project-settings-btn,
.project-delete-btn {
  position: absolute;
  top: 10px;
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(18, 21, 30, 0.8);
  backdrop-filter: blur(6px);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.15s ease;
  z-index: 10;
}

.project-settings-btn {
  right: 44px;
}

.project-delete-btn {
  right: 10px;
}

.project-card:hover .project-settings-btn,
.project-card:hover .project-delete-btn {
  opacity: 1;
  transform: scale(1);
}

.project-settings-btn:hover {
  background: var(--accent-active);
  border-color: var(--accent-active);
}

.project-delete-btn:hover {
  background: var(--accent-danger);
  border-color: var(--accent-danger);
}

/* ── Project Badges ───────────────────────────────────── */
.project-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
}

.project-card-badge.public {
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.25);
}

.project-card-badge.private {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.25);
}

.project-card-badge.host-live {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.25);
  animation: pulseLive 2s infinite;
}

@keyframes pulseLive {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.35); }
  70% { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.project-card-badge.host-scheduled {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.25);
}

.project-card-badge.host-ended {
  background: rgba(107, 114, 128, 0.12);
  color: #9ca3af;
  border-color: rgba(107, 114, 128, 0.25);
}

/* ── Card Details ─────────────────────────────────────── */
.project-card-details {
  padding: 14px;
}

.project-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Modals ────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 400px;
  max-width: 95vw;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: modalFade 0.2s ease;
}

@keyframes modalFade {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: all 0.12s ease;
}

.modal-close-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-settings-apply {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  padding: 6px 18px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 34px !important;
  transition: all 0.15s ease !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
}

.btn-settings-apply:hover {
  background: rgba(255, 255, 255, 0.16) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.btn-settings-apply:active {
  transform: translateY(0) scale(0.97) !important;
  background: rgba(255, 255, 255, 0.22) !important;
}

.btn-settings-ok {
  background: var(--accent-active) !important;
  border: none !important;
  color: #ffffff !important;
  padding: 6px 22px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 34px !important;
  transition: all 0.15s ease !important;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4) !important;
}

.btn-settings-ok:hover {
  background: #4f46e5 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.6) !important;
}

.btn-settings-ok:active {
  transform: translateY(0) scale(0.97) !important;
  background: #4338ca !important;
}

.modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Form Controls ────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-input,
input[type="text"],
input[type="number"],
input[type="password"],
input[type="datetime-local"],
select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
  height: 38px;
  min-height: 38px;
  line-height: normal;
}

.settings-pane > * {
  flex-shrink: 0;
}

.modal-body-scroll {
  overflow-y: auto !important;
}

.form-input:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="datetime-local"]:focus,
select:focus {
  border-color: var(--accent-active);
}

select {
  cursor: pointer;
}

select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ── Primary Button ───────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: var(--accent-active);
  border: none;
  border-radius: 6px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* ── Settings Tab Buttons (Sidebar Modal) ─────────────── */
.settings-tab-btn {
  transition: all 0.15s ease;
}

.settings-tab-btn:hover {
  background: var(--bg-hover) !important;
  color: var(--text-primary) !important;
}

.settings-tab-btn.active {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

/* ── Settings Panes ───────────────────────────────────── */
.settings-pane {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.settings-pane.active {
  display: flex;
}

/* ── Status Banner ────────────────────────────────────── */
.status-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  color: var(--text-primary);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-banner.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ── Selection ────────────────────────────────────────── */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: #ffffff;
}

/* Settings Modal Body Scroll */
.modal-main-content {
  min-height: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  overflow: hidden;
}

.modal-body-scroll {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: 100% !important;
  height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 24px 24px 36px 24px !important;
  overscroll-behavior: contain !important;
}

.modal-body-scroll::-webkit-scrollbar {
  width: 8px;
}
.modal-body-scroll::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 4px;
}
.modal-body-scroll::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.6);
  border-radius: 4px;
}
.modal-body-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.9);
}
