
/* =========================================================
   CMJ TRANSPORT & LOGISTICS
   ANALYTICS CONSENT - STYLESHEET
   Version: 1.0
   File: css/analytics-consent.css

   Features:
   - Cookie consent banner
   - Privacy preferences dialog
   - Privacy settings button
   - Responsive layout
   - Accessible focus states
   - CMJ brand styling
========================================================= */


/* =========================================================
   01. DESIGN VARIABLES
========================================================= */

:root {
  --cmj-consent-navy: #102640;
  --cmj-consent-blue: #0874e8;
  --cmj-consent-blue-hover: #075fc0;

  --cmj-consent-text: #263b54;
  --cmj-consent-muted: #687c92;

  --cmj-consent-white: #ffffff;
  --cmj-consent-background: #f4f8fc;
  --cmj-consent-border: #dce6f0;

  --cmj-consent-shadow:
    0 12px 45px rgba(13, 35, 60, 0.14);

  --cmj-consent-radius: 14px;
}


/* =========================================================
   02. COOKIE BANNER
========================================================= */

.cmj-consent-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);

  width: calc(100% - 40px);
  max-width: 1120px;

  background: var(--cmj-consent-white);
  border: 1px solid var(--cmj-consent-border);
  border-radius: var(--cmj-consent-radius);

  box-shadow: var(--cmj-consent-shadow);

  padding: 24px 28px;

  z-index: 10000;

  font-family: inherit;
  color: var(--cmj-consent-text);
}

.cmj-consent-banner[hidden] {
  display: none !important;
}

.cmj-consent-content {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 32px;
}

.cmj-consent-text {
  flex: 1;
  min-width: 0;
}

.cmj-consent-text h2 {
  margin: 0 0 8px;

  font-size: 19px;
  line-height: 1.3;
  font-weight: 750;

  color: var(--cmj-consent-navy);
}

.cmj-consent-text p {
  margin: 0;

  font-size: 13px;
  line-height: 1.75;

  color: var(--cmj-consent-muted);
  max-width: 660px;
}


/* =========================================================
   03. BANNER BUTTONS
========================================================= */

.cmj-consent-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;

  flex-wrap: wrap;
  gap: 10px;

  flex-shrink: 0;
}

.cmj-consent-button {
  appearance: none;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 42px;

  padding: 11px 19px;

  border: 1px solid transparent;
  border-radius: 8px;

  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;

  cursor: pointer;

  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.cmj-consent-button:hover {
  transform: translateY(-1px);
}

.cmj-consent-button:active {
  transform: translateY(0);
}

.cmj-consent-button:focus-visible {
  outline: 3px solid rgba(8, 116, 232, 0.35);
  outline-offset: 3px;
}


/* =========================================================
   04. ACCEPT BUTTON
========================================================= */

.cmj-consent-accept {
  background: var(--cmj-consent-blue);
  color: #ffffff;

  border-color: var(--cmj-consent-blue);
}

.cmj-consent-accept:hover {
  background: var(--cmj-consent-blue-hover);
  border-color: var(--cmj-consent-blue-hover);
  color: #ffffff;
}


/* =========================================================
   05. REJECT BUTTON
========================================================= */

.cmj-consent-reject {
  background: #ffffff;
  color: var(--cmj-consent-navy);

  border-color: var(--cmj-consent-border);
}

.cmj-consent-reject:hover {
  background: #f1f5fa;
  border-color: #b8c9db;
  color: var(--cmj-consent-navy);
}


/* =========================================================
   06. SETTINGS BUTTON
========================================================= */

.cmj-consent-settings {
  background: var(--cmj-consent-background);
  color: var(--cmj-consent-navy);

  border-color: var(--cmj-consent-border);
}

.cmj-consent-settings:hover {
  background: #e7f0fa;
  border-color: #b9d4f1;
  color: var(--cmj-consent-navy);
}


/* =========================================================
   07. PRIVACY DIALOG
========================================================= */

.cmj-consent-dialog {
  position: fixed;

  width: calc(100% - 32px);
  max-width: 560px;

  max-height: min(85vh, 760px);

  margin: auto;
  padding: 0;

  overflow-y: auto;

  background: var(--cmj-consent-white);

  border: 1px solid var(--cmj-consent-border);
  border-radius: 16px;

  box-shadow:
    0 24px 80px rgba(9, 29, 52, 0.25);

  color: var(--cmj-consent-text);

  font-family: inherit;
}

.cmj-consent-dialog:not([open]) {
  display: none;
}

.cmj-consent-dialog::backdrop {
  background: rgba(6, 22, 42, 0.65);
  backdrop-filter: blur(3px);
}

.cmj-consent-dialog-panel {
  padding: 32px;
}

.cmj-consent-dialog-panel > h2 {
  margin: 0 0 12px;

  font-size: 25px;
  font-weight: 750;
  line-height: 1.25;

  color: var(--cmj-consent-navy);
}

.cmj-consent-dialog-panel > p {
  margin: 0 0 24px;

  font-size: 14px;
  line-height: 1.7;

  color: var(--cmj-consent-muted);
}


/* =========================================================
   08. CONSENT CATEGORIES
========================================================= */

.cmj-consent-category {
  display: block;

  position: relative;

  margin-bottom: 14px;
  padding: 20px;

  background: var(--cmj-consent-background);

  border: 1px solid var(--cmj-consent-border);
  border-radius: 10px;
}

.cmj-consent-category strong {
  display: block;

  margin-bottom: 8px;

  font-size: 14px;
  font-weight: 750;

  color: var(--cmj-consent-navy);
}

.cmj-consent-category p {
  margin: 0;

  font-size: 13px;
  line-height: 1.65;

  color: var(--cmj-consent-muted);
}

.cmj-consent-category input[type="checkbox"] {
  appearance: auto;

  width: 19px;
  height: 19px;

  margin-top: 14px;

  accent-color: var(--cmj-consent-blue);

  cursor: pointer;
}

.cmj-consent-category:has(input:checked) {
  border-color: #94c5fa;
  background: #f0f7ff;
}


/* =========================================================
   09. DIALOG ACTIONS
========================================================= */

.cmj-consent-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;

  gap: 12px;

  margin-top: 24px;
  padding-top: 20px;

  border-top: 1px solid var(--cmj-consent-border);
}

