/**
 * Cyfendo Privacy Consent Banner & Cookie Management System
 * Engineered for Google Consent Mode v2 (Basic Mode)
 * Aesthetic: Cyber-Glassmorphism, High Contrast, Fully Accessible
 */

/* =========================================================================
   1. Bottom Floating Consent Banner
   ========================================================================= */
.consent-banner-wrapper {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99990;
  padding: 1rem 1.25rem 1.25rem;
  pointer-events: none;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.consent-banner-wrapper.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.consent-banner-wrapper.hidden {
  display: none !important;
}

.consent-banner-card {
  max-width: 1200px;
  margin: 0 auto;
  background: rgba(10, 14, 28, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 14px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.75),
              0 0 25px rgba(99, 102, 241, 0.2);
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.75rem;
}

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

.consent-banner-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.consent-shield-icon {
  width: 18px;
  height: 18px;
  color: #00F0FF;
  flex-shrink: 0;
}

.consent-banner-title {
  font-family: var(--font-heading, 'Lexend', sans-serif);
  font-size: 1rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
  margin: 0;
}

.consent-banner-desc {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary, #94A3B8);
  margin: 0;
}

.consent-banner-desc a {
  color: var(--accent-indigo-light, #818CF8);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.consent-banner-desc a:hover {
  color: #FFFFFF;
}

.consent-banner-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  flex-shrink: 0;
  min-width: 230px;
}

.consent-btn {
  padding: 0.6rem 1.15rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  border: 1px solid transparent;
  font-family: inherit;
}

.consent-btn:focus-visible {
  outline: 2px solid #00F0FF;
  outline-offset: 2px;
}

.consent-btn-primary {
  background: linear-gradient(135deg, #4F46E5 0%, #6366F1 50%, #818CF8 100%);
  color: #FFFFFF;
  padding: 0.72rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 9px;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.45), 0 0 12px rgba(129, 140, 248, 0.25);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.consent-btn-primary:hover {
  background: linear-gradient(135deg, #4338CA 0%, #4F46E5 50%, #6366F1 100%);
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.65), 0 0 16px rgba(129, 140, 248, 0.4);
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.consent-sub-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding-top: 0.1rem;
}

.consent-action-divider {
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.75rem;
  line-height: 1;
}

.consent-btn-link {
  background: transparent;
  border: none;
  color: var(--text-secondary, #94A3B8);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(148, 163, 184, 0.4);
}

.consent-btn-link:hover {
  color: #FFFFFF;
  text-decoration-color: #FFFFFF;
}

.consent-btn-link:focus-visible {
  outline: 2px solid #00F0FF;
  outline-offset: 2px;
}

.consent-btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: #E2E8F0;
}

.consent-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.consent-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary, #94A3B8);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0.6rem 0.75rem;
}

.consent-btn-ghost:hover {
  color: #FFFFFF;
}

/* =========================================================================
   2. Cookie Settings Dialog Modal (<dialog>)
   ========================================================================= */
.cookie-modal-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  padding: 0;
  border: none;
  background: transparent;
  max-width: 620px;
  width: calc(100% - 2rem);
  max-height: calc(100vh - 2rem);
  z-index: 100000;
  overflow: visible;
}

.cookie-modal-dialog::backdrop {
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.cookie-modal-card {
  background: rgba(13, 18, 36, 0.98);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9),
              0 0 35px rgba(99, 102, 241, 0.25);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

.cookie-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.35rem 1.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cookie-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cookie-modal-title {
  font-family: var(--font-heading, 'Lexend', sans-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: #FFFFFF;
  margin: 0;
}

.cookie-modal-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #94A3B8;
  font-size: 1.5rem;
  line-height: 1;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cookie-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.3);
}

.cookie-modal-body {
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.cookie-modal-intro {
  font-size: 0.875rem;
  color: var(--text-secondary, #94A3B8);
  line-height: 1.55;
  margin: 0;
}

/* Category Cards */
.cookie-category-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  transition: border-color 0.2s ease;
}

.cookie-category-item:hover {
  border-color: rgba(99, 102, 241, 0.3);
}

.cookie-category-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.cookie-category-name {
  font-family: var(--font-heading, 'Lexend', sans-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: #FFFFFF;
  white-space: nowrap;
}

.cookie-badge-always-active {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-emerald-light, #34D399);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.cookie-category-desc {
  font-size: 0.825rem;
  line-height: 1.5;
  color: var(--text-secondary, #94A3B8);
  margin: 0;
}

/* Toggle Switch */
.consent-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

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

.consent-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 24px;
}

.consent-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #94A3B8;
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
}

.consent-switch input:checked + .consent-slider {
  background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
  border-color: #818CF8;
}

.consent-switch input:focus-visible + .consent-slider {
  outline: 2px solid #00F0FF;
  outline-offset: 2px;
}

.consent-switch input:checked + .consent-slider:before {
  transform: translateX(20px);
  background-color: #FFFFFF;
}

/* Modal Footer */
.cookie-modal-footer {
  padding: 1.25rem 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: rgba(10, 14, 28, 0.5);
}

/* =========================================================================
   3. Mobile Responsive Adaptations
   ========================================================================= */
@media (max-width: 768px) {
  .consent-banner-wrapper {
    padding: 0.75rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0.75rem));
    padding-left: max(0.75rem, env(safe-area-inset-left, 0.75rem));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0.75rem));
  }

  .consent-banner-card {
    flex-direction: column;
    align-items: stretch;
    padding: 1.15rem;
    gap: 1.15rem;
  }

  .consent-banner-actions {
    flex-direction: column;
    width: 100%;
    gap: 0.65rem;
    min-width: 0;
  }

  .consent-banner-actions .consent-btn-primary {
    width: 100%;
    min-height: 48px;
    font-size: 0.95rem;
  }

  .consent-sub-actions {
    justify-content: center;
    gap: 1rem;
    padding-top: 0.25rem;
  }

  .consent-btn-link {
    font-size: 0.85rem;
    padding: 0.4rem 0.5rem;
  }

  .cookie-modal-dialog {
    width: calc(100% - 1.25rem);
    max-height: calc(100vh - 1.5rem);
  }

  .cookie-modal-card {
    max-height: 85vh;
  }

  .cookie-modal-header {
    padding: 1rem 1.25rem;
  }

  .cookie-modal-title {
    font-size: 1.15rem;
    white-space: nowrap;
  }

  .cookie-modal-body {
    padding: 1rem 1.25rem;
    gap: 0.85rem;
  }

  .cookie-category-item {
    padding: 0.85rem 1rem;
  }

  .cookie-category-top {
    gap: 0.5rem;
  }

  .cookie-category-name {
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .cookie-badge-always-active {
    font-size: 0.72rem;
    padding: 0.2rem 0.55rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .cookie-modal-footer {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem 1.25rem;
    gap: 0.6rem;
  }

  .cookie-modal-footer .consent-btn {
    width: 100%;
    min-height: 44px;
    white-space: nowrap;
  }
}
