/* WDYG Cookie Consent – Frontend CSS
   Complete file with all fixes and improvements */

/* ---------- Theme tokens ---------- */
:root {
  --cc-bg: #ffffff;
  --cc-text: #111;
  --cc-muted: #5c5c5c;
  --cc-border: #e9ecef;
  --cc-overlay: rgba(15, 18, 20, 0.55);

  --cc-primary: #111;        /* outline button text/border */
  --cc-success: #12b76a;
  --cc-danger:  #ef4444;
  --cc-focus:   #3b82f6;

  --cc-radius-lg: 20px;
  --cc-radius-md: 14px;
  --cc-shadow: 0 20px 50px rgba(0,0,0,0.12);
  --cc-gap: 20px;
}

/* ---------- Overlay & card ---------- */
#cookieConsentPopup.cc-overlay {
  position: fixed;
  inset: 0;
  background: var(--cc-overlay);
  display: none; /* start hidden */
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 99999;

  /* allow scroll on smaller screens */
  overflow-y: auto;
}

#cookieConsentPopup[style*="display: block"] {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#cookieConsentPopup[style*="display: flex"] {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#cookieConsentPopup .cc-card {
  width: min(980px, 94vw);
  background: var(--cc-bg);
  color: var(--cc-text);
  border-radius: var(--cc-radius-lg);
  box-shadow: var(--cc-shadow);
  border: 1px solid var(--cc-border);
  padding: clamp(20px, 2.5vw, 28px);

  /* prevent it from being taller than screen */
  max-height: 90vh;
  overflow-y: auto;
}

/* ---------- Title and description ---------- */
#cookieConsentPopup .cc-title { 
  margin: 0;
}
#cookieConsentPopup .cc-desc { 
  margin-top: 10px;
}

/* ---------- Top actions ---------- */
#cookieConsentPopup .cc-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--cc-border);
}
#cookieConsentPopup .cc-actions-right { display: flex; gap: 10px; justify-self: end; }

/* ---------- Panel ---------- */
#cookieConsentPopup .cc-panel {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--cc-border);
}
#cookieConsentPopup .cc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--cc-gap);
}
#cookieConsentPopup .cc-block {
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius-md);
  padding: 18px;
  background: #fff;
}
#cookieConsentPopup .cc-block-title {
  margin: 0 0 8px;
  font-weight: 800;
  font-size: clamp(18px, 1.6vw, 22px);
}
#cookieConsentPopup .cc-block-desc {
  margin: 0 0 14px;
  color: var(--cc-muted);
  font-size: 15px;
}
#cookieConsentPopup .cc-inline { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
#cookieConsentPopup .cc-btn,
.cc-widget-button {
  all: unset; /* reset Elementor defaults */
  display: inline-block;
  border-radius: 7px;
  padding: 12px 16px;
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 1px 1px rgba(0,0,0,0.04);
  transition: transform .04s ease, box-shadow .2s ease, opacity .2s ease, background .2s ease, color .2s ease;
}
#cookieConsentPopup .cc-btn:active,
.cc-widget-button:active { 
  transform: translateY(1px); 
}
#cookieConsentPopup .cc-btn:focus-visible,
.cc-widget-button:focus-visible {
  outline: 2px solid var(--cc-focus);
  outline-offset: 2px;
}

/* Success & Danger (filled) */
#cookieConsentPopup .cc-btn-success { background: var(--cc-success); color: #fff; }
#cookieConsentPopup .cc-btn-success:hover { opacity: 0.9; }

#cookieConsentPopup .cc-btn-danger { background: var(--cc-danger); color: #fff; }
#cookieConsentPopup .cc-btn-danger:hover { opacity: 0.92; }

/* Outline (Customise & Privacy Policy) */
#cookieConsentPopup .cc-btn-outline,
.cc-widget-button { 
  background: #fff; 
  border: 2px solid var(--cc-primary); 
  color: var(--cc-primary); 
}
#cookieConsentPopup .cc-btn-outline:hover,
.cc-widget-button:hover { 
  background: var(--cc-primary); 
  color: #fff; 
}

/* ---------- Cog icon ---------- */
.cc-icon {
  position: fixed;
  right: 18px;
  bottom: 18px;
  font-size: 20px;
  line-height: 1;
  background: #fff;
  background-color: #fff !important;
  border: 1px solid var(--cc-border);
  border-radius: 999px !important;
  padding: 10px !important;
  padding-bottom: 9px !important;
  box-shadow: var(--cc-shadow);
  cursor: pointer;
  z-index: 99998; 
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;

  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cc-icon:focus-visible {
  outline: 2px solid var(--cc-focus);
  outline-offset: 2px;
}

.cc-icon:hover {
  transform: scale(1.05);
  background-color: #fff;
  box-shadow: var(--cc-shadow), 0 4px 12px rgba(0,0,0,0.15);
}

.cc-icon:active {
  transform: scale(0.98);
}

/* SVG Icon Styling */
.cc-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* SVG Icon Image Styling */
.cc-icon img {
  width: 24px;
  height: 24px;
  display: block;
  filter: invert(1) brightness(0.2); /* Makes it dark if SVG is white */
}

.cc-icon:hover img {
  filter: invert(1) brightness(0);
}

/* Font Awesome Icon Support */
.cc-icon i {
  font-size: 20px;
  line-height: 1;
  color: var(--cc-text);
}

/* Font Awesome specific sizing */
.cc-icon i.fa,
.cc-icon i.fas,
.cc-icon i.far,
.cc-icon i.fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* ---------- Widget Location Button ---------- */
.cc-widget-button-container {
  margin: 15px 0;
}

.cc-widget-button {
  display: inline-flex;
  align-items: center;
  gap: 8px; /* Space between icon and text */
  font-family: inherit;
}

.cc-widget-button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
  vertical-align: middle;
}

.cc-widget-button i {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  vertical-align: middle;
}

/* Better icon positioning in button */
.cc-widget-button i + span,
.cc-widget-button svg + span {
  margin-left: 2px;
}

.cc-widget-button span + i,
.cc-widget-button span + svg {
  margin-left: 8px;
}

/* Hide widget button when popup is visible */
#cookieConsentPopup[style*="display: flex"] ~ .cc-widget-button-container,
#cookieConsentPopup[style*="display: block"] ~ .cc-widget-button-container {
  opacity: 0.5;
  pointer-events: none;
}

/* Hide floating icon when widget button is active */
body.has-widget-button .cc-icon {
  display: none !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  #cookieConsentPopup .cc-grid { grid-template-columns: 1fr; }
  #cookieConsentPopup .cc-actions { grid-template-columns: 1fr; gap: 12px; }
  #cookieConsentPopup .cc-actions-right { justify-self: start; }
  
  .cc-icon {
    width: 40px;
    height: 40px;
    padding: 8px;
  }
  
  .cc-icon svg {
    width: 20px;
    height: 20px;
  }
  
  .cc-icon i {
    font-size: 18px;
  }
}

/* Widget button container responsive */
@media (max-width: 768px) {
  .cc-widget-button-container {
    text-align: center !important;
  }
  
  .cc-widget-button {
    width: 100%;
    max-width: 300px;
  }
}