/**
 * BuildSpace360 — Privacy-First Basic Analytics Consent Styles
 * Phase 1F-B2: Accessible, responsive, mobile-first design tokens.
 */

:root {
  --hf-consent-bg: #FFFFFF;
  --hf-consent-text: #263238;
  --hf-consent-muted: #546E7A;
  --hf-consent-primary: #FF5722;
  --hf-consent-primary-dark: #E64A19;
  --hf-consent-border: #E0E0E0;
  --hf-consent-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   1. Bottom Consent Banner
   ========================================================================== */
.hf-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  background: var(--hf-consent-bg);
  border-top: 1px solid var(--hf-consent-border);
  box-shadow: var(--hf-consent-shadow);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--hf-consent-text);
  animation: hfSlideUp 0.25s ease-out forwards;
}

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

.hf-consent-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.hf-consent-content {
  flex: 1;
  min-width: 280px;
}

.hf-consent-title {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--hf-consent-text);
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hf-consent-title .shield-icon {
  font-size: 16px;
  color: var(--hf-consent-primary);
}

.hf-consent-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--hf-consent-muted);
  margin: 0;
}

.hf-consent-desc a {
  color: var(--hf-consent-primary);
  text-decoration: underline;
  font-weight: 500;
}

.hf-consent-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.hf-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  line-height: 1.4;
  white-space: nowrap;
}

.hf-btn:focus-visible {
  outline: 2px solid var(--hf-consent-primary);
  outline-offset: 2px;
}

.hf-btn-primary {
  background: var(--hf-consent-primary);
  color: #FFFFFF;
}

.hf-btn-primary:hover {
  background: var(--hf-consent-primary-dark);
}

.hf-btn-secondary {
  background: #ECEFF1;
  color: var(--hf-consent-text);
  border-color: #CFD8DC;
}

.hf-btn-secondary:hover {
  background: #CFD8DC;
}

.hf-btn-link {
  background: transparent;
  color: var(--hf-consent-muted);
  text-decoration: underline;
  padding: 9px 12px;
}

.hf-btn-link:hover {
  color: var(--hf-consent-text);
}

/* ==========================================================================
   2. Privacy Preferences Modal
   ========================================================================== */
.hf-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: hfFadeIn 0.2s ease-out;
}

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

.hf-modal-card {
  background: #FFFFFF;
  border-radius: 12px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  font-family: 'Inter', sans-serif;
  overflow: hidden;
}

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

.hf-modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--hf-consent-text);
  margin: 0;
}

.hf-modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--hf-consent-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.hf-modal-close:hover {
  color: var(--hf-consent-text);
  background: #ECEFF1;
}

.hf-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  font-size: 14px;
  color: var(--hf-consent-text);
}

.hf-pref-group {
  border: 1px solid var(--hf-consent-border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
  background: #FAFAFA;
}

.hf-pref-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.hf-pref-group-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--hf-consent-text);
  margin: 0;
}

.hf-pref-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #E8F5E9;
  color: #2E7D32;
  padding: 3px 8px;
  border-radius: 4px;
}

.hf-pref-desc {
  font-size: 12px;
  color: var(--hf-consent-muted);
  line-height: 1.5;
  margin: 0;
}

/* Accessible Toggle Switch */
.hf-toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

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

.hf-toggle-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);
}

.hf-toggle-switch input:checked + .hf-toggle-slider {
  background-color: var(--hf-consent-primary);
}

.hf-toggle-switch input:focus-visible + .hf-toggle-slider {
  outline: 2px solid var(--hf-consent-primary);
  outline-offset: 2px;
}

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

.hf-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--hf-consent-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #FFFFFF;
}

/* ==========================================================================
   3. Floating Privacy & Cookie Button & Footer Link
   ========================================================================== */
.hf-floating-privacy-btn {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 9999;
  background: #FFFFFF;
  border: 1px solid var(--hf-consent-border);
  color: var(--hf-consent-muted);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
  font-family: inherit;
}

.hf-floating-privacy-btn:hover {
  color: var(--hf-consent-text);
  border-color: var(--hf-consent-primary);
  background: #FFF7ED;
}

.hf-floating-privacy-btn:focus-visible {
  outline: 2px solid var(--hf-consent-primary);
  outline-offset: 2px;
}

.hf-cookie-settings-link {
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

.hf-cookie-settings-link:hover {
  color: var(--hf-consent-primary);
}

/* ==========================================================================
   4. Mobile Responsiveness
   ========================================================================== */
@media (max-width: 768px) {
  .hf-consent-container {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 16px;
  }
  .hf-consent-actions {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }
  .hf-consent-actions .hf-btn {
    width: 100%;
    text-align: center;
    padding: 12px;
  }
  .hf-modal-footer {
    flex-direction: column;
    gap: 8px;
  }
  .hf-modal-footer .hf-btn {
    width: 100%;
    text-align: center;
  }
}