.cmj-consent-dialog-actions .cmj-consent-button {
  flex: 1;
}


/* =========================================================
   10. PRIVACY SETTINGS BUTTON
========================================================= */

.cmj-privacy-settings-button {
  position: fixed;

  left: 18px;
  bottom: 18px;

  z-index: 9990;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 9px 14px;

  background: var(--cmj-consent-white);
  color: var(--cmj-consent-navy);

  border: 1px solid var(--cmj-consent-border);
  border-radius: 999px;

  box-shadow:
    0 4px 18px rgba(10, 30, 55, 0.12);

  font-family: inherit;
  font-size: 11px;
  font-weight: 700;

  cursor: pointer;

  transition:
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.cmj-privacy-settings-button:hover {
  background: var(--cmj-consent-background);

  box-shadow:
    0 6px 24px rgba(10, 30, 55, 0.18);
}

.cmj-privacy-settings-button:focus-visible {
  outline: 3px solid rgba(8, 116, 232, 0.35);
  outline-offset: 3px;
}


/* =========================================================
   11. TABLET
========================================================= */

@media (max-width: 900px) {

  .cmj-consent-banner {
    padding: 22px;
  }

  .cmj-consent-content {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .cmj-consent-actions {
    justify-content: flex-start;
  }

  .cmj-consent-text p {
    max-width: none;
  }

}


/* =========================================================
   12. MOBILE
========================================================= */

@media (max-width: 600px) {

  .cmj-consent-banner {
    width: calc(100% - 20px);

    bottom: 10px;

    padding: 20px 18px;

    border-radius: 12px;

    max-height: calc(100dvh - 20px);
    overflow-y: auto;
  }

  .cmj-consent-text h2 {
    font-size: 17px;
  }

  .cmj-consent-text p {
    font-size: 12px;
    line-height: 1.65;
  }

  .cmj-consent-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;

    width: 100%;
    gap: 9px;
  }

  .cmj-consent-actions .cmj-consent-button {
    width: 100%;
    min-width: 0;
    padding: 11px 12px;
  }

  .cmj-consent-actions .cmj-consent-accept {
    grid-column: 1 / -1;
  }

  .cmj-consent-dialog {
    width: calc(100% - 20px);
    max-height: 90dvh;
  }

  .cmj-consent-dialog-panel {
    padding: 24px 18px;
  }

  .cmj-consent-dialog-panel > h2 {
    font-size: 21px;
  }

  .cmj-consent-category {
    padding: 16px;
  }

  .cmj-consent-dialog-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .cmj-consent-dialog-actions .cmj-consent-button {
    width: 100%;
    flex: auto;
  }

  .cmj-privacy-settings-button {
    left: 10px;
    bottom: 10px;

    font-size: 10px;
    padding: 8px 11px;
  }

}


/* =========================================================
   13. REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

  .cmj-consent-button,
  .cmj-privacy-settings-button {
    transition: none;
  }

  .cmj-consent-button:hover {
    transform: none;
  }

}


/* =========================================================
   END OF ANALYTICS CONSENT STYLESHEET
========================================================= */
