/* Daytility PDPA Cookie Consent & Access Analytics Styles */
:root {
  --pdpa-brand: #1264e8;
  --pdpa-cyan: #19c8d2;
  --pdpa-brand-dark: #0d4ec4;
  --pdpa-bg: rgba(255, 255, 255, 0.95);
  --pdpa-card: #ffffff;
  --pdpa-text: #0d2146;
  --pdpa-muted: #627798;
  --pdpa-border: #dbe7f5;
  --pdpa-border-strong: #bfd5ed;
  --pdpa-shadow: 0 16px 40px rgba(13, 33, 70, 0.16);
  --pdpa-green: #10b981;
  --pdpa-green-bg: #ecfdf5;
  --pdpa-radius: 18px;
}

html[data-theme='night'] {
  --pdpa-brand: #38bdf8;
  --pdpa-cyan: #22d3ee;
  --pdpa-brand-dark: #0284c7;
  --pdpa-bg: rgba(13, 31, 64, 0.95);
  --pdpa-card: #0d1f40;
  --pdpa-text: #eef6ff;
  --pdpa-muted: #aabbd3;
  --pdpa-border: #1d3865;
  --pdpa-border-strong: #2c4e85;
  --pdpa-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  --pdpa-green: #10b981;
  --pdpa-green-bg: #064e3b;
}

/* Floating Banner */
.pdpa-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: 24px;
  max-width: 980px;
  margin: 0 auto;
  background: var(--pdpa-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--pdpa-border);
  border-radius: var(--pdpa-radius);
  box-shadow: var(--pdpa-shadow);
  padding: 22px 26px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  font-family: inherit;
  color: var(--pdpa-text);
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.pdpa-banner.pdpa-visible {
  transform: translateY(0);
  opacity: 1;
}

.pdpa-left {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 1;
}

.pdpa-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(18, 100, 232, 0.12), rgba(25, 200, 210, 0.18));
  color: var(--pdpa-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--pdpa-border);
}

html[data-theme='night'] .pdpa-icon-box {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(34, 211, 238, 0.1));
  color: var(--pdpa-cyan);
}

.pdpa-content h4 {
  margin: 0 0 6px 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--pdpa-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdpa-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  background: var(--pdpa-green-bg);
  color: var(--pdpa-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.pdpa-content p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--pdpa-muted);
}

.pdpa-policy-link {
  color: var(--pdpa-brand);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: opacity 0.2s ease;
}

.pdpa-policy-link:hover {
  opacity: 0.8;
}

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

/* Custom Themed Buttons */
.pdpa-btn {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  font-family: inherit;
  outline: none;
}

.pdpa-btn:hover {
  transform: translateY(-1px);
}

.pdpa-btn:active {
  transform: translateY(0);
}

.pdpa-btn-primary {
  background: linear-gradient(135deg, #1264e8, #0d4ec4);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(18, 100, 232, 0.28);
}

html[data-theme='night'] .pdpa-btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.pdpa-btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 18px rgba(18, 100, 232, 0.36);
}

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

.pdpa-btn-secondary:hover {
  background: rgba(18, 100, 232, 0.06);
  border-color: var(--pdpa-brand);
}

html[data-theme='night'] .pdpa-btn-secondary:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: var(--pdpa-cyan);
}

.pdpa-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--pdpa-muted);
}

.pdpa-btn-ghost:hover {
  color: var(--pdpa-text);
  background: rgba(18, 100, 232, 0.05);
}

/* Reopen Cookie Settings Trigger Button (Floating Badge) */
.pdpa-trigger-badge {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: var(--pdpa-bg);
  border: 1px solid var(--pdpa-border);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 100px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--pdpa-text);
  cursor: pointer;
  z-index: 9998;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

.pdpa-trigger-badge:hover {
  transform: translateY(-2px);
  border-color: var(--pdpa-brand);
  color: var(--pdpa-brand);
}

.pdpa-trigger-badge svg {
  color: var(--pdpa-brand);
}

/* Custom Modal Backdrop (Rule #1: NEVER native alert/confirm/prompt) */
.pdpa-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 21, 47, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.pdpa-modal-backdrop.pdpa-modal-open {
  opacity: 1;
  visibility: visible;
}

