/* EDBO+ beta theme — typography, shadows, layout */

:root {
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --text-base: 1.0625rem;
  --text-sm: 0.9375rem;
  --line-height: 1.6;
  --color-text: #1e293b;
  --color-muted: #64748b;
  --color-border: #e2e8f0;
  --color-surface: #ffffff;
  --color-sidebar-hover: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 2px 8px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 3px 12px rgba(15, 23, 42, 0.1);
  --radius: 6px;
  --radius-lg: 8px;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-height);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Typography ─────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6,
.title, .subtitle,
.message-header,
.label {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
}

.title {
  font-weight: 700;
  color: var(--color-text);
}

.title.is-1 { font-size: 2.25rem; }
.title.is-2 { font-size: 1.875rem; }
.title.is-3 { font-size: 1.5rem; }
.title.is-4 { font-size: 1.375rem; }
.title.is-5 { font-size: 1.125rem; }

.subtitle {
  font-weight: 500;
  color: var(--color-muted);
}

.subtitle.is-6 {
  font-size: var(--text-base);
}

.content,
.message-body,
.help,
p {
  font-size: var(--text-base);
}

/* ── Buttons ────────────────────────────────────────────────── */

.button {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 500;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, background-color 0.15s ease;
}

.button:hover {
  box-shadow: var(--shadow-hover);
}

.button.is-small {
  font-size: var(--text-sm);
}

/* ── Forms ──────────────────────────────────────────────────── */

.input,
.textarea,
.select select {
  font-family: var(--font-body);
  font-size: var(--text-base);
  border-radius: var(--radius);
  border-color: var(--color-border);
}

.input:focus,
.textarea:focus,
.select select:focus {
  border-color: #3273dc;
  box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.2);
}

.checkbox,
.radio {
  font-size: var(--text-base);
}

/* ── Tables ─────────────────────────────────────────────────── */

.table {
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}

.table th {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background-color: #f8fafc;
  border-color: var(--color-border);
  padding: 0.875rem 1rem;
}

.table td {
  padding: 0.75rem 1rem;
  border-color: var(--color-border);
  vertical-align: middle;
}

.downloads-table th,
.downloads-table td {
  vertical-align: middle;
}

.downloads-table tbody td {
  padding-top: 0.875rem;
  padding-bottom: 0.875rem;
}

.downloads-table .downloads-cell-text {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  line-height: 1.25;
}

.downloads-table .downloads-actions {
  white-space: nowrap;
}

.downloads-table .downloads-actions .buttons {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  margin-bottom: 0;
  flex-wrap: nowrap;
}

.downloads-table .downloads-actions .button {
  margin-bottom: 0;
}

.table-container {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}

.table-container table {
  margin-bottom: 0;
  box-shadow: none;
  border: none;
}

/* ── Home landing ───────────────────────────────────────────── */

.home-landing .home-hero {
  margin-bottom: 1.5rem;
}

.home-landing .home-logo {
  width: 120px;
  height: auto;
  display: block;
}

.home-landing .home-title {
  font-size: 2.75rem;
  line-height: 1.2;
  margin-bottom: 0;
}

