/* ===== Toggle Buttons (active state toggled by JS) ===== */
.mp-toggle-btn {
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
  transition:
    color 0.25s,
    background 0.25s,
    box-shadow 0.25s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.mp-toggle-btn.active {
  color: #1e293b;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.mp-toggle-btn:hover:not(.active) {
  color: #475569;
}

/* ===== View hidden (toggled by JS) ===== */
.mp-view.hidden {
  display: none;
}

/* ===== Card entrance animation ===== */
@keyframes mp-card-enter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.mp-card {
  animation: mp-card-enter 0.4s ease both;
}
.mp-card:nth-child(1) {
  animation-delay: 0.04s;
}
.mp-card:nth-child(2) {
  animation-delay: 0.08s;
}
.mp-card:nth-child(3) {
  animation-delay: 0.12s;
}
.mp-card:nth-child(4) {
  animation-delay: 0.16s;
}
.mp-card:nth-child(5) {
  animation-delay: 0.2s;
}
.mp-card:nth-child(6) {
  animation-delay: 0.24s;
}
.mp-card:nth-child(7) {
  animation-delay: 0.28s;
}
.mp-card:nth-child(8) {
  animation-delay: 0.32s;
}
.mp-card:nth-child(9) {
  animation-delay: 0.36s;
}

/* ===== Tag colors — uses CSS custom property + color-mix() ===== */
.mp-card-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--tag-color) 12%, white);
  color: var(--tag-color);
}

/* ===== Filter chips (CO2) ===== */
.mp-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}
.mp-filter-chip:hover {
  border-color: #16a34a;
  color: #16a34a;
}
.mp-filter-chip.active {
  background: #dcfce7;
  border-color: #16a34a;
  color: #16a34a;
}
.mp-filter-chip i {
  font-size: 12px;
}

/* ===== Tag chips (color variable) ===== */
.mp-tag-chip {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}
.mp-tag-chip:hover {
  border-color: var(--tag-color);
  color: var(--tag-color);
}
.mp-tag-chip.active {
  background: color-mix(in srgb, var(--tag-color) 12%, white);
  border-color: var(--tag-color);
  color: var(--tag-color);
  font-weight: 600;
}

/* ===== AI panel animation ===== */
@keyframes mp-panel-enter {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.mp-ai-panel {
  animation: mp-panel-enter 0.3s ease both;
}
.mp-ai-panel.hidden {
  display: none;
}

/* ===== Map ===== */
#mp-map {
  width: 100%;
  height: 600px;
  border-radius: 12px;
  overflow: hidden;
}

/* ===== Mapbox popup ===== */
.mp-popup .mapboxgl-popup-content {
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-width: 300px;
}
.mp-popup .mapboxgl-popup-tip {
  border-top-color: #fff;
}

.mp-popup-card {
  display: block;
  width: 280px;
  text-decoration: none;
  color: inherit;
}
.mp-popup-card:hover {
  text-decoration: none;
  color: inherit;
}
.mp-popup-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.mp-popup-body {
  padding: 12px;
}
.mp-popup-body h4 {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 4px;
}
.mp-popup-body p {
  font-size: 13px;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}
.mp-popup-company {
  font-size: 12px !important;
  color: #94a3b8 !important;
  margin-bottom: 4px !important;
}
.mp-popup-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #16a34a;
}

/* ===========================================================
   Solution Detail Page
   =========================================================== */

.sd-wrapper {
  background: #f8fafc;
  min-height: 100vh;
}

.sd-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  transition: color 0.2s;
}
.sd-back:hover {
  color: #16a34a;
}

/* Hero */
.sd-hero {
  padding: 0 0 40px;
}

.sd-hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}
@media (min-width: 768px) {
  .sd-hero-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.sd-hero-img-wrap {
  border-radius: 16px;
  overflow: hidden;
}
.sd-hero-img {
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: cover;
  display: block;
}

.sd-hero-placeholder {
  width: 100%;
  min-height: 300px;
  background: linear-gradient(135deg, #e2e8f0, #f1f5f9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 64px;
  border-radius: 16px;
}

.sd-hero-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: sd-fade-in 0.5s ease both;
}

@keyframes sd-fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sd-company-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.sd-company-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.sd-company-name {
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
}

.sd-eco-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  font-size: 12px;
}

.sd-title {
  font-size: 32px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
  margin-bottom: 16px;
}

.sd-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.sd-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--tag-color) 12%, white);
  color: var(--tag-color);
}

.sd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.sd-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1.5px solid transparent;
}

.sd-btn-primary {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}
.sd-btn-primary:hover {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.sd-btn-outline {
  background: #fff;
  color: #1e293b;
  border-color: #e2e8f0;
}
.sd-btn-outline:hover {
  border-color: #16a34a;
  color: #16a34a;
  transform: translateY(-1px);
}

.sd-btn-ghost {
  background: transparent;
  color: #64748b;
  border-color: transparent;
}
.sd-btn-ghost:hover {
  color: #16a34a;
}

/* Content grid */
.sd-content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}
@media (min-width: 1024px) {
  .sd-content-grid {
    grid-template-columns: 2fr 1fr;
  }
}

/* Sections */
.sd-section {
  margin-bottom: 40px;
}

.sd-section-title {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}
.sd-section-title i {
  color: #16a34a;
  font-size: 16px;
}

.sd-prose {
  color: #475569;
  line-height: 1.7;
}

/* Video */
.sd-video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: 12px;
  overflow: hidden;
}
.sd-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Case articles */
.sd-cases-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 640px) {
  .sd-cases-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.sd-case-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}
.sd-case-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.sd-case-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}
.sd-case-body {
  padding: 14px;
}
.sd-case-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 6px;
}
.sd-case-content {
  font-size: 13px;
  color: #64748b;
}

