/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Basic layout */
:root {
  --blue-500: #2563eb;
  --blue-600: #1d4ed8;
  --red-500: #ef4444;
  --green-500: #22c55e;
  --gray-100: #f3f4f6;
  --gray-300: #e5e7eb;
  --text-strong: #111827;
  --text-muted: #6b7280;
}

/***** Base Typography *****/
html { font-size: 16px; }
body {
  background: var(--gray-100);
  color: var(--text-strong);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { color: var(--text-strong); margin: 0 0 0.5rem 0; }
h1 { font-size: 2.25rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }

p { margin: 0 0 0.5rem 0; }
label { display: block; margin: 0.5rem 0 0.25rem; color: var(--text-strong); }

main { flex: 1 0 auto; }

/***** Site Nav *****/
.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-300);
  background: #fff;
}
.site-nav .brand {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.2px;
  text-decoration: none;
  color: var(--text-strong);
}
.site-nav .spacer { margin-left: auto; }

/* Keep long emails tidy */
.user-email { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Mobile nav adjustments */
@media (max-width: 640px) {
  .site-nav {
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 0.5rem 0.75rem;
  }
  .site-nav .brand { font-size: 1.05rem; }
  .user-email { font-size: 0.875rem; max-width: 70vw; }
  /* Force right-side items to the next line on small screens */
  .site-nav .spacer { flex-basis: 100%; margin-left: 0; }
}

/***** Form Controls *****/
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  appearance: none;
  background: #fff;
  color: var(--text-strong);
  border: 1px solid var(--gray-300);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

select { background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 18px) calc(1em + 2px), calc(100% - 13px) calc(1em + 2px); background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }

input:focus, select:focus, textarea:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/***** Buttons *****/
.btn {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: var(--blue-500);
  color: #ffffff;
  border-color: var(--blue-500);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.btn-inverse {
  background: #ffffff;
  color: var(--blue-500);
  border-color: var(--blue-500);
}

.btn-inverse:hover,
.btn-inverse:focus {
  color: #ffffff;
  background: var(--blue-600);
  border-color: var(--blue-600);
}

/***** Layout helpers *****/
.page-header { text-align: center; margin: 2.75rem 0 1.25rem; }
.page-header h1 { color: var(--text-strong); }
.games-container { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 1rem; }

/***** Hero (Home) *****/
.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  overflow: hidden;
  background: #000;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("/ork-wallpaper.jpg");
  background-size: cover;
  background-position: center;
  opacity: 0.35;
}
.hero__content {
  position: relative;
  z-index: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
  color: #fff;
}
.hero-title { font-size: 2.5rem; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.hero-subtitle { font-size: 1.25rem; color: #e5e7eb; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.button-row { display: inline-flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }

/***** Cards *****/
.card { background: #ffffff; border: 3px solid var(--gray-300); border-radius: 0.5rem; padding: 1.5rem; box-shadow: 0 1px 2px rgba(0,0,0,0.04); margin-bottom: 1.5rem; }
.card--win { border-color: var(--green-500); }
.card--loss { border-color: var(--red-500); }
.card--draw { border-color: var(--blue-500); }
.card-header h3 { margin: 0 0 0.25rem 0; color: var(--text-strong); }
.card-date { margin: 0; font-style: italic; color: var(--text-muted); font-size: 1rem; }
.card-body { margin-top: 1.25rem; color: var(--text-strong); }
.card-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; }
.card-row .player { font-size: 1.25rem; }
.card-row .score { font-size: 1.25rem; font-weight: 600; text-align: center; }

/* Auth tweaks */
.text-muted { color: var(--text-muted); }

/***** Flash *****/
.flash-container { width: 100%; max-width: 720px; margin: 0.75rem auto 0; padding: 0 1rem; }
.flash { display: flex; align-items: center; gap: 0.75rem; border-radius: 0.5rem; padding: 0.75rem 1rem; border: 1px solid var(--gray-300); background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.flash .flash-icon { font-size: 1.25rem; }
.flash--notice { border-left: 4px solid var(--green-500); }
.flash--alert  { border-left: 4px solid var(--red-500); }

/***** Modal *****/
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 9999; }
.modal-card { background: #ffffff; border-radius: 0.75rem; padding: 2rem; width: 100%; max-width: 520px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); }

/***** Footer *****/
.site-footer { margin-top: 2rem; padding: 1rem; border-top: 1px solid var(--gray-300); background: #fff; }
.footer-content { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 1rem; text-align: center; color: var(--text-muted); }
.footer-link { margin-left: 0.25rem; font-weight: 600; color: var(--blue-500); text-decoration: none; }
.footer-link:hover, .footer-link:focus { text-decoration: underline; }