.pdpa-modal-container {
  background: var(--pdpa-card);
  border: 1px solid var(--pdpa-border);
  border-radius: var(--pdpa-radius);
  box-shadow: var(--pdpa-shadow);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--pdpa-text);
  font-family: inherit;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pdpa-modal-backdrop.pdpa-modal-open .pdpa-modal-container {
  transform: scale(1);
}

.pdpa-modal-header {
  padding: 22px 26px;
  border-bottom: 1px solid var(--pdpa-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pdpa-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pdpa-modal-close {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--pdpa-border);
  background: transparent;
  color: var(--pdpa-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.pdpa-modal-close:hover {
  background: rgba(18, 100, 232, 0.08);
  color: var(--pdpa-text);
}

.pdpa-modal-body {
  padding: 24px 26px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  /* Rule #4: Themed custom scrollbars */
  scrollbar-width: thin;
  scrollbar-color: var(--pdpa-brand) var(--pdpa-bg);
}

.pdpa-modal-body::-webkit-scrollbar {
  width: 6px;
}

.pdpa-modal-body::-webkit-scrollbar-track {
  background: var(--pdpa-bg);
}

.pdpa-modal-body::-webkit-scrollbar-thumb {
  background: var(--pdpa-border-strong);
  border-radius: 99px;
}

.pdpa-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--pdpa-brand);
}

.pdpa-pref-item {
  border: 1px solid var(--pdpa-border);
  border-radius: 14px;
  padding: 16px 18px;
  background: rgba(18, 100, 232, 0.02);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s ease;
}

.pdpa-pref-item:hover {
  border-color: var(--pdpa-border-strong);
}

.pdpa-pref-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pdpa-pref-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdpa-pref-desc {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--pdpa-muted);
  margin: 0;
}

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

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

.pdpa-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--pdpa-border-strong);
  border-radius: 24px;
  transition: 0.25s;
}

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

input:checked + .pdpa-slider {
  background: var(--pdpa-brand);
}

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

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

.pdpa-locked-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--pdpa-muted);
  background: var(--pdpa-border);
  padding: 3px 8px;
  border-radius: 6px;
}

.pdpa-modal-footer {
  padding: 16px 26px;
  border-top: 1px solid var(--pdpa-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--pdpa-card);
}

/* Responsive adjustments */
.pdpa-banner,
.pdpa-banner *,
.pdpa-modal-backdrop,
.pdpa-modal-backdrop *,
.pdpa-trigger-badge {
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .pdpa-banner {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 14px 14px;
    border-radius: 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    max-height: 75dvh;
    overflow-y: auto;
  }

  .pdpa-left {
    gap: 10px;
  }

  .pdpa-icon-box {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .pdpa-icon-box svg {
    width: 17px;
    height: 17px;
  }

  .pdpa-content h4 {
    font-size: 13.5px;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 4px;
    line-height: 1.3;
  }

  .pdpa-tag {
    font-size: 10px;
    padding: 2px 7px;
  }

  .pdpa-content p {
    font-size: 12px;
    line-height: 1.5;
  }

  .pdpa-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .pdpa-btn {
    width: 100%;
    padding: 9px 10px;
    font-size: 12.5px;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    min-height: 40px;
  }

  #btnPdpaDecline {
    order: 1;
  }

  #btnPdpaAccept {
    order: 2;
  }

  #btnPdpaSettings {
    grid-column: 1 / -1;
    order: 3;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Compact unobtrusive corner icon button on mobile so it never blocks content */
  .pdpa-trigger-badge {
    bottom: 12px;
    left: 12px;
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    gap: 0;
    opacity: 0.9;
    box-shadow: 0 6px 18px rgba(13, 33, 70, 0.18);
  }

  .pdpa-trigger-badge span {
    display: none;
  }

  #pdpaToastArea {
    left: 14px !important;
    right: 14px !important;
    bottom: 62px !important;
    align-items: center;
  }

  .pdpa-modal-backdrop {
    padding: 12px;
  }

  .pdpa-modal-header,
  .pdpa-modal-body,
  .pdpa-modal-footer {
    padding: 14px 16px;
  }

  .pdpa-modal-header h3 {
    font-size: 15.5px;
    line-height: 1.3;
  }

  .pdpa-pref-item {
    padding: 12px 14px;
  }

  .pdpa-pref-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .pdpa-modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
  }
}
