/* ---------------------------------------------------------
   Base styling for The Coop
   --------------------------------------------------------- */

:root {
  --bg: #000000;
  --ink: #ffffff;
  --ink-dim: rgba(255, 255, 255, 0.6);
  --tile-bg: #111111;
  --tile-bg-hover: #151515;
  --accent: #497752; /* SageBrain green */
  --accent-hover: #b2c2a2;
  --radius: 12px;
  --transition: 0.15s ease;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* App shell layout */
.coop-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Nunito for key headings / product names */
.coop-title,
.coop-tile-title {
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

/* ---------------------------------------------------------
   Header
   --------------------------------------------------------- */

.coop-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 24px 8px;
}

.coop-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.coop-brand {
  display: flex;
  align-items: center;
  gap: 10px; /* logo closer to text */
}

/* Logo + clipping wrapper to hide stray edge */
.coop-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.coop-logo {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  display: block;
  max-width: 100%;
  height: auto;
}

.coop-titleblock {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.coop-title {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
}

.coop-tagline {
  margin: 0;
  color: var(--ink-dim);
  font-size: 15px;
}

/* Header right: settings + help on one line */
.coop-header-right {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.coop-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Settings icon button (no circle) */
.coop-settings-btn {
  border: none;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.coop-settings-btn:hover {
  transform: scale(1.06);
}

.coop-settings-icon {
  width: 32px;
  height: 32px;
}

/* Help button (used in header) */
.coop-help-btn {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 999px;
  background: #1c1c1c;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: var(--transition);
}

.coop-help-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------------------------------------------------------
   Main / intro / tile grid
   --------------------------------------------------------- */

.coop-main {
  flex: 1;
  padding: 24px 24px 16px;
  max-width: 1120px;
  margin: 0 auto;
  box-sizing: border-box;
}

.coop-intro {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--ink-dim);
  text-align: center;
}

/* Default: stack tiles (mobile / narrow) */
.coop-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}

/* Larger displays: auto-fit tiles into responsive grid */
@media (min-width: 900px) {
  .coop-grid {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  }
}

.coop-tile {
  background: var(--tile-bg);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  flex-direction: row;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: var(--transition);
  cursor: pointer; /* whole tile is clickable */
}

.coop-tile:hover {
  background: var(--tile-bg-hover);
}

.coop-tile-icon {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  margin-right: 22px;
}

.coop-tile-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.coop-tile-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
}

.coop-tile-sub {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--ink-dim);
}

/* Small-screen note about unavailable tools */
.coop-small-note {
  margin: 20px 0 0;
  font-size: 13px;
  color: var(--ink-dim);
  text-align: center;
  display: none; /* toggled via JS */
}

/* ---------------------------------------------------------
   Modal (Settings / License)
   --------------------------------------------------------- */

.coop-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 50;
}

.coop-modal.open {
  display: block;
}

.coop-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.coop-modal-dialog {
  position: relative;
  max-width: 520px;
  margin: 10vh auto 0;
  background: #101010;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px 24px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.7);
}

.coop-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.coop-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

.coop-modal-close {
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.coop-license-copy {
  font-size: 14px;
  color: var(--ink-dim);
  margin-bottom: 12px;
}

.coop-license-list {
  margin-top: 8px;
  color: var(--ink-dim);
  font-size: 14px;
}

.coop-license-list li {
  margin: 6px 0;
}

/* ---------------------------------------------------------
   Footer
   --------------------------------------------------------- */

.coop-footer {
  width: 100%;
  padding: 8px 24px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--bg);
  box-sizing: border-box;
  margin-top: auto; /* stays at bottom of viewport */
}

.coop-footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.coop-footer-left {
  text-align: left;
}

.coop-footer-line {
  margin: 2px 0;
  color: var(--ink-dim);
  font-size: 13px;
}

.coop-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coop-version {
  margin: 0;
  color: var(--ink-dim);
  font-size: 12px;
}
