/**
 * Cookie consent — styling.
 *
 * Modelled on how large sites do it (reference: point.md, running the
 * CookieConsent v3 library): a small card in a bottom corner, small type,
 * full-width buttons stacked vertically, and a separate centred window for the
 * settings screen. Dimming and locking the page are switched on in the module
 * settings.
 *
 * SAFE TO CHANGE: colours (the variables below are set in the module settings),
 * the corner, paddings, radii, the font.
 *
 * NOT SAFE TO CHANGE: "Accept" and "Decline" share the class .cc-btn-main and
 * one appearance. Making one of them stand out is a dark pattern — consent
 * stops being freely given (art. 7(4) Law 195/2024, MD). The reference does the
 * same, by the way: both decision buttons in one colour, the third one secondary.
 */

:root {
  --cc-btn-bg: #1a1a1a;
  --cc-btn-hover: #000000;
  --cc-btn-text: #ffffff;
}

/* Scroll lock, used when the page is dimmed */
html.cc-lock,
html.cc-lock body {
  overflow: hidden !important;
}

.cc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(0, 0, 0, .55);
}

/* ------------------------------------------------- card in a screen corner */

.cc-panel {
  position: fixed;
  z-index: 99999;
  box-sizing: border-box;
  background: #fff;
  color: #0f172a;
  border-radius: 12px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .22);
  font-size: 14px;
  line-height: 1.3;
}

.cc-panel * {
  box-sizing: border-box;
}

/* The card itself is focused when it appears, but it is not a control:
   showing a focus ring on it would look like an error message. Buttons keep
   their own visible focus. */
.cc-panel:focus {
  outline: none;
}

.cc-corner {
  bottom: 16px;
  width: 384px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 18px 20px 20px;
}

.cc-corner-left  { left: 16px; }
.cc-corner-right { right: 16px; }

/* --------------------------------------------- centred settings window */

.cc-modal {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 640px;
  max-width: calc(100vw - 32px);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.cc-modal .cc-title {
  padding: 18px 20px 10px;
  margin: 0;
}

.cc-modal .cc-list {
  flex: 1 1 auto;
  overflow-y: auto;
  margin: 0;
  padding: 0 20px;
}

.cc-modal .cc-actions {
  padding: 14px 20px 18px;
  border-top: 1px solid #ececec;
}

/* ------------------------------------------------------------------ text */

.cc-title {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 700;
}

.cc-text {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.3;
}

.cc-text a {
  color: inherit;
  text-decoration: underline;
}

/* --------------------------------------------------------------- buttons */

.cc-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cc-btn {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  min-height: 40px;
  padding: 9px 14px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: background-color .15s, border-color .15s;
}

/* Both decision buttons look identical. */
.cc-btn-main {
  background: var(--cc-btn-bg);
  border-color: var(--cc-btn-bg);
  color: var(--cc-btn-text);
}

.cc-btn-main:hover {
  background: var(--cc-btn-hover);
  border-color: var(--cc-btn-hover);
}

/* Not a decision: opens the choice, or stores what was chosen. */
.cc-btn-link {
  background: #f5f5f5;
  border-color: #f5f5f5;
  color: #0f172a;
}

.cc-btn-link:hover {
  background: #ebebeb;
  border-color: #ebebeb;
}

.cc-btn:focus-visible {
  outline: 2px solid var(--cc-btn-bg);
  outline-offset: 2px;
}

/* ---------------------------------------------------------- categories */

.cc-list {
  margin: 0 0 14px;
}

.cc-item {
  padding: 12px 0;
  border-top: 1px solid #ececec;
}

.cc-item:first-child {
  border-top: 0;
  padding-top: 4px;
}

.cc-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

.cc-item-head input {
  width: 17px;
  height: 17px;
  flex: none;
  accent-color: var(--cc-btn-bg);
}

.cc-item-head input:disabled {
  cursor: not-allowed;
}

.cc-item-desc {
  margin: 4px 0 0 27px;
  font-size: 13px;
  line-height: 1.35;
  color: #64748b;
}

/* Withdrawal link in the footer: inherits the styling of nearby site links */
.cc-settings-link {
  color: inherit;
  font: inherit;
}

/* Placeholder shown instead of embedded content until consent is given */
.cc-frame-holder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 140px;
  padding: 16px;
  text-align: center;
  background: #f4f4f4;
  border: 1px dashed #c4c4c4;
  border-radius: 8px;
}

.cc-frame-holder p {
  margin: 0;
  font-size: 13px;
  color: #444;
}

.cc-frame-holder .cc-btn {
  width: auto;
  min-width: 160px;
}

/* ------------------------------------------------------------- mobile */

@media (max-width: 600px) {
  .cc-corner {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    max-height: 72vh;
    padding: 14px 16px 16px;
    border-radius: 12px 12px 0 0;
  }

  .cc-modal {
    top: auto;
    bottom: 0;
    left: 0;
    transform: none;
    width: auto;
    max-width: none;
    max-height: 86vh;
    border-radius: 12px 12px 0 0;
  }

  .cc-title { font-size: 15px; }
  .cc-text  { font-size: 13px; }
  .cc-item-head { font-size: 14px; }
  .cc-item-desc { font-size: 12.5px; }
}

@media (prefers-color-scheme: dark) {
  .cc-panel {
    background: #1c1c1c;
    color: #f0f0f0;
  }
  .cc-item,
  .cc-modal .cc-actions { border-color: #333; }
  .cc-item-desc { color: #a9b2bf; }
  .cc-btn-link {
    background: #2c2c2c;
    border-color: #2c2c2c;
    color: #f0f0f0;
  }
  .cc-btn-link:hover { background: #383838; border-color: #383838; }
  .cc-frame-holder { background: #262626; border-color: #555; }
  .cc-frame-holder p { color: #ccc; }
}
