﻿@import url('/static/buttons.css?v=20260304-1');
:root {
  --ds-breakpoint-mobile-max: 767.98px;
  --ds-breakpoint-tablet-min: 768px;
  --ds-breakpoint-desktop-min: 1024px;

  --ds-layout-max-width: 1280px;
  --ds-layout-gutter-x: 16px;
  --ds-layout-gutter-y: 12px;

  --ds-space-4: 4px;
  --ds-space-8: 8px;
  --ds-space-12: 12px;
  --ds-space-16: 16px;
  --ds-space-20: 20px;
  --ds-space-24: 24px;
  --ds-space-32: 32px;

  --ds-radius-card: 12px;
  --ds-radius-button: 10px;
  --ds-shadow-card: 0 8px 24px rgba(15, 23, 42, 0.08);

  --ds-color-bg: #eef4fb;
  --ds-color-card: #f9fcff;
  --ds-color-text: #1f2a37;
  --ds-color-muted: #5f6b7a;
  --ds-color-border: #cfd8e3;

  --ds-color-primary: #1f6ab3;
  --ds-color-primary-hover: #185892;
  --ds-color-secondary: #5a6575;
  --ds-color-secondary-hover: #485162;
  --ds-color-danger: #d94334;
  --ds-color-danger-hover: #bf372a;
  --ds-color-success: #31a470;
  --ds-color-success-hover: #278a5d;
  --ds-color-warning: #8b5e3c;
  --ds-color-warning-hover: #6f4527;

  --ds-button-height: 40px;
  --ds-button-padding-x: 16px;
  --ds-button-font-size: 14px;
}

@media (min-width: 768px) {
  :root {
    --ds-layout-gutter-x: 24px;
    --ds-layout-gutter-y: 16px;
  }
}

@media (min-width: 1024px) {
  :root {
    --ds-layout-gutter-x: 32px;
    --ds-layout-gutter-y: 20px;
  }
}

body {
  color: var(--ds-color-text);
}

.layout-wrapper,
.page {
  min-height: 100vh;
  min-height: 100dvh;
  padding-block: var(--ds-layout-gutter-y);
}

.layout-container,
.container {
  width: min(100%, var(--ds-layout-max-width));
  max-width: var(--ds-layout-max-width);
  margin-inline: auto;
  padding-inline: var(--ds-layout-gutter-x) !important;
}

.admin-ui .container,
.user-ui .container,
.exam-ui .container,
.practice-ui .container,
.question-edit-ui .container,
.login-ui .container,
.register-ui .container {
  max-width: var(--ds-layout-max-width) !important;
}

.layout-content {
  width: 100%;
}

.auth-page.layout-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-page.layout-wrapper > .layout-container {
  display: flex;
  justify-content: center;
}

.auth-page .auth-card {
  width: min(100%, 420px);
  margin-inline: auto;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ds-space-16);
}

.page-header > :first-child {
  flex: 1 1 320px;
  min-width: 0;
}

.page-header .compact-actions,
.page-header .page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--ds-space-8);
  margin-left: auto;
}

.page-header .admin-quote-row {
  flex: 1 1 100%;
}

.card,
.ds-card {
  border-radius: var(--ds-radius-card);
  border: 1px solid var(--ds-color-border);
  background: var(--ds-color-card);
  box-shadow: var(--ds-shadow-card);
  padding: var(--ds-space-16);
}

@media (min-width: 1024px) {
  .card,
  .ds-card {
    padding: var(--ds-space-20);
  }
}

button,
.btn {
  min-height: var(--ds-button-height);
  padding: 0 var(--ds-button-padding-x);
  border-radius: var(--ds-radius-button);
  font-size: var(--ds-button-font-size);
  font-weight: 700;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

button:not(.secondary):not(.danger):not(.success):not(.warning):not(.action-red):not(.action-green):not(.action-brown):not(.module-tile),
.action-blue,
.btn-primary {
  background: var(--ds-color-primary);
  color: #fff;
}

button:not(.secondary):not(.danger):not(.success):not(.warning):not(.action-red):not(.action-green):not(.action-brown):not(.module-tile):hover,
.action-blue:hover,
.btn-primary:hover {
  background: var(--ds-color-primary-hover);
}

button.secondary,
.btn-secondary {
  background: var(--ds-color-secondary);
  color: #fff;
}

button.secondary:hover,
.btn-secondary:hover {
  background: var(--ds-color-secondary-hover);
}

button.success,
.action-green,
.btn-success {
  background: var(--ds-color-success);
  color: #fff;
}

button.success:hover,
.action-green:hover,
.btn-success:hover {
  background: var(--ds-color-success-hover);
}

button.danger,
.action-red,
.btn-danger {
  background: var(--ds-color-danger);
  color: #fff;
}

button.danger:hover,
.action-red:hover,
.btn-danger:hover {
  background: var(--ds-color-danger-hover);
}

button.warning,
.action-brown,
.btn-warning {
  background: var(--ds-color-warning);
  color: #fff;
}

button.warning:hover,
.action-brown:hover,
.btn-warning:hover {
  background: var(--ds-color-warning-hover);
}

button:disabled,
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.form-row {
  display: grid;
  gap: var(--ds-space-8);
}

.form,
.grid {
  gap: var(--ds-space-12);
}

.option-item,
.choice-item,
.option {
  border-radius: 10px;
}

.muted {
  color: var(--ds-color-muted);
}

.admin-ui .admin-stack,
.user-ui .user-shell,
.exam-ui #app,
.practice-ui #app,
.question-edit-ui #app {
  width: 100%;
}

.exam-ui #app.exam-taking-layout {
  width: var(--exam-taking-shell-width);
  max-width: var(--exam-taking-shell-width);
}

.exam-ui #app.exam-taking-layout > .card.form {
  width: calc(var(--exam-taking-shell-width) - (var(--ds-layout-gutter-x) * 2));
  max-width: calc(var(--exam-taking-shell-width) - (var(--ds-layout-gutter-x) * 2));
}

.bank-question-panel {
  display: none;
  margin-top: var(--ds-space-12);
}

.inline-warning {
  color: #b45309;
  font-size: 12px;
  margin-top: var(--ds-space-4);
}

@media (max-width: 767.98px) {
  :root {
    --ds-button-height: 36px;
    --ds-button-padding-x: 14px;
  }

  .layout-container,
  .container {
    padding-inline: var(--ds-layout-gutter-x) !important;
  }

  .card,
  .ds-card {
    padding: var(--ds-space-12);
  }

  .page-header .compact-actions,
  .page-header .page-header-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }
}

/* Mobile/tablet layout tune: keep key practice/user actions side-by-side like the reference. */
@media (max-width: 1024px) {
  .practice-ui .practice-topbar > .button-group:first-child,
  .practice-ui .practice-topbar > .compact-actions:first-child {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-flow: row;
    gap: 8px !important;
    justify-items: stretch !important;
    align-items: stretch !important;
    width: 100%;
    flex: 0 0 auto !important;
  }

  .practice-ui .practice-topbar > .button-group:first-child > button,
  .practice-ui .practice-topbar > .button-group:first-child > .mini,
  .practice-ui .practice-topbar > .button-group:first-child > #wrongBookPassCount,
  .practice-ui .practice-topbar > .compact-actions:first-child > button,
  .practice-ui .practice-topbar > .compact-actions:first-child > .mini,
  .practice-ui .practice-topbar > .compact-actions:first-child > #wrongBookPassCount {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    justify-content: center;
  }

  .practice-ui .practice-topbar > .button-group:first-child > button,
  .practice-ui .practice-topbar > .compact-actions:first-child > button {
    height: 36px !important;
    min-height: 36px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .practice-ui .practice-topbar > .button-group:first-child > .mini,
  .practice-ui .practice-topbar > .compact-actions:first-child > .mini {
    height: 34px !important;
    min-height: 34px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
  }

  .practice-ui .practice-topbar > .button-group:first-child > #wrongBookPassCount,
  .practice-ui .practice-topbar > .compact-actions:first-child > #wrongBookPassCount {
    height: 34px !important;
    min-height: 34px !important;
    text-align: center;
  }

  .practice-ui .practice-topbar > .button-group:last-child,
  .practice-ui .practice-topbar > .compact-actions:last-child {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    align-items: stretch !important;
    width: 100%;
    flex: 0 0 auto !important;
  }

  .practice-ui .practice-topbar > .button-group:last-child > button,
  .practice-ui .practice-topbar > .compact-actions:last-child > button {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  .user-ui td.col-actions .button-group.user-bank-actions.user-bank-actions--two {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .user-ui td.col-actions .button-group.user-bank-actions.user-bank-actions--three {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .user-ui td.col-actions .button-group.user-bank-actions > button {
    width: 100% !important;
    min-width: 0 !important;
  }
}

/* Force 2x2 for practice top buttons (left/right groups) on all narrow containers; override any flex */
.practice-ui .practice-topbar > .practice-top-left-actions,
.practice-ui .practice-topbar > .practice-top-right-actions {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-auto-flow: row;
  gap: 8px !important;
  justify-items: stretch !important;
  align-items: stretch !important;
  width: 100% !important;
  flex: 0 0 auto !important;
}

.practice-ui .practice-topbar > .practice-top-left-actions > button,
.practice-ui .practice-topbar > .practice-top-left-actions > .mini,
.practice-ui .practice-topbar > .practice-top-left-actions > #wrongBookPassCount,
.practice-ui .practice-topbar > .practice-top-right-actions > button {
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.practice-ui .practice-topbar > .practice-top-left-actions > button,
.practice-ui .practice-topbar > .practice-top-right-actions > button {
  height: 36px !important;
  min-height: 36px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.practice-ui .practice-topbar > .practice-top-left-actions > .mini,
.practice-ui .practice-topbar > .practice-top-left-actions > #wrongBookPassCount {
  height: 34px !important;
  min-height: 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

.practice-ui .practice-topbar > .practice-top-left-actions > #wrongBookPassCount {
  text-align: center;
}

