/* Our own CookieFirst banner (see app/Views/tpl/cookies_alert_custom.php). Copied from
   ci4.ahorrarseguros.es, with the colours of this site's CookieFirst theme (styles.css of
   endesaluz.es): buttons, active tab and switches rgba(13,86,201,1), 4px button radius,
   black text and links, focus outline rgba(255,82,0,1).

   CookieFirst in stealth mode hides its own dialog by JS, with a time window in which it
   can be inserted visible in the DOM before its own "stealth" effect hides it (seen in
   yoigo/sanitas: the original banner flashed right after Accept/Reject). It is hidden by
   CSS too, which applies before any JS, so that flash can never happen. The selector is
   specific to the banner/panel dialog (not .cookiefirst-root in general, which also wraps
   the cookie table of /politica-de-cookies, which must stay visible). */
dialog[data-id="cookiefirst-root"] {
  display: none !important;
}

#cc-banner, #cc-panel {
  display: none;
  position: fixed;
  z-index: 2147483000;
  left: 0;
  right: 0;
  bottom: 0;
  /* System font instead of the site webfont: the banner (LCP element) does not wait for
     any font download nor reflows when it arrives (CLS seen in yoigo/sanitas). */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(0,0,0,1);
}
#cc-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147482999;
  background: rgba(0,0,0,0.1);
}
#cc-banner {
  background: rgba(255,255,255,1);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  padding: 20px 24px;
}
#cc-banner .cc-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 20px;
  justify-content: space-between;
}
#cc-banner h2, #cc-panel h2 {
  margin: 0 0 8px;
  font-size: 1.3em;
  font-weight: 700;
}
#cc-banner .cc-text, #cc-panel .cc-text { flex: 1 1 480px; }
#cc-banner .cc-text p, #cc-panel .cc-text p { margin: 0; }
#cc-banner a, #cc-panel a { color: inherit; text-decoration: underline; cursor: pointer; }
.cc-actions { display: flex; gap: 10px; flex-wrap: wrap; flex: 1 1 420px; }
.cc-btn:focus-visible, .cc-tab:focus-visible, .cc-switch:focus-visible, .cc-category-toggle:focus-visible {
  outline: 2px solid rgba(255,82,0,1);
  outline-offset: 2px;
}
.cc-btn {
  border: 1px solid rgba(13,86,201,1);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 400;
  padding: 6px 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s ease-in-out;
  flex: 1 1 0;
  min-width: 120px;
  text-align: center;
}
.cc-btn-primary { background: rgba(13,86,201,1); color: rgba(255,255,255,1); }
.cc-btn-primary:hover { background: rgba(0,0,0,0); color: rgba(13,86,201,1); }
.cc-btn-secondary { background: rgba(13,86,201,1); color: rgba(255,255,255,1); }
.cc-btn-secondary:hover { background: rgba(0,0,0,0); color: rgba(13,86,201,1); }
.cc-btn-full { flex: 1 1 100%; width: 100%; }

#cc-panel {
  top: 0;
  background: rgba(0,0,0,0);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#cc-panel .cc-box {
  background: rgba(255,255,255,1);
  border-radius: 4px;
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px 28px;
  position: relative;
}
#cc-panel .cc-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: rgba(0,0,0,1);
}

.cc-panel-toprow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-weight: 700;
  font-size: 1.05em;
  margin: 0 28px 12px 0;
}
.cc-panel-toprow a { font-weight: 700; font-size: 0.9em; }

.cc-tabs {
  display: flex;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 16px;
}
.cc-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 4px 10px;
  font-weight: 700;
  font-size: 0.95em;
  cursor: pointer;
  color: rgba(0,0,0,0.55);
  font-family: inherit;
}
.cc-tab.active {
  color: rgba(0,0,0,1);
  border-bottom-color: rgba(13,86,201,1);
}

#cc-panel .cc-intro { margin-bottom: 16px; }
.cc-categorias-title {
  text-align: center;
  font-weight: 700;
  font-size: 0.95em;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
  padding: 6px 0;
  margin: 0 0 12px;
}
.cc-category { border-top: 1px solid #e5e5e5; padding: 14px 0; }
.cc-category:first-child { border-top: none; }
.cc-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cc-category-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
}
.cc-category-toggle[disabled] { cursor: default; }
.cc-category-head strong { font-size: 1.05em; }
.cc-chevron {
  display: inline-block;
  font-size: 0.75em;
  transition: transform .15s ease-in-out;
}
.cc-category-toggle[aria-expanded="true"] .cc-chevron { transform: rotate(180deg); }
.cc-category-desc { margin-top: 8px; font-size: 0.95em; color: #333; }
.cc-category-desc p { margin: 0 0 8px; }
.cc-category-more { margin-top: 8px; }
.cc-category-more[hidden] { display: none; }
.cc-category-shared { margin-top: 12px; }
.cc-shared-title { font-weight: 700; font-size: 0.85em; margin: 0 0 6px; }
.cc-shared-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
}
.cc-shared-name { font-weight: 600; }
.cc-switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: #ccc;
  border: none;
  cursor: pointer;
  flex: 0 0 auto;
}
.cc-switch[aria-checked="true"] { background: rgba(13,86,201,1); }
.cc-switch[disabled] { cursor: not-allowed; opacity: .6; }
.cc-switch span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: left .15s ease-in-out;
}
.cc-switch[aria-checked="true"] span { left: 20px; }

.cc-cookie-list-note { font-size: 0.9em; color: #555; margin: 0 0 8px; }
#cc-cookies-table-mirror { overflow-x: auto; }
#cc-cookies-table-mirror table { width: 100%; border-collapse: collapse; font-size: 0.85em; }
#cc-cookies-table-mirror th, #cc-cookies-table-mirror td {
  border: 1px solid #e5e5e5;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
.cc-cookiefirst-attribution { margin-top: 16px; font-size: 0.8em; color: #777; }
.cc-cookiefirst-attribution a { color: inherit; }

#cc-panel .cc-panel-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}
#cc-panel .cc-panel-actions-row {
  display: flex;
  gap: 10px;
}
#cc-panel .cc-branding {
  margin-top: 16px;
  font-size: 11px;
  color: #777;
  text-align: center;
}
#cc-panel .cc-branding a { color: inherit; }
@media (max-width: 700px) {
  /* In a column, the flex-basis of .cc-text/.cc-actions (meant as a WIDTH in a row) would
     become a HEIGHT: both are fixed to their content. */
  #cc-banner .cc-inner { flex-direction: column; align-items: stretch; }
  #cc-banner .cc-text { flex: 0 0 auto; }
  .cc-actions { flex: 0 0 auto; justify-content: stretch; align-items: stretch; }
  .cc-btn { flex: 1 1 auto; align-self: auto; text-align: center; }
}
