/* Material / Enterprise-inspired stylesheet (fluent-like color palette) */
:root {
  --bg: #f3f6f9;
  --surface: #ffffff;
  --muted: #6b7280;
  --text: #111827;
  --primary: #0078d4;
  /* Microsoft blue */
  --primary-variant: #005a9e;
  --accent: #00b294;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --border-radius: 8px;
  --transition: all 0.2s ease;
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1100px;
  margin: 8px auto;
  padding: 8px;
  height: 100vh;
}

.nav-container {
  max-width: 1100px;
  margin: 4px auto;
  padding: 4px 20px;
}

.card {
  background: var(--surface);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 24px 0;
}

.page-title h1 {
  font-size: 20px;
  margin: 0;
  font-weight: 600;
}

.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.search-row input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #fff;
  transition: var(--transition);
}

.search-row input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
}

/* Form styling */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 15px;
  transition: var(--transition);
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
}

.form-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  accent-color: var(--primary);
}

.form-group .checkbox-label {
  display: flex;
  align-items: center;
  font-weight: normal;
  cursor: pointer;
}

.btn {
  display: inline-block;
  padding: 10px 16px;
  margin-right: 8px;
  margin-bottom: 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
  font-size: 15px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  margin-top: 16px;
  margin-bottom: 16px;
}

.btn-primary:hover {
  background: var(--primary-variant);
  border-color: var(--primary-variant);
}

.btn-outline {
  border-color: #d1d5db;
  background: transparent;
  color: var(--text);
}

.btn-outline:hover {
  background: #f9fafb;
}

.btn-danger {
  background: #f33;
  color: #fff;
  border-color: #f33;
}

.btn-danger:hover {
  background: #d12;
  border-color: #d12;
}

/* Button group styling */
.btn-group {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* Table styling */
.table-wrap {
  overflow: auto;
  border-radius: 8px;
  border: 1px solid #e6edf3;
  background: linear-gradient(180deg, #fff, #fbfdff);
  margin-bottom: 24px;
}

table.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.app-table th,
table.app-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #eef2f7;
}

table.app-table thead th {
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
}

table.app-table tr:hover td {
  background: #fcfdff;
}

table.app-table td.numeric {
  text-align: right;
}

.pagination {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.pagination a,
.pagination strong {
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
}

.pagination a {
  color: var(--primary);
  transition: var(--transition);
}

.pagination a:hover {
  background: #f0f8ff;
}

.pagination strong {
  background: #eef6ff;
  color: var(--primary);
}

.small {
  font-size: 13px;
  color: var(--muted)
}

/* Organisation detail table tweaks */
.meta-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.meta-row .meta {
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #eef2f7;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Inputs and checkboxes */
input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

/* Responsive adjustments */
@media (max-width: 720px) {
  .container {
    padding: 12px;
  }

  .card {
    padding: 16px;
  }

  table.app-table th,
  table.app-table td {
    padding: 10px 12px;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    margin-bottom: 8px;
    text-align: center;
  }
}

/* subtle focus states */
a:focus,
button:focus,
input:focus {
  outline: 2px solid rgba(0, 120, 212, 0.12);
  outline-offset: 2px;
}

/* Navbar / sticky header */
.page-nav {
  display: flex;
  margin-left: 12px;
  gap: 8px;
  align-items: center;
}

.page-nav .btn {
  padding: 6px 10px;
  font-size: 13px;
}

.page-nav {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, var(--surface), #fbfdff);
  z-index: 40;
  padding: 10px 0;
  border-bottom: 1px solid #e6edf3;
}

/* When sticky, keep a subtle shadow */
.page-nav.stuck {
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.06);
}

/* Ensure content below header isn't hidden when .page-nav sticks */
.container {
  padding-top: 28px;
}

/* Full-width site header */
.site-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  z-index: 60;
  border-bottom: 1px solid #e6edf3;
}

.site-header .container,
.site-header .nav-container {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-brand .logo {
  width: 100px;
  flex: 0 0 44px;
  object-fit: contain;
}

.brand-name {
  font-weight: 700;
  font-size: 17px;
  line-height: 1;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1;
}

/* Full-page layout */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
}

.content {
  flex: 1;
}

/* Site footer */
.site-footer {
  margin-top: auto;
  padding: 16px 0;
  text-align: center;
  background: var(--surface);
  color: var(--muted);
  border-top: 1px solid #e6edf3;
  font-size: 13px;
}

/* Main content layout */
.main-content {
  display: flex;
  height: calc(100vh - 100px);
  gap: 20px;
  margin-top: 20px;
}

.regions-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.regions-column .page-title {
  margin-top: 0;
  margin-bottom: 15px;
}

.regions-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 10px;
}

.region-card {
  padding: 12px 15px;
  margin-bottom: 10px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e6edf3;
  transition: all 0.2s ease;
  cursor: pointer;
}

.region-card:hover {
  background: #e6f4ff;
  border-color: var(--primary);
  transform: translateX(5px);
}

.region-card a {
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  display: block;
}

.broadcasts-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.broadcasts-info {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e6edf3;
}

.broadcasts-summary {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e6edf3;
}

.broadcasts-summary h3 {
  margin-top: 0;
  margin-bottom: 10px;
  color: var(--primary);
}

.total-cost {
  font-size: 24px;
  font-weight: 700;
  color: #007a00;
  margin: 0;
}

.broadcasts-details h3 {
  margin-top: 0;
  margin-bottom: 15px;
}

.region-item {
  cursor: pointer;
}

.region-item:hover {
    color: #0056b3;
    text-decoration: underline;
}

.region-detail {
  padding: 10px;
  margin-bottom: 10px;
  background: #ffffff;
  border-radius: 4px;
  border-left: 3px solid var(--primary);
}

.loading {
  text-align: center;
  padding: 20px;
  color: var(--muted);
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
    height: auto;
  }
  
  .regions-column,
  .broadcasts-column {
    flex: none;
    height: 50vh;
  }
  
  .regions-list,
  .broadcasts-info {
    height: 100%;
  }
}