/**
 * VoiceDash Cookie Consent Notice Styles
 * Vanilla in-house banner (desktop bottom bar / phone bottom sheet) and preference panel.
 * Layout follows the Solventum "Use of Cookies" bar; colors use the VoiceDash palette
 * (coral #FF6B6B accent, warm dark #1C1917 surface, cream #FFFCF9 text).
 * specs/022-cookie-notice/contracts/notice-ui-contract.md
 */

/* ── Brand tokens ────────────────────────────────────────────────────────── */

:root {
  --vd-consent-surface: #1c1917;
  --vd-consent-surface-raised: #292524;
  --vd-consent-surface-muted: #1a1614;
  --vd-consent-border: #44403c;
  --vd-consent-text: #fffcf9;
  --vd-consent-text-muted: #d6d3d1;
  --vd-consent-accent: #ff6b6b;
  --vd-consent-accent-hover: #ff8a8a;
  --vd-consent-on-accent: #1c1917;
  --vd-consent-focus: #fffcf9;
}

/* ── First-Layer Notice Bar / Bottom Sheet ───────────────────────────────── */

.vd-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999990;
  background-color: var(--vd-consent-surface);
  color: var(--vd-consent-text);
  border-top: 1px solid var(--vd-consent-border);
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.22);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  box-sizing: border-box;
}

.vd-consent-banner *,
.vd-consent-banner *::before,
.vd-consent-banner *::after,
.vd-consent-modal-overlay *,
.vd-consent-modal-overlay *::before,
.vd-consent-modal-overlay *::after {
  box-sizing: border-box;
}

.vd-consent-banner-content {
  width: 100%;
  margin: 0;
  padding: 10px 28px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.vd-consent-text {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 52rem;
}

.vd-consent-title {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--vd-consent-text);
}

.vd-consent-text p {
  margin: 0;
  font-size: 12.5px;
  color: var(--vd-consent-text-muted);
}

.vd-consent-link {
  color: var(--vd-consent-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

.vd-consent-link:hover,
.vd-consent-link:focus {
  color: var(--vd-consent-accent-hover);
}

.vd-consent-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 14px;
}

.vd-consent-btn-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Customize: text link with a sliders icon */
.vd-consent-manage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 4px 2px;
  margin: 0;
  min-height: 28px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--vd-consent-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.vd-consent-manage svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  stroke: currentColor;
}

.vd-consent-manage:hover,
.vd-consent-manage:focus-visible {
  color: var(--vd-consent-accent-hover);
}

/* ── Buttons (compact, visible focus) ─ */

.vd-consent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 0;
  padding: 3px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--vd-consent-accent);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  text-align: center;
  line-height: 1.3;
  white-space: nowrap;
}

.vd-consent-btn:focus-visible,
.vd-consent-manage:focus-visible {
  outline: 2px solid var(--vd-consent-focus);
  outline-offset: 2px;
}

.vd-consent-btn-primary {
  background-color: var(--vd-consent-accent);
  color: var(--vd-consent-on-accent);
  border-color: var(--vd-consent-accent);
}

.vd-consent-btn-primary:hover {
  background-color: var(--vd-consent-accent-hover);
  border-color: var(--vd-consent-accent-hover);
}

.vd-consent-btn-secondary {
  background-color: transparent;
  color: var(--vd-consent-text);
  border-color: var(--vd-consent-border);
}

.vd-consent-btn-secondary:hover {
  background-color: var(--vd-consent-surface-raised);
  border-color: var(--vd-consent-text-muted);
  color: var(--vd-consent-text);
}

/* ── Second-Layer Preference Modal (Manage Preferences) ──────────────────── */

.vd-consent-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999995;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.vd-consent-modal-container {
  background-color: var(--vd-consent-surface);
  color: var(--vd-consent-text);
  border: 1px solid var(--vd-consent-border);
  border-radius: 12px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

.vd-consent-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--vd-consent-border);
}

.vd-consent-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--vd-consent-text);
}

.vd-consent-close-btn {
  background: none;
  border: none;
  color: var(--vd-consent-text-muted);
  font-size: 28px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
}

.vd-consent-close-btn:hover,
.vd-consent-close-btn:focus-visible {
  color: var(--vd-consent-text);
  outline: 2px solid var(--vd-consent-focus);
}

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

.vd-consent-modal-intro {
  margin: 0 0 20px;
  color: var(--vd-consent-text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.vd-consent-category-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vd-consent-category-item {
  background-color: var(--vd-consent-surface-muted);
  border: 1px solid var(--vd-consent-border);
  border-radius: 8px;
  padding: 16px;
}

.vd-consent-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.vd-consent-category-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--vd-consent-text);
}

.vd-consent-category-badge {
  font-size: 12px;
  font-weight: 600;
  color: #10b981;
  background-color: rgba(16, 185, 129, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
}

.vd-consent-category-desc {
  margin: 0;
  font-size: 13px;
  color: #a8a29e;
  line-height: 1.4;
}

.vd-consent-toggle-label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vd-consent-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--vd-consent-accent);
  cursor: pointer;
}

.vd-consent-checkbox:focus-visible {
  outline: 2px solid var(--vd-consent-focus);
  outline-offset: 2px;
}

.vd-consent-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--vd-consent-border);
  background-color: var(--vd-consent-surface-raised);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  flex-wrap: wrap;
}

/* ── Responsive Mobile (Phone bottom sheet) ───────────────────────────────── */

@media (max-width: 900px) {
  .vd-consent-banner-content {
    padding: 10px 16px 12px;
    gap: 14px;
  }
}

@media (max-width: 640px) {
  .vd-consent-banner {
    max-height: 85vh;
    overflow-y: auto;
  }

  .vd-consent-banner-content {
    padding: 12px 14px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .vd-consent-title {
    font-size: 13px;
  }

  .vd-consent-actions {
    align-items: stretch;
    justify-content: stretch;
    gap: 8px;
  }

  .vd-consent-btn-row {
    flex-direction: row;
    gap: 8px;
  }

  .vd-consent-btn {
    flex: 1 1 0;
    width: auto;
    min-height: 32px;
  }

  .vd-consent-manage {
    align-self: center;
  }

  .vd-consent-modal-container {
    max-height: 95vh;
    border-radius: 12px;
  }

  .vd-consent-modal-actions {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 10px;
  }
}