/* Bulma pulls .subtitle up with negative margin; keep hero lines separate */
.home-landing .home-title + .home-subtitle,
.home-landing .title + .subtitle {
  margin-top: 0.75rem;
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.4;
  color: var(--color-text-muted, #4a4a4a);
}

.home-landing .home-tile-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.home-landing .home-tile-link:hover {
  text-decoration: none;
  color: inherit;
}

.home-landing .home-tile {
  padding: 3px 18px;
  transition: box-shadow 0.3s;
  border-radius: 3px;
}

.home-landing .home-tile:hover {
  box-shadow: 0 5px 15px 0 rgba(0, 0, 0, 0.2);
}

.home-landing .home-tile h3 {
  margin: 0;
  color: inherit;
}

/* ── Cards & panels ─────────────────────────────────────────── */

.message,
.notification,
.box {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}

.message-header {
  font-weight: 600;
  font-size: var(--text-base);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.message-body {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.app-info-modal .modal-card {
  width: min(720px, calc(100vw - 2rem));
}

.app-info-modal .modal-card-title {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-text);
}

.app-info-modal .modal-card-body {
  line-height: 1.6;
}

.app-info-modal-message,
.app-confirm-modal-message {
  white-space: pre-line;
}

.app-info-modal .modal-card-body .content ol {
  margin-top: 0.5rem;
}

.content-panel {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.tabs.is-boxed li.is-active a {
  font-family: var(--font-heading);
  font-weight: 600;
}

.scope-manager-tabs {
  margin-bottom: 1.75rem;
}

.scope-manager-tabs ul {
  width: 100%;
  display: flex;
  gap: 0.5rem;
  border-bottom-color: var(--color-border);
}

.scope-manager-tabs li {
  flex: 1;
  text-align: center;
}

.scope-manager-tabs a {
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  font-weight: 600;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius) var(--radius) 0 0;
  justify-content: center;
  color: var(--color-muted);
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.scope-manager-tabs li.is-active a {
  color: var(--color-text);
  background-color: var(--color-surface);
  box-shadow: var(--shadow-sm);
  border-bottom-color: var(--color-surface);
}

.scope-manager-tabs a:hover {
  color: #3273dc;
  background-color: var(--color-sidebar-hover);
}

/* ── Layout: sidebar & page ─────────────────────────────────── */

.app-sidebar {
  z-index: 3;
  width: 250px;
  padding: 1.25rem 1rem 1.5rem 1.25rem;
  box-sizing: border-box;
  border-right: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.app-sidebar .sidebar-header {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 1rem;
  font-size: var(--text-base);
}

.app-sidebar .sidebar-logo-col {
  flex: 0 0 auto;
}

.app-sidebar .sidebar-welcome-col {
  flex: 1 1 auto;
  min-width: 0;
}

.app-sidebar .sidebar-header strong {
  font-family: var(--font-heading);
  font-weight: 700;
}

.app-sidebar .sidebar-header .sidebar-logo {
  width: 60px;
  height: auto;
  display: block;
}

.app-sidebar .sidebar-user {
  margin-bottom: 0.5rem;
  text-align: center;
}

.app-sidebar .sidebar-user-email {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-muted);
  word-break: break-word;
}

.app-sidebar .sidebar-header .sidebar-github-link {
  display: inline-block;
  margin-top: 0.35rem;
  color: var(--color-muted);
  text-decoration: none;
}

.app-sidebar .sidebar-header .sidebar-github-link:hover {
  color: var(--color-text);
}

.app-sidebar .sidebar-logout-wrap {
  margin: 0.75rem 0 1rem;
}

.app-sidebar .sidebar-logout.button.is-primary {
  width: 100%;
  margin: 0;
  padding: 0.625rem 1rem;
  font-weight: 600;
  border-radius: var(--radius);
  white-space: nowrap;
}

.app-sidebar .sidebar-nav {
  margin-top: 0.5rem;
}

.app-sidebar .sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  padding: 0.75rem 0.75rem;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.app-sidebar .sidebar-nav-link .fa {
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.app-sidebar .sidebar-nav-link:hover {
  background-color: var(--color-sidebar-hover);
  color: #3273dc;
}

.app-sidebar .sidebar-nav-link.is-active,
.app-sidebar .sidebar-nav-link.is-active:hover {
  background-color: var(--color-sidebar-hover) !important;
  color: #3273dc !important;
  font-weight: 600;
}

.app-page {
  margin-left: 250px;
  margin-top: 43px;
  padding: 1.5rem 1.75rem 3rem;
  min-height: calc(100vh - 43px);
  box-sizing: border-box;
}

@media (max-width: 992px) {
  .app-page {
    margin-left: 0;
    padding: 1rem;
  }
}

.w3-bar.w3-top {
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--color-border);
}

/* ── AG-Grid ────────────────────────────────────────────────── */

.ag-grid-panel {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

/* Scope editor feature/values grid */
.scope-feature-grid.ag-theme-balham {
  --ag-header-height: 52px;
  --ag-row-height: 48px;
  --ag-font-size: 1.0625rem;
  --ag-header-foreground-color: var(--color-text);
  --ag-header-background-color: #f8fafc;
  --ag-background-color: var(--color-surface);
  --ag-odd-row-background-color: #fafbfc;
  --ag-row-hover-color: var(--color-sidebar-hover);
  --ag-border-color: var(--color-border);
  --ag-header-column-separator-color: var(--color-border);
  font-family: var(--font-body);
}

.scope-feature-grid.ag-theme-balham .ag-header {
  border-bottom: 2px solid var(--color-border);
}

.scope-feature-grid.ag-theme-balham .ag-header-cell-label {
  justify-content: center !important;
}

.scope-feature-grid.ag-theme-balham .ag-header-cell {
  text-align: center !important;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: 0.02em;
}

.scope-feature-grid.ag-theme-balham .ag-header-cell-text {
  text-align: center !important;
}

.scope-feature-grid.ag-theme-balham .ag-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center !important;
  font-size: 1.0625rem;
  line-height: 1.45;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.scope-feature-grid.ag-theme-balham .ag-cell-value,
.scope-feature-grid.ag-theme-balham .ag-group-value {
  text-align: center;
  width: 100%;
}

.scope-feature-grid.ag-theme-balham .ag-cell-wrapper {
  justify-content: center !important;
  width: 100%;
}

.scope-feature-grid.ag-theme-balham .ag-cell-editor input {
  text-align: center !important;
  font-size: 1.0625rem;
  font-family: var(--font-body);
}

.scope-feature-grid .ag-header-cell-centered .ag-header-cell-label {
  justify-content: center !important;
}

/* Legacy generic AG-Grid rules (other grids) */
.ag-theme-balham .ag-header-cell-label {
  justify-content: center !important;
}

.ag-theme-balham .ag-header-cell {
  text-align: center !important;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-sm);
}

.ag-theme-balham .ag-header-cell-text {
  text-align: center !important;
}

.ag-theme-balham .ag-cell {
  text-align: center !important;
  font-size: var(--text-base);
}

.ag-theme-balham .ag-cell-wrapper {
  justify-content: center !important;
}

.ag-theme-balham .ag-cell-editor input {
  text-align: center !important;
  font-size: var(--text-base);
}

.ag-header-cell-centered .ag-header-cell-label {
  justify-content: center !important;
}

.ag-overlay-loading-center {
  font-size: 1.125rem;
  color: #3273dc;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.95);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid #e3f2fd;
}

.ag-overlay-no-rows-center {
  font-size: var(--text-base);
  color: var(--color-muted);
  font-weight: 400;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  text-align: center;
}

/* ── Scope editor partials ──────────────────────────────────── */

#citation {
  font-size: 0.75rem;
  margin-top: 1.25rem;
  color: var(--color-muted);
}

.edit-scope-table-wrapper.is-scrollable {
  max-height: calc(2.75rem + 5 * 2.75rem);
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.edit-scope-table-wrapper.is-scrollable .edit-scope-table {
  margin-bottom: 0;
  box-shadow: none;
  border: none;
}

.edit-scope-table-wrapper.is-scrollable thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
  box-shadow: 0 1px 0 var(--color-border);
}

.edit-features-instructions {
  margin-top: 0.25rem;
}

.edit-features-instructions > summary {
  cursor: pointer;
  font-weight: 600;
  color: #3e8ed0;
  user-select: none;
}

.edit-features-instructions-body {
  margin-top: 0.75rem;
}

.edit-scope-table .edit-scope-select-col,
.edit-scope-table .edit-scope-select-cell {
  width: 5rem;
  text-align: center;
  vertical-align: middle;
}

.edit-scope-table .edit-scope-select-cell label.checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-height: 2.75rem;
}

.edit-scope-table .edit-scope-select-cell label.checkbox input[type="checkbox"] {
  margin: 0;
}

.edit-scope-table .edit-scope-row {
  cursor: pointer;
}

.edit-scope-table .edit-scope-row td {
  vertical-align: middle;
}

#scopecreate .w3-main,
#scopecreate-new .w3-main {
  margin-bottom: 2rem !important;
}

