/**
 * Hyphenet Enterprises — Enterprise Cookie Consent & DPDP Preference Manager
 * Pure Vanilla CSS (Zero Gradients, Solid Executive Palette, 100% Responsive)
 * Fully compliant with India's Digital Personal Data Protection Act, 2023
 */

/* ==========================================================================
   1. Floating Cookie Consent Banner (Bottom Docked / Floating)
   ========================================================================== */
.hyphenet-cookie-banner {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  max-width: 500px;
  width: calc(100vw - 2rem);
  background-color: #0b1528;
  color: #f8fafc;
  border: 1px solid #1e3a5f;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  padding: 1.25rem 1.4rem;
  z-index: 999990;
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-sizing: border-box;
}

.hyphenet-cookie-banner.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.cookie-banner-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.cookie-banner-icon {
  width: 22px;
  height: 22px;
  color: #3b82f6;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cookie-banner-title {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.01em;
}

.cookie-banner-text {
  font-size: 0.84rem;
  line-height: 1.55;
  color: #cbd5e1;
  margin: 0 0 1rem 0;
}

.cookie-banner-text a {
  color: #60a5fa;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
  transition: color 0.15s ease;
}

.cookie-banner-text a:hover {
  color: #93c5fd;
}

.cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.cookie-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.95rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  font-family: inherit;
  line-height: 1.2;
}

.cookie-btn-primary {
  background-color: #16a34a;
  color: #ffffff;
  border-color: #15803d;
}

.cookie-btn-primary:hover {
  background-color: #15803d;
}

.cookie-btn-outline {
  background-color: transparent;
  color: #f1f5f9;
  border-color: #334155;
}

.cookie-btn-outline:hover {
  background-color: #1e293b;
  border-color: #475569;
}

.cookie-btn-link {
  background: none;
  border: none;
  color: #94a3b8;
  padding: 0.55rem 0.5rem;
  font-size: 0.8rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.cookie-btn-link:hover {
  color: #f8fafc;
}

/* ==========================================================================
   2. Cookie Preferences Modal Backdrop & Dialog
   ========================================================================== */
.hyphenet-cookie-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(11, 21, 40, 0.75);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 999995;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.25s ease;
  box-sizing: border-box;
}

.hyphenet-cookie-modal-backdrop.active {
  display: flex;
  opacity: 1;
}

.hyphenet-cookie-modal {
  background-color: #ffffff;
  color: #0f172a;
  border-radius: 8px;
  max-width: 620px;
  width: 100%;
  max-height: calc(100vh - 2.5rem);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.15);
  border: 1px solid #cbd5e1;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  box-sizing: border-box;
}

.cookie-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid #e2e8f0;
  background-color: #f8fafc;
}

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

.cookie-modal-title {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0b1528;
  margin: 0;
}

.cookie-modal-close-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.cookie-modal-close-btn:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

.cookie-modal-body {
  padding: 1.25rem 1.4rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #334155;
  flex: 1 1 auto;
}

.cookie-modal-intro {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.85rem;
  color: #475569;
}

.cookie-category-card {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  background-color: #f8fafc;
  transition: border-color 0.2s ease;
}

.cookie-category-card:hover {
  border-color: #cbd5e1;
}

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

.cookie-category-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 0.94rem;
  color: #0b1528;
}

.cookie-badge-required {
  background-color: #e2e8f0;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cookie-category-desc {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}

/* Custom Toggle Switch (Pure CSS & Accessible) */
.cookie-toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

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

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

.cookie-toggle-switch input:checked + .cookie-toggle-slider {
  background-color: #2563eb;
}

.cookie-toggle-switch input:focus-visible + .cookie-toggle-slider {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

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

.cookie-toggle-switch input:disabled + .cookie-toggle-slider {
  background-color: #16a34a;
  cursor: not-allowed;
  opacity: 0.85;
}

.cookie-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.4rem;
  border-top: 1px solid #e2e8f0;
  background-color: #f8fafc;
  flex-wrap: wrap;
}

.cookie-modal-btn-save {
  background-color: #0b1528;
  color: #ffffff;
  border: 1px solid #0b1528;
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s ease;
}

.cookie-modal-btn-save:hover {
  background-color: #1e3a5f;
  border-color: #1e3a5f;
}

.cookie-modal-btn-accept {
  background-color: #16a34a;
  color: #ffffff;
  border: 1px solid #15803d;
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s ease;
}

.cookie-modal-btn-accept:hover {
  background-color: #15803d;
}

/* ==========================================================================
   3. Checkbox Styling for Terms & Conditions and Communication Consent
   ========================================================================== */
.consent-checkbox-group {
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.consent-checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.84rem;
  line-height: 1.45;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.consent-checkbox-item input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: #2563eb;
  cursor: pointer;
  flex-shrink: 0;
}

.consent-checkbox-label {
  cursor: pointer;
}

.consent-checkbox-label a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

.consent-checkbox-label a:hover {
  color: #1d4ed8;
}

.consent-tag-required {
  color: #dc2626;
  font-weight: 700;
  margin-left: 2px;
}

.consent-tag-optional {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 500;
}

/* ==========================================================================
   4. Mobile Adaptations (320px - 768px)
   ========================================================================== */
@media (max-width: 640px) {
  .hyphenet-cookie-banner {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100vw;
    border-radius: 12px 12px 0 0;
    padding: 1.15rem 1rem calc(1.15rem + env(safe-area-inset-bottom, 0px));
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  .cookie-banner-actions {
    flex-direction: column;
    width: 100%;
  }

  .cookie-banner-actions .cookie-btn {
    width: 100%;
  }

  .cookie-banner-actions .cookie-btn-link {
    text-align: center;
    width: 100%;
  }

  .hyphenet-cookie-modal {
    max-height: calc(100vh - 1rem);
  }

  .cookie-modal-footer {
    flex-direction: column;
  }

  .cookie-modal-footer button {
    width: 100%;
  }
}
