/* ═══════════════════════════════════════════════════════════════════════════
   layout.css — Grid, components, and utility classes
   Replaces Bootstrap 5 (v5.2.3/v5.3.0) classes used across the project.
   Load this BEFORE your custom CSS files.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bs-body-color: #212529;
  --bs-body-bg: #fff;
  --bs-border-color: #dee2e6;
  --bs-primary: #0d6efd;
  --bs-secondary: #6c757d;
  --bs-success: #198754;
  --bs-info: #0dcaf0;
  --bs-warning: #ffc107;
  --bs-danger: #dc3545;
  --bs-light: #f8f9fa;
  --bs-dark: #212529;
  --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-modal-zindex: 1055;
  --bs-backdrop-zindex: 1050;
}

/* ── Layout / Grid ─────────────────────────────────────────────────────── */
.container-fluid {
  width: 100%;
  padding-right: var(--bs-gutter-x, 0.75rem);
  padding-left: var(--bs-gutter-x, 0.75rem);
  margin-right: auto;
  margin-left: auto;
}

.row {
  --bs-gutter-x: 1.5rem;
  --bs-gutter-y: 0;
  display: flex;
  flex-wrap: wrap;
  margin-top: calc(-1 * var(--bs-gutter-y));
  margin-right: calc(-0.5 * var(--bs-gutter-x));
  margin-left: calc(-0.5 * var(--bs-gutter-x));
}

.row > * {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding-right: calc(var(--bs-gutter-x) * 0.5);
  padding-left: calc(var(--bs-gutter-x) * 0.5);
  margin-top: var(--bs-gutter-y);
}

.g-3,
.gy-3 { --bs-gutter-y: 1rem; }
.g-3,
.gx-3 { --bs-gutter-x: 1rem; }

.col   { flex: 1 0 0%; }
.col-3  { flex: 0 0 auto; width: 25%; }
.col-6  { flex: 0 0 auto; width: 50%; }
.col-12 { flex: 0 0 auto; width: 100%; }

@media (min-width: 768px) {
  .col-md-3  { flex: 0 0 auto; width: 25%; }
  .col-md-4  { flex: 0 0 auto; width: 33.33333333%; }
  .col-md-5  { flex: 0 0 auto; width: 41.66666667%; }
  .col-md-12 { flex: 0 0 auto; width: 100%; }
}

@media (min-width: 1200px) {
  .col-xl-2 { flex: 0 0 auto; width: 16.66666667%; }
}

/* ── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  position: relative;
}

.navbar-light {
  color: rgba(0,0,0,0.55);
}

.navbar-brand {
  display: inline-block;
  padding-top: 0.3125rem;
  padding-bottom: 0.3125rem;
  margin-right: 1rem;
  font-size: 1.25rem;
  line-height: inherit;
  white-space: nowrap;
  color: rgba(0,0,0,0.9);
  text-decoration: none;
}

.navbar-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding-left: 0; 
  list-style: none;
}

.nav-item { }

.nav-link {
  display: block;
  padding: 0.5rem 1rem;
  color: rgba(0,0,0,0.55);
  text-decoration: none;
}

.navbar-expand-lg { flex-wrap: nowrap; justify-content: flex-start; }

/* ── Card ──────────────────────────────────────────────────────────────── */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  word-wrap: break-word;
  background-color: #fff;
  background-clip: border-box;
  border: 1px solid rgba(0,0,0,0.125);
  border-radius: 0.375rem;
}

/* ── List Group ────────────────────────────────────────────────────────── */
.list-group {
  display: flex;
  flex-direction: column;
  padding-left: 0;
  margin-bottom: 0;
  border-radius: 0.375rem;
}

.list-group-item {
  position: relative;
  display: block;
  padding: 0.5rem 1rem;
  background-color: #fff;
  border: 1px solid rgba(0,0,0,0.125);
}

.list-group-item:first-child {
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}

/* ── Alerts ────────────────────────────────────────────────────────────── */
.alert {
  position: relative;
  padding: 1rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: 0.375rem;
}

.alert-primary {
  color: #084298;
  background-color: #cfe2ff;
  border-color: #b6d4fe;
}

.alert-info {
  color: #055160;
  background-color: #cff4fc;
  border-color: #b6effb;
}

.alert-warning {
  color: #664d03;
  background-color: #fff3cd;
  border-color: #ffecb5;
} 

/* ── Form Controls ─────────────────────────────────────────────────────── */
.form-control {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #212529;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
  color: #212529;
  background-color: #fff;
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13,110,253,0.25);
}

.form-control-sm {
  min-height: calc(1.5em + 0.5rem + 2px);
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  border-radius: 0.25rem;
}

.form-select {
  display: block;
  width: 100%;
  padding: 0.375rem 2.25rem 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #212529;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  appearance: none;
}

.form-select:focus {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13,110,253,0.25);
}

.form-select-sm {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  padding-left: 0.5rem;
  font-size: 0.875rem;
  border-radius: 0.25rem;
}

