/* ============================================================
   Sounder Maps Portal — Styles
   ============================================================ */

/* ── Reset / Base ── */
.smp-body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1a1a2e;
  background: #f5f7fa;
  -webkit-font-smoothing: antialiased;
}
.smp-body *, .smp-body *::before, .smp-body *::after { box-sizing: border-box; }
.smp-body a { color: #2563eb; text-decoration: none; }
.smp-body a:hover { text-decoration: underline; }

/* ── Nav ── */
.smp-nav {
  background: #0f2545;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}
.smp-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.smp-nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff !important;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none !important;
  letter-spacing: -0.2px;
}
.smp-nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.smp-nav-user {
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
}
.smp-nav-link {
  color: #e2e8f0 !important;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
}
.smp-nav-link:hover { color: #fff !important; text-decoration: none !important; }
.smp-nav-logout { border-left: 1px solid rgba(255,255,255,0.25); padding-left: 20px; }

/* ── Portal wrap ── */
.smp-portal-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ── Page header ── */
.smp-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.smp-page-title {
  font-size: 24px;
  font-weight: 700;
  color: #0f2545;
  margin: 0;
  line-height: 1.2;
}
.smp-page-desc {
  margin: 4px 0 0;
  color: #4b5563;
  font-size: 14px;
}
.smp-back-link {
  display: inline-block;
  color: #4b5563 !important;
  font-size: 13px;
  margin-bottom: 4px;
  text-decoration: none !important;
}
.smp-back-link:hover { color: #2563eb !important; }

/* ── Buttons ── */
.smp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none !important;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.smp-btn-primary   { background: #b91c1c !important; color: #fff !important; border-color: #b91c1c !important; }
.smp-btn-primary:hover { background: #991b1b !important; border-color: #991b1b !important; }
.smp-btn-secondary { background: #fff; color: #374151 !important; border-color: #d1d5db; }
.smp-btn-secondary:hover { background: #f9fafb; border-color: #9ca3af; }
.smp-btn-ghost     { background: transparent; color: #4b5563 !important; border-color: transparent; }
.smp-btn-ghost:hover { background: #f3f4f6; color: #374151 !important; }
.smp-btn-danger    { background: #b91c1c !important; color: #fff !important; border-color: #b91c1c !important; }
.smp-btn-danger:hover { background: #991b1b !important; border-color: #991b1b !important; }
.smp-btn-full      { width: 100%; }
.smp-btn-sm        { padding: 6px 12px; font-size: 13px; }
.smp-btn-xs        { padding: 4px 10px; font-size: 12px; }

/* ── Button spinner ── */
@keyframes smp-spin { to { transform: rotate(360deg); } }
.smp-btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: smp-spin 0.6s linear infinite;
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Cards ── */
.smp-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 28px;
}
.smp-card-flush { padding: 0; overflow: hidden; }

/* ── Notices ── */
.smp-notice {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
}
.smp-notice-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.smp-notice-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.smp-notice-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Map Grid (dashboard) ── */
.smp-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.smp-map-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.smp-map-card-accent {
  height: 4px;
}
.smp-map-card-body {
  padding: 20px 20px 12px;
  flex: 1;
}
.smp-map-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f2545;
  margin: 0 0 6px;
}
.smp-map-card-meta {
  font-size: 13px;
  color: #374151;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.smp-dot { color: #4b5563; }
.smp-map-color-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.smp-map-card-actions {
  padding: 12px 20px 16px;
  display: flex;
  gap: 8px;
  border-top: 1px solid #f3f4f6;
}

/* ── Empty state ── */
.smp-empty-state {
  text-align: center;
  padding: 64px 24px;
  background: #fff;
  border: 1px dashed #d1d5db;
  border-radius: 10px;
}
.smp-empty-icon { font-size: 40px; margin-bottom: 12px; }
.smp-empty-state h2 { font-size: 18px; color: #374151; margin: 0 0 8px; }
.smp-empty-state p  { color: #4b5563; margin: 0 0 20px; }

/* ── Forms ── */
.smp-form-section {
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 24px;
  margin-bottom: 24px;
}
.smp-form-section:last-of-type { border-bottom: none; }
.smp-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f2545;
  margin: 0 0 4px;
}
.smp-section-desc {
  font-size: 13px;
  color: #4b5563;
  margin: 0 0 16px;
}
.smp-field {
  margin-bottom: 16px;
}
.smp-field:last-child { margin-bottom: 0; }
.smp-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}
.smp-field input[type="text"],
.smp-field input[type="email"],
.smp-field input[type="url"],
.smp-field input[type="tel"],
.smp-field input[type="password"],
.smp-field select,
.smp-field textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: #1a1a2e;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.smp-field input:focus,
.smp-field select:focus,
.smp-field textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.smp-field textarea { resize: vertical; min-height: 80px; }
.smp-field-help {
  font-size: 12px;
  color: #4b5563;
  margin: 4px 0 0;
}
.smp-required { color: #dc2626; }
.smp-field-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.smp-field-grow { flex: 1; min-width: 180px; }
.smp-field-half { flex: 1; min-width: 140px; }
.smp-field-sm   { width: 100px; flex-shrink: 0; }

/* Color picker row */
.smp-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.smp-color-picker {
  width: 40px !important;
  height: 38px;
  padding: 2px 4px !important;
  border-radius: 6px;
  cursor: pointer;
}
.smp-color-text { max-width: 120px !important; }

/* Checkbox / radio grids */
.smp-checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.smp-checkbox-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  font-weight: normal;
}
.smp-checkbox-label input { width: 15px; height: 15px; cursor: pointer; margin: 0; }
.smp-radio-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.smp-radio-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  font-weight: normal;
}
.smp-radio-label input { margin: 0; }

/* Form actions row */
.smp-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
  flex-wrap: wrap;
}

/* ── Embed code ── */
.smp-embed-code {
  width: 100%;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 14px;
  resize: none;
  line-height: 1.6;
  margin-bottom: 12px;
}

/* ── Table ── */
.smp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.smp-table thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4b5563;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
.smp-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
}
.smp-table tbody tr:last-child { border-bottom: none; }
.smp-table tbody tr:hover { background: #f9fafb; }
.smp-table td {
  padding: 12px 16px;
  vertical-align: middle;
}
.smp-table-name a { font-weight: 600; color: #0f2545 !important; }
.smp-table-name a:hover { color: #2563eb !important; }
.smp-table-address { color: #4b5563; max-width: 240px; }
.smp-table-actions { text-align: right; white-space: nowrap; }

/* Badges */
.smp-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.smp-badge-green { background: #dcfce7; color: #166534; }
.smp-badge-gray  { background: #f3f4f6; color: #4b5563; }

/* ── Login page ── */
.smp-login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f2545 0%, #1e3a6e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.smp-login-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.smp-login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}
.smp-login-logo-text {
  display: flex;
  flex-direction: column;
}
.smp-login-brand {
  font-size: 18px;
  font-weight: 800;
  color: #0f2545;
  line-height: 1;
}
.smp-login-subtitle {
  font-size: 13px;
  color: #4b5563;
  margin-top: 3px;
}
.smp-login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 20px;
}
.smp-login-form .smp-field { margin-bottom: 18px; }
.smp-login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #4b5563;
}
.smp-login-remember label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-weight: normal;
}
.smp-login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: #4b5563;
}
.smp-login-footer a { color: #2563eb !important; }

/* ── List tabs (Manage Lists) ── */
.smp-list-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
}
.smp-list-tab {
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #4b5563 !important;
  text-decoration: none !important;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
.smp-list-tab:hover { color: #b91c1c !important; text-decoration: none !important; }
.smp-list-tab-active { color: #b91c1c !important; border-bottom-color: #b91c1c; }

/* ── CSV import ── */
.smp-csv-file-input {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  font-family: inherit;
}
.smp-csv-mapping-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}
.smp-csv-mapping-table {
  min-width: 560px;
  border: none !important;
}
.smp-csv-mapping-table th,
.smp-csv-mapping-table td {
  vertical-align: middle;
}
.smp-csv-col-header {
  display: inline-block;
  font-weight: 600;
  font-size: 13px;
  color: #1a1a2e;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.smp-csv-field-select {
  width: 100%;
  min-width: 160px;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #1a1a2e;
}
.smp-csv-preview-cell {
  max-width: 220px;
}
.smp-csv-preview-vals {
  font-size: 12px;
  color: #6b7280;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .smp-portal-wrap { padding: 20px 16px 48px; }
  .smp-nav-inner   { padding: 0 16px; }
  .smp-page-header { flex-direction: column; align-items: stretch; }
  .smp-map-grid    { grid-template-columns: 1fr; }
  .smp-field-row   { flex-direction: column; }
  .smp-field-sm, .smp-field-half { width: 100%; }
  .smp-card        { padding: 20px; }
}
