/* Unified UI system for UK Court Archives */

:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  --radius-4: 4px;
  --radius-6: 6px;
  --radius-8: 8px;
  --radius-10: 10px;
  --radius-12: 12px;
  --radius-16: 16px;

  --btn-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
  --btn-shadow-hover: 0 8px 22px rgba(37, 99, 235, 0.35);
}

/* Hero */
.hero { position: relative; color: #fff; padding: 80px 20px; text-align: center; background: linear-gradient(135deg, var(--primary-navy) 0%, var(--primary-dark-blue) 100%); }
.hero__title { font-size: 3rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: var(--space-4); }
.hero__subtitle { font-size: 1.25rem; opacity: .92; max-width: 800px; margin: 0 auto var(--space-8); color: #e5e7eb; }
.hero__actions { display: flex; gap: var(--space-4); justify-content: center; flex-wrap: wrap; }
@media (max-width: 768px) { .hero { padding: 60px 15px; } .hero__title { font-size: 2.4rem; } .hero__subtitle { font-size: 1.1rem; } }

/* Search bar */
.search-bar { max-width: 720px; margin: 0 auto; position: relative; }
.search-input { width: 100%; padding: 18px 120px 18px 20px; border: 2px solid var(--border-color); border-radius: 9999px; font-size: 1.05rem; background: #fff; box-shadow: var(--shadow); transition: box-shadow .2s ease, border-color .2s ease; }
.search-input:focus { border-color: var(--primary-blue); outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.btn-icon { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 100px; height: 44px; border-radius: 22px; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 600; background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark-blue) 100%); color: #fff; border: none; cursor: pointer; transition: all 0.3s ease; }
.btn-icon:hover { background: linear-gradient(135deg, var(--primary-navy) 0%, var(--primary-dark-blue) 100%); transform: translateY(-50%) scale(1.05); }

/* Section headings */
.section-title { text-align: center; font-size: 2.2rem; color: var(--text-primary); margin-bottom: var(--space-4); font-weight: 700; }
.section-subtitle { text-align: center; font-size: 1.1rem; color: var(--text-secondary); max-width: 800px; margin: 0 auto var(--space-8); }

/* Stat strip */
.stats-strip { background: var(--primary-navy); color: #fff; padding: var(--space-8) var(--space-6); text-align: center; }
.stats-strip .stat { }
.stats-strip .stat h3 { font-size: 2.6rem; font-weight: 800; color: var(--primary-blue); margin-bottom: var(--space-2); }
.stats-strip .stat p { opacity: .9; }

/* Layout rhythm */
.section { margin: var(--space-10) 0; }
.section--tight { margin: var(--space-6) 0; }
.section--loose { margin: 60px 0; }

/* Buttons */
.btn { display: inline-block; font-weight: 600; text-decoration: none; border: 0; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease; }
.btn:focus { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

.btn-primary { background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark-blue) 100%); color: #fff; padding: 12px 20px; border-radius: var(--radius-12); box-shadow: var(--btn-shadow); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-navy) 0%, var(--primary-dark-blue) 100%); transform: translateY(-2px); box-shadow: var(--btn-shadow-hover); }

.btn-secondary { background: #fff; color: var(--primary-navy); padding: 12px 20px; border-radius: var(--radius-12); border: 2px solid var(--border-color); }
.btn-secondary:hover { border-color: var(--primary-blue); color: var(--primary-blue); box-shadow: 0 6px 20px rgba(37, 99, 235, 0.2); transform: translateY(-2px); }

.btn-pill { border-radius: 9999px; padding: 12px 24px; }
.btn-sm { padding: 8px 14px; border-radius: var(--radius-8); font-size: .95rem; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 14px; font-size: .85rem; font-weight: 700; letter-spacing: .3px; }
.badge--crown { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; }
.badge--mag { background: linear-gradient(135deg, #059669, #047857); color: #fff; }
.badge--info { background: linear-gradient(135deg, #2563eb, #1e40af); color: #fff; }

/* Cards */
.card { background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-16); box-shadow: 0 4px 20px rgba(0,0,0,.08); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.card:hover { transform: translateY(-6px); box-shadow: 0 20px 60px rgba(0,0,0,.15); border-color: var(--primary-blue); }
.card__header { padding: var(--space-6) var(--space-8); border-bottom: 1px solid var(--border-color); }
.card__body { padding: var(--space-8); }
.card__footer { padding: var(--space-6) var(--space-8); border-top: 1px solid var(--border-color); }

/* Utilities */
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mt-6 { margin-top: var(--space-6) !important; }
.mt-8 { margin-top: var(--space-8) !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: var(--space-2) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.mb-6 { margin-bottom: var(--space-6) !important; }
.mb-8 { margin-bottom: var(--space-8) !important; }
.py-6 { padding-top: var(--space-6) !important; padding-bottom: var(--space-6) !important; }
.px-6 { padding-left: var(--space-6) !important; padding-right: var(--space-6) !important; }

/* Tables */
.table-modern { width: 100%; background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-12); border-collapse: separate; border-spacing: 0; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.table-modern th { background: linear-gradient(135deg, var(--primary-navy) 0%, var(--primary-dark-blue) 100%); color: #fff; padding: 14px 12px; font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid var(--primary-blue); }
.table-modern td { padding: 14px 12px; border-bottom: 1px solid rgba(0,0,0,.06); color: var(--text-primary); font-size: .95rem; }
.table-modern tr:hover { background: linear-gradient(135deg, rgba(37, 99, 235, 0.02) 0%, rgba(37, 99, 235, 0.05) 100%); }


/* Global responsive helpers */
img { max-width: 100%; height: auto; }
* { box-sizing: border-box; }
body { overflow-x: hidden; }

@media (max-width: 768px) {
  .section { margin: var(--space-6) 0; }
  .section-title { font-size: 1.8rem; }
  .section-subtitle { font-size: 1rem; }
  .btn { width: 100%; }
  .search-input { padding: 16px 18px; font-size: 1rem; margin-bottom: 12px; }
  .btn-icon { position: static; width: 100%; height: 48px; font-size: 1rem; transform: none; }
  .search-bar { display: flex; flex-direction: column; }
}

@media (max-width: 576px) {
  .stats-strip .stat h3 { font-size: 2rem; }
  .table-modern { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