.form-label {
  margin-bottom: 0.5rem;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  font-weight: 400;
  line-height: 1.5;
  color: #212529;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  background-color: transparent;
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  border-radius: 0.375rem;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.btn-block {
  display: block;
  width: 100%;
}

.btn-danger {
  color: #fff;
  background-color: #dc3545;
  border-color: #dc3545;
}

.btn-danger:hover {
  color: #fff;
  background-color: #bb2d3b;
  border-color: #b02a37;
}

.btn-close {
  box-sizing: content-box;
  width: 1em;
  height: 1em;
  padding: 0.25em;
  color: #000;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E") center/1em auto no-repeat;
  border: 0;
  border-radius: 0.375rem;
  opacity: 0.5;
  cursor: pointer;
}

.btn-close:hover { opacity: 0.75; }

/* ── Typography Utilities ──────────────────────────────────────────────── */
.fw-bold { font-weight: 700 !important; }

.text-center { text-align: center !important; }

.text-muted { color: #6c757d !important; }

.text-danger { color: #dc3545 !important; }

.text-success { color: #198754 !important; }

small, .small { font-size: 0.875em; }

/* ── Spacing Utilities ─────────────────────────────────────────────────── */
.m-1 { margin: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mr-1 { margin-right: 0.25rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.ml-4 { margin-left: 1.5rem !important; }
.ms-2 { margin-left: 0.5rem !important; }

.p-0 { padding: 0 !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; } 
.py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }

/* ── Flex Utilities ────────────────────────────────────────────────────── */
.d-flex { display: flex !important; }
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.flex-fill { flex: 1 1 auto !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }

/* ── Progress ──────────────────────────────────────────────────────────── */
.progress {
  display: flex;
  height: 1rem;
  overflow: hidden;
  font-size: 0.75rem;
  background-color: #e9ecef;
  border-radius: 0.375rem;
}

.progress-bar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  background-color: #0d6efd;
  transition: width 0.6s ease;
}

/* ── Tables ────────────────────────────────────────────────────────────── */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: #212529;
  --bs-table-border-color: #dee2e6;
  --bs-table-accent-bg: transparent;

  width: 100%;
  margin-bottom: 1rem;
  color: var(--bs-table-color);
  vertical-align: top;
  border-color: var(--bs-table-border-color);
  border-collapse: collapse;
}

.table-dark {
  --bs-table-bg: #212529;
  --bs-table-color: #fff;
  --bs-table-border-color: #373b3e;

  color: var(--bs-table-color);
  background-color: var(--bs-table-bg);
}

.table-sm > :not(caption) > * > * {
  padding: 0.25rem 0.25rem;
}

.table > :not(caption) > * > * {
  padding: 0.5rem 0.5rem;
  border-bottom-width: 1px;
}

/* ── Background Utilities ──────────────────────────────────────────────── */
.bg-danger { background-color: #dc3545 !important; }
.bg-success { background-color: #198754 !important; }

/* ── Spinner ───────────────────────────────────────────────────────────── */
.spinner-border {
  display: block;
  margin: 0 auto;
  width: 6.5rem;
  height: 6.5rem;
  vertical-align: text-bottom;
  border: 0.8125em solid #F1F1F1;
  border-right-color: transparent;
  border-radius: 50%;
  animation: bs-spinner 0.75s linear infinite;
}

@keyframes bs-spinner {
  100% { transform: rotate(360deg); }
}

/* ── Screen Reader Only ────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Show / Fade utilities ─────────────────────────────────────────────── */
.show { display: block; }

/* ── Mobile responsive overrides ───────────────────────────────────────── */
@media (max-width: 767px) {
  .row > * {
    padding-right: calc(var(--bs-gutter-x) * 0.25);
    padding-left: calc(var(--bs-gutter-x) * 0.25);
  }
  .card {
    margin-left: 0;
    margin-right: 0;
  }
}

/* ── Image Sizing ──────────────────────────────────────────────────────── */
.img-creature { height: 120px; }
.img-creature-sm { height: 60px; object-fit: contain; }
.img-creature-md { height: 80px; width: 80px; object-fit: contain; border-radius: 6px; }
.img-house { height: 80px; }
.img-vehicle { height: 80px; }
.img-team-vehicle { height: 80px; }
.img-team-vehicle-sm { height: 60px; object-fit: contain; }
.img-item { height: 80px; }
.team-item img { object-fit: contain;}

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
.scroll-wood { overflow-y: auto; overflow-x: hidden; }
.scroll-wood::-webkit-scrollbar { width: 16px; }
.scroll-wood::-webkit-scrollbar-track { background: url('../images/ui/sb/sb-wood-track.png'); }
.scroll-wood::-webkit-scrollbar-thumb { background: url('../images/ui/sb/sb-wood-thumb.png'); }
.scroll-wood::-webkit-scrollbar-button:vertical:decrement { background: url('../images/ui/sb/sb-wood-arrow-up.png'); height: 16px; }
.scroll-wood::-webkit-scrollbar-button:vertical:increment { background: url('../images/ui/sb/sb-wood-arrow-down.png'); height: 16px; }
