/* ==========================================================================
   Confermax Advanced Cookie Permission & Consent Management
   GDPR, HK PDPO, CCPA & Google Consent Mode v2 Compliant
   ========================================================================== */

/* Root Variables */
:root {
  --cm-cookie-pine: #1a3628;
  --cm-cookie-pine-dark: #11241a;
  --cm-cookie-pine-light: #254d39;
  --cm-cookie-accent: #2d8a5b;
  --cm-cookie-bg: #ffffff;
  --cm-cookie-text: #1f2937;
  --cm-cookie-muted: #6b7280;
  --cm-cookie-border: #e5e7eb;
  --cm-cookie-radius: 14px;
}

/* Floating Banner */
.cm-cookie-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: 440px;
  width: calc(100% - 48px);
  background: var(--cm-cookie-bg);
  color: var(--cm-cookie-text);
  border-radius: var(--cm-cookie-radius);
  box-shadow: 0 20px 45px -10px rgba(17, 36, 26, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.06);
  padding: 24px;
  z-index: 99999;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  opacity: 1;
  transform: translateY(0);
}

.cm-cookie-banner.cm-hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  visibility: hidden;
}

.cm-cookie-banner-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.cm-cookie-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(45, 138, 91, 0.12);
  color: var(--cm-cookie-pine);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cm-cookie-icon-badge svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.cm-cookie-banner-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--cm-cookie-pine-dark);
  margin: 0;
  line-height: 1.3;
}

.cm-cookie-banner-body {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--cm-cookie-muted);
  margin-bottom: 18px;
}

.cm-cookie-banner-body a {
  color: var(--cm-cookie-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cm-cookie-banner-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cm-cookie-btn-group-primary {
  display: flex;
  gap: 8px;
}

.cm-cookie-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
}

.cm-cookie-btn-primary {
  background: var(--cm-cookie-pine);
  color: #ffffff;
  border-color: var(--cm-cookie-pine);
}

.cm-cookie-btn-primary:hover {
  background: var(--cm-cookie-pine-light);
  border-color: var(--cm-cookie-pine-light);
  transform: translateY(-1px);
}

.cm-cookie-btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}

.cm-cookie-btn-secondary:hover {
  background: #e5e7eb;
  color: #1f2937;
}

.cm-cookie-btn-outline {
  background: transparent;
  color: var(--cm-cookie-muted);
  font-weight: 500;
  font-size: 12.5px;
  padding: 6px 12px;
  border: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.cm-cookie-btn-outline:hover {
  color: var(--cm-cookie-pine);
}

/* Persistent Settings Trigger */
.cm-cookie-trigger {
  position: fixed;
  bottom: 22px;
  left: 22px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--cm-cookie-pine);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99990;
  transition: all 0.25s ease;
}

.cm-cookie-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  background: #f9fafb;
}

.cm-cookie-trigger svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Modal Overlay & Dialog */
.cm-cookie-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 18, 0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.cm-cookie-modal-backdrop.cm-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.cm-cookie-modal {
  background: #ffffff;
  color: var(--cm-cookie-text);
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  animation: cmModalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cmModalIn {
  from {
    transform: scale(0.96) translateY(8px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

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

.cm-cookie-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--cm-cookie-pine-dark);
  margin: 0;
}

.cm-cookie-modal-close {
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s ease;
}

.cm-cookie-modal-close:hover {
  color: #111827;
}

.cm-cookie-modal-body {
  padding: 24px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cm-cookie-modal-intro {
  color: var(--cm-cookie-muted);
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0 0 8px 0;
}

.cm-cookie-category-card {
  border: 1px solid var(--cm-cookie-border);
  border-radius: 12px;
  padding: 16px;
  background: #ffffff;
  transition: border-color 0.2s ease;
}

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

.cm-cookie-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cm-cookie-category-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cm-cookie-category-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--cm-cookie-pine-dark);
  margin: 0;
}

.cm-cookie-badge-locked {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cm-cookie-accent);
  background: rgba(45, 138, 91, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

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

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

.cm-cookie-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #d1d5db;
  transition: 0.25s;
  border-radius: 24px;
}

.cm-cookie-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.2);
}

.cm-cookie-switch input:checked + .cm-cookie-slider {
  background-color: var(--cm-cookie-pine);
}

.cm-cookie-switch input:focus + .cm-cookie-slider {
  box-shadow: 0 0 1px var(--cm-cookie-pine);
}

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

.cm-cookie-switch input:disabled + .cm-cookie-slider {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Modal Footer */
.cm-cookie-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--cm-cookie-border);
  background: #fafbfb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-sizing: border-box;
}

.cm-cookie-modal-footer-btns {
  display: flex;
  gap: 10px;
  align-items: center;
}

.cm-cookie-modal-footer .cm-cookie-btn {
  height: 42px;
  min-height: 42px;
  line-height: 42px;
  padding: 0 20px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex: 0 0 auto;
  box-sizing: border-box;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .cm-cookie-banner {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 20px 18px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
  }

  .cm-cookie-trigger {
    bottom: 16px;
    left: 16px;
  }

  .cm-cookie-modal {
    max-height: 90vh;
  }

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

  .cm-cookie-modal-footer .cm-cookie-btn,
  .cm-cookie-modal-footer-btns {
    width: 100%;
    flex-direction: column;
  }
}