#scopecreate .message,
#scopecreate-new .message {
  margin-bottom: 1.5rem !important;
}

#scopecreate .block,
#scopecreate-new .block {
  margin-top: 1.5rem !important;
  margin-bottom: 1.5rem !important;
}

#edit-scope-editorcontainer,
#new-scope-editorcontainer {
  margin-bottom: 1rem;
}

#edit-scope-editor,
#new-scope-editor {
  width: 820px;
  min-height: 208px;
}

#edit-scope-editorcontainer,
#new-scope-editorcontainer {
  width: 820px;
  min-height: 208px;
}

#scope-preview-analysis-results {
  margin-bottom: 2rem;
}

#scope-preview-analysis-results .message {
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-lg);
}

#scope-preview-analysis-results ul {
  margin: 0;
  padding-left: 1.5rem;
}

#scope-preview-analysis-results li {
  margin-bottom: 0.5rem;
}

/* ── Results page ───────────────────────────────────────────── */

.results-table-container {
  width: 100%;
  max-height: 800px;
  overflow: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  margin-bottom: 1.25rem;
}

.results-table-container table {
  margin-bottom: 0;
  box-shadow: none;
  border: none;
}

.results-table-container table th,
.results-table-container table td,
.resultstable th,
.resultstable td {
  text-align: center !important;
  vertical-align: middle !important;
}

/* ── Auth pages ─────────────────────────────────────────────── */

.auth-page {
  background: linear-gradient(160deg, #f8fafc 0%, #e2e8f0 100%);
  min-height: 100vh;
}

.auth-card {
  max-width: 28rem;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}

.auth-logo {
  display: block;
  width: 96px;
  height: auto;
  margin: 0 auto 1.25rem;
}

.auth-header .subtitle {
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.auth-card .title {
  font-size: 1.75rem;
  margin-bottom: 0;
  line-height: 1.25;
}

/* Bulma pulls .subtitle up with negative margin; override on auth cards */
.auth-card .title + .subtitle {
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.auth-card .input {
  width: 100%;
}
