/* ==========================================================================
   SeaMedic AI — GDPR & ePrivacy Compliant Cookie Consent Banner & Preferences
   Complies with: EDPB Guidelines 05/2020, EDPB 03/2022 (Dark Patterns),
   and cookie-banner.ca GDPR Consent Requirements.
   ========================================================================== */

:root {
  --cb-navy: #0A1F2E;
  --cb-card: #0E2A3D;
  --cb-border: #23455B;
  --cb-ink: #111827;
  --cb-text: #E5EDF2;
  --cb-muted: #8FA6B6;
  --cb-teal: #1F6F78;
  --cb-teal-hover: #298994;
  --cb-teal-light: #EBF5F5;
  --cb-flare: #E14A1B;
  --cb-mint: #9FD6C4;
  --cb-white: #FFFFFF;
  --cb-radius: 6px;
  --cb-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Floating Re-Access / Revocation Badge (Bottom-Left) */
.cookie-floating-badge {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: 9998;
  background: var(--cb-navy);
  color: var(--cb-mint);
  border: 1px solid var(--cb-border);
  padding: 8px 14px;
  border-radius: 20px;
  font-family: var(--cb-font);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
  user-select: none;
  text-decoration: none;
}
.cookie-floating-badge:hover {
  background: var(--cb-card);
  color: #FFFFFF;
  border-color: var(--cb-mint);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.cookie-floating-badge:focus-visible {
  outline: 2px solid var(--cb-mint);
  outline-offset: 2px;
}
.cookie-floating-badge svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Bottom Cookie Banner Container */
.cookie-banner-backdrop {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: rgba(10, 31, 46, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--cb-border);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  padding: 22px 24px;
  font-family: var(--cb-font);
  color: var(--cb-text);
  animation: cbSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cbSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.cookie-banner-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 960px) {
  .cookie-banner-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
  }
}

.cookie-banner-content {
  flex: 1;
}

.cookie-banner-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.cookie-banner-title {
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  margin: 0;
  letter-spacing: -0.01em;
}

.cookie-banner-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: monospace;
  background: rgba(159, 214, 196, 0.12);
  color: var(--cb-mint);
  border: 1px solid rgba(159, 214, 196, 0.25);
  padding: 2px 7px;
  border-radius: 4px;
}

.cookie-banner-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--cb-muted);
  margin: 0;
}

.cookie-banner-text a {
  color: var(--cb-mint);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cookie-banner-text a:hover {
  color: #FFFFFF;
}

/* Action Buttons (Equal Prominence - Anti Dark Pattern Rule) */
.cookie-banner-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Both Accept and Reject have EQUAL visual weight and dimensions */
.cb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--cb-radius);
  font-family: var(--cb-font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  border: 1px solid transparent;
  text-decoration: none;
  box-sizing: border-box;
}

.cb-btn:focus-visible {
  outline: 2px solid var(--cb-mint);
  outline-offset: 2px;
}

/* Reject Non-Essential: Clean High-Contrast Border Button */
.cb-btn-reject {
  background: #14374D;
  color: #FFFFFF;
  border-color: #2F5973;
}
.cb-btn-reject:hover {
  background: #1C4A66;
  border-color: #437C9E;
}

/* Accept All: High Contrast Teal Accent Button */
.cb-btn-accept {
  background: var(--cb-teal);
  color: #FFFFFF;
  border-color: #2D8C96;
}
.cb-btn-accept:hover {
  background: var(--cb-teal-hover);
  border-color: #38A9B6;
}

/* Customize: Subtle secondary */
.cb-btn-customize {
  background: transparent;
  color: var(--cb-muted);
  border-color: var(--cb-border);
}
.cb-btn-customize:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #FFFFFF;
  border-color: #42677F;
}

/* ==========================================================================
   Cookie Preferences Modal (Granular Choice & Categories)
   ========================================================================== */
.cb-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(5, 15, 22, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: cbFadeIn 0.2s ease;
}

@keyframes cbFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cb-modal-dialog {
  background: #FFFFFF;
  color: var(--cb-ink);
  border-radius: 8px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
  font-family: var(--cb-font);
  overflow: hidden;
  position: relative;
}

.cb-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #E5E7EB;
  background: #F9FAFB;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cb-modal-header-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--cb-navy);
}

.cb-modal-close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #6B7280;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.cb-modal-close-btn:hover {
  color: #111827;
  background: #E5E7EB;
}

.cb-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.cb-modal-intro {
  font-size: 13.5px;
  color: #4B5563;
  line-height: 1.55;
  margin-bottom: 18px;
}

.cb-category-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cb-category-card {
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  padding: 14px 16px;
  background: #FFFFFF;
  transition: border-color 0.15s ease;
}
.cb-category-card:hover {
  border-color: #D1D5DB;
}

.cb-category-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.cb-category-name {
  font-size: 14.5px;
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cb-badge-always-active {
  font-size: 11.5px;
  font-weight: 600;
  color: #065F46;
  background: #D1FAE5;
  padding: 3px 8px;
  border-radius: 4px;
}

.cb-category-desc {
  font-size: 13px;
  color: #6B7280;
  line-height: 1.5;
  margin: 0;
}

/* Custom Toggle Switch for Granular Consent */
.cb-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.cb-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cb-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #D1D5DB;
  transition: 0.2s;
  border-radius: 24px;
}

.cb-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.cb-switch input:checked + .cb-slider {
  background-color: var(--cb-teal);
}

.cb-switch input:focus-visible + .cb-slider {
  outline: 2px solid var(--cb-teal);
  outline-offset: 2px;
}

.cb-switch input:checked + .cb-slider:before {
  transform: translateX(20px);
}

.cb-switch input:disabled + .cb-slider {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Modal Footer */
.cb-modal-footer {
  padding: 16px 24px;
  background: #F9FAFB;
  border-top: 1px solid #E5E7EB;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.cb-btn-save {
  background: var(--cb-teal);
  color: #FFFFFF;
}
.cb-btn-save:hover {
  background: var(--cb-teal-hover);
}

.cb-btn-secondary {
  background: #FFFFFF;
  color: #374151;
  border-color: #D1D5DB;
}
.cb-btn-secondary:hover {
  background: #F3F4F6;
}

@media (max-width: 600px) {
  .cookie-banner-actions {
    width: 100%;
    flex-direction: column;
  }
  .cookie-banner-actions .cb-btn {
    width: 100%;
  }
  .cb-modal-footer {
    flex-direction: column;
  }
  .cb-modal-footer .cb-btn {
    width: 100%;
  }
}