/* Sidebar */
.sd-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sd-sidebar-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
}

.sd-sidebar-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 16px;
}

.sd-sidebar-company {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.sd-sidebar-logo {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
}

.sd-sidebar-desc {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 14px;
}

.sd-sidebar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
  margin-bottom: 8px;
}
.sd-sidebar-meta i {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}
.sd-sidebar-meta a {
  color: #16a34a;
}

/* Other solutions */
.sd-other-solution {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin: -4px -10px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease;
}
.sd-other-solution:hover {
  background: #f8fafc;
}
.sd-other-img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.sd-other-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  flex-shrink: 0;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 16px;
}

/* ===========================================================
   Dashboard
   =========================================================== */

.db-company-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px 20px;
}

.db-company-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.db-company-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.db-company-logo-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
}

.db-company-info {
  flex: 1;
  min-width: 0;
}

.db-company-name {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.3;
}

.db-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 2px;
  letter-spacing: 0.01em;
}

.db-badge-validated {
  background: #ecfdf5;
  color: #059669;
}
.db-badge-pending {
  background: #fffbeb;
  color: #d97706;
}

.db-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  background: #fff;
  border: 1px solid #e5e7eb;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.db-edit-btn:hover {
  border-color: #d1d5db;
  background: #f9fafb;
  text-decoration: none;
  color: #111827;
}

.db-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: #92400e;
  line-height: 1.4;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 14px;
}
.db-notice svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: #d97706;
}

.db-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.db-section-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  letter-spacing: -0.01em;
  margin: 0;
}

.db-card-actions {
  display: flex;
  gap: 4px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f3f4f6;
}

.db-action-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}
.db-action-link:hover {
  color: #111827;
  background: #f3f4f6;
  text-decoration: none;
}
.db-action-danger:hover {
  color: #dc2626;
  background: #fef2f2;
}

/* Add-solution CTA card */
.db-add-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 200px;
  border: 1.5px dashed #d1d5db;
  border-radius: 12px;
  color: #9ca3af;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}
.db-add-card:hover {
  border-color: #111827;
  color: #111827;
  background: #f9fafb;
  text-decoration: none;
}

/* Empty state — no company yet */
.db-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px 96px;
  max-width: 400px;
  margin: 0 auto;
}

.db-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: #f0fdf4;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #16a34a;
  margin-bottom: 24px;
}

.db-empty-title {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.db-empty-desc {
  font-size: 14px;
  color: #6b7280;
  line-height: 1.5;
  margin-bottom: 28px;
}

.db-empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  background: #111827;
  color: #fff;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.db-empty-btn:hover {
  background: #1f2937;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-decoration: none;
}

/* ===========================================================
   Forms (Company & Solution)
   =========================================================== */

.db-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.db-fieldset {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  background: #fff;
}

.db-legend {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
}
.db-legend i {
  color: #16a34a;
}

.db-field {
  margin-bottom: 18px;
}

.db-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.form-input,
.db-form select,
.db-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #1e293b;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.form-input:focus,
.db-form select:focus,
.db-form textarea:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.form-checkbox {
  accent-color: #16a34a;
}

.db-help {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
}
.db-error {
  font-size: 12px;
  color: #ef4444;
  margin-top: 4px;
}
.db-field-error .form-input {
  border-color: #ef4444;
}

.db-checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.db-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
}

/* Geocoding suggestions */
.db-suggestions {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: #fff;
  border: 1px solid #d1d5db;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.db-suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid #f1f5f9;
}
.db-suggestion-item:hover {
  background: #f8fafc;
}
.db-suggestion-item:last-child {
  border-bottom: none;
}

/* ===========================================================
   Auth Pages (Login / Signup)
   =========================================================== */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-logo {
  margin-bottom: 32px;
}
.auth-logo-img {
  height: 28px;
  width: auto;
}

.auth-title {
  font-size: 22px;
  font-weight: 600;
  color: #111827;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  text-align: center;
}

.auth-subtitle {
  font-size: 14px;
  color: #6b7280;
  text-align: center;
  margin-bottom: 28px;
}

.auth-form {
  width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 28px 24px 24px;
}

/* Override crispy/allauth form field styling inside auth pages */
.auth-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 5px;
}

.auth-form input[type='text'],
.auth-form input[type='email'],
.auth-form input[type='password'] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #111827;
  background: #fff;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.auth-form input[type='text']:focus,
.auth-form input[type='email']:focus,
.auth-form input[type='password']:focus {
  outline: none;
  border-color: #111827;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06);
}

.auth-form .helptext,
.auth-form #hint_id_password1,
.auth-form #hint_id_password2,
.auth-form .help-block {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
  line-height: 1.4;
}

.auth-form .errorlist {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
}
.auth-form .errorlist li {
  font-size: 12px;
  color: #ef4444;
}

.auth-form .asteriskField {
  display: none;
}

.auth-btn {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  margin-top: 20px;
  font-size: 14px;
  font-weight: 500;
  background: #111827;
  color: #fff;
  border: none;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.auth-btn:hover {
  background: #1f2937;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.auth-footer {
  width: 100%;
  text-align: center;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.auth-divider {
  display: block;
  width: 40px;
  height: 1px;
  background: #e5e7eb;
}

.auth-link {
  font-size: 13px;
  color: #6b7280;
  text-decoration: none;
  transition: color 0.15s ease;
}
.auth-link:hover {
  color: #111827;
}

.auth-switch {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

.auth-link-accent {
  font-weight: 500;
  color: #111827;
  text-decoration: none;
}
.auth-link-accent:hover {
  text-decoration: underline;
}
