/**
 * MSBela – Cookie Consent / GDPR Banner – styly  v1.0.0
 *
 * Využívá Design System tokeny z main.css (:root).
 * Animace: CSS transition na transform + opacity.
 * Z-index: banner 1000, modal 1100 (nad ostatními překryvy).
 *
 * @package MSBela
 */

/* ==========================================================================
   1. Banner (spodní lišta)
   ========================================================================== */

.cookie-banner {
  position:      fixed;
  bottom:        0;
  left:          0;
  right:         0;
  z-index:       1000;
  background:    rgba(255, 255, 255, .97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top:    3px solid var(--ds-teal);
  box-shadow:    0 -4px 32px rgba(0, 0, 0, .12);
  transform:     translateY(100%);
  transition:    transform .35s cubic-bezier(.16, 1, .3, 1);
}

.cookie-banner[hidden] {
  display: none;
}

.cookie-banner.is-visible {
  transform: translateY(0);
}

.cookie-banner__inner {
  display:        flex;
  align-items:    center;
  gap:            var(--space-5);
  padding:        var(--space-4) var(--space-6);
  max-width:      var(--container-max);
  margin-inline:  auto;
  flex-wrap:      wrap;
}

@media (max-width: 680px) {
  .cookie-banner__inner {
    flex-direction: column;
    align-items:    stretch;
    padding:        var(--space-4);
  }
}

/* ── Obsah ─────────────────────────────────────────────────────── */

.cookie-banner__content {
  flex:       1;
  min-width:  0;
}

.cookie-banner__title {
  display:     flex;
  align-items: center;
  gap:         var(--space-2);
  font-family: var(--font-display);
  font-size:   1rem;
  font-weight: 400;
  color:       var(--ds-teal-dark);
  margin:      0 0 4px;
}

.cookie-banner__icon {
  font-size: 1.1rem;
}

.cookie-banner__desc {
  margin:      0;
  font-size:   0.8rem;
  color:       var(--ds-text-mid);
  line-height: 1.5;
}

.cookie-banner__gdpr-link {
  color:           var(--ds-teal-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-left:     var(--space-2);
  white-space:     nowrap;
}

.cookie-banner__gdpr-link:hover {
  color: var(--ds-teal);
}

/* ── Tlačítka ──────────────────────────────────────────────────── */

.cookie-banner__actions {
  display:     flex;
  align-items: center;
  gap:         var(--space-3);
  flex-shrink: 0;
  flex-wrap:   wrap;
}

@media (max-width: 680px) {
  .cookie-banner__actions {
    justify-content: stretch;
  }
  .cookie-banner__actions .cookie-btn {
    flex: 1;
    justify-content: center;
  }
}

/* ==========================================================================
   2. Tlačítka
   ========================================================================== */

.cookie-btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             var(--space-2);
  padding:         8px 18px;
  border-radius:   var(--radius-full);
  font-family:     var(--font-ui);
  font-size:       0.84rem;
  font-weight:     600;
  line-height:     1.4;
  white-space:     nowrap;
  cursor:          pointer;
  transition:      background .15s, color .15s, border-color .15s, box-shadow .15s;
  text-decoration: none;
  border:          2px solid transparent;
}

.cookie-btn:focus-visible {
  outline:        3px solid var(--ds-teal);
  outline-offset: 2px;
}

/* Primární */
.cookie-btn--primary {
  background:   var(--ds-teal);
  color:        #fff;
  border-color: var(--ds-teal);
}
.cookie-btn--primary:hover {
  background:   var(--ds-teal-dark);
  border-color: var(--ds-teal-dark);
}

/* Outline */
.cookie-btn--outline {
  background:   transparent;
  color:        var(--ds-teal-dark);
  border-color: var(--ds-teal-light, #A8E6DF);
}
.cookie-btn--outline:hover {
  background:   var(--ds-teal-pale, #eaf5f1);
  border-color: var(--ds-teal);
}

/* Ghost */
.cookie-btn--ghost {
  background:   transparent;
  color:        var(--ds-text-mid);
  border-color: transparent;
}
.cookie-btn--ghost:hover {
  color:        var(--ds-teal-dark);
  background:   var(--ds-teal-pale, #eaf5f1);
}

/* ==========================================================================
   3. Modal
   ========================================================================== */

.cookie-modal {
  position:  fixed;
  inset:     0;
  z-index:   1100;
  display:   flex;
  align-items: center;
  justify-content: center;
  padding:   var(--space-4);
}

.cookie-modal[hidden] {
  display: none;
}

/* Backdrop */
.cookie-modal__backdrop {
  position:   absolute;
  inset:      0;
  background: rgba(0, 0, 0, .5);
  opacity:    0;
  transition: opacity .25s;
}

.cookie-modal.is-visible .cookie-modal__backdrop {
  opacity: 1;
}

/* Box */
.cookie-modal__box {
  position:      relative;
  z-index:       1;
  background:    #fff;
  border-radius: var(--radius-lg);
  box-shadow:    0 24px 80px rgba(0, 0, 0, .18);
  width:         100%;
  max-width:     560px;
  max-height:    85vh;
  display:       flex;
  flex-direction: column;
  transform:     translateY(20px);
  opacity:       0;
  transition:    transform .3s cubic-bezier(.16, 1, .3, 1), opacity .3s;
}

.cookie-modal.is-visible .cookie-modal__box {
  transform: translateY(0);
  opacity:   1;
}

/* Header */
.cookie-modal__header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         var(--space-5) var(--space-6);
  border-bottom:   1px solid var(--ds-teal-light, #A8E6DF);
  flex-shrink:     0;
}

.cookie-modal__title {
  font-family: var(--font-display);
  font-size:   1.2rem;
  font-weight: 400;
  color:       var(--ds-teal-dark);
  margin:      0;
}

.cookie-modal__close {
  background:    transparent;
  border:        none;
  cursor:        pointer;
  color:         var(--ds-text-light);
  padding:       6px;
  border-radius: var(--radius-sm);
  display:       flex;
  align-items:   center;
  transition:    color .15s, background .15s;
}

.cookie-modal__close:hover {
  color:       var(--ds-teal-dark);
  background:  var(--ds-teal-pale, #eaf5f1);
}

.cookie-modal__close:focus-visible {
  outline:        3px solid var(--ds-teal);
  outline-offset: 2px;
}

/* Body */
.cookie-modal__body {
  padding:    var(--space-5) var(--space-6);
  overflow-y: auto;
  flex:       1;
}

.cookie-modal__intro {
  font-size:   0.875rem;
  color:       var(--ds-text-mid);
  line-height: 1.6;
  margin:      0 0 var(--space-5);
}

.cookie-modal__intro a {
  color:           var(--ds-teal-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Footer */
.cookie-modal__footer {
  display:         flex;
  gap:             var(--space-3);
  justify-content: flex-end;
  padding:         var(--space-4) var(--space-6);
  border-top:      1px solid var(--ds-teal-light, #A8E6DF);
  flex-shrink:     0;
  flex-wrap:       wrap;
}

@media (max-width: 480px) {
  .cookie-modal__footer {
    flex-direction: column;
  }
  .cookie-modal__footer .cookie-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Scroll lock */
body.cookie-modal-open {
  overflow: hidden;
}

/* ==========================================================================
   4. Kategorie cookies
   ========================================================================== */

.cookie-category {
  border:        1px solid var(--ds-teal-light, #A8E6DF);
  border-radius: var(--radius-md);
  padding:       var(--space-4) var(--space-5);
  background:    var(--ds-teal-pale, #eaf5f1);
}

.cookie-category__header {
  display:         flex;
  align-items:     flex-start;
  justify-content: space-between;
  gap:             var(--space-4);
  margin-bottom:   var(--space-3);
}

.cookie-category__info {
  display:     flex;
  align-items: center;
  gap:         var(--space-3);
  flex-wrap:   wrap;
}

.cookie-category__title {
  font-family: var(--font-ui);
  font-size:   0.9375rem;
  font-weight: 600;
  color:       var(--ds-text-dark);
  margin:      0;
}

.cookie-category__badge {
  font-size:     0.72rem;
  font-weight:   700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color:          var(--ds-teal-dark);
  background:     rgba(38, 181, 165, .15);
  border-radius:  var(--radius-full);
  padding:        2px 8px;
}

.cookie-category__desc {
  font-size:   0.8rem;
  color:       var(--ds-text-mid);
  line-height: 1.6;
  margin:      0 0 var(--space-3);
}

/* ==========================================================================
   5. Toggle (vizuální, disabled)
   ========================================================================== */

.cookie-toggle--locked {
  flex-shrink: 0;
  cursor:      not-allowed;
  opacity:     .85;
}

.cookie-toggle__track {
  width:         44px;
  height:        24px;
  border-radius: 9999px;
  position:      relative;
  transition:    background .2s;
  background:    var(--ds-neutral-200, #e0e0e0);
}

.cookie-toggle__track--on {
  background: var(--ds-teal);
}

.cookie-toggle__thumb {
  position:      absolute;
  top:           3px;
  left:          3px;
  width:         18px;
  height:        18px;
  border-radius: 50%;
  background:    #fff;
  box-shadow:    0 1px 4px rgba(0,0,0,.2);
  transition:    left .2s;
}

.cookie-toggle__track--on .cookie-toggle__thumb {
  left: calc(100% - 21px);
}

/* ==========================================================================
   6. Cookie tabulka
   ========================================================================== */

.cookie-category__details {
  margin-top: var(--space-3);
}

.cookie-category__details-toggle {
  font-size:   0.8rem;
  color:       var(--ds-teal-dark);
  cursor:      pointer;
  user-select: none;
  margin-bottom: var(--space-3);
}

.cookie-category__details-toggle:hover {
  text-decoration: underline;
}

.cookie-category__details-toggle:focus-visible {
  outline:        3px solid var(--ds-teal);
  outline-offset: 2px;
  border-radius:  2px;
}

.cookie-table-wrap {
  overflow-x: auto;
}

.cookie-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       0.78rem;
}

.cookie-table th,
.cookie-table td {
  text-align:  left;
  padding:     6px 10px;
  border:      1px solid var(--ds-teal-light, #A8E6DF);
  color:       var(--ds-text-mid);
}

.cookie-table th {
  background:  rgba(38, 181, 165, .1);
  font-weight: 600;
  color:       var(--ds-text-dark);
}

.cookie-table code {
  font-family: monospace;
  font-size:   0.85em;
  color:       var(--ds-teal-dark);
}

/* ==========================================================================
   7. Tlačítko Cookies (reopen – pravý dolní roh)
   ========================================================================== */

.cookie-reopen-btn {
  position:      fixed;
  bottom:        var(--space-4);
  right:         calc(24px + 72px + var(--space-3)); /* vpravo od .owlScrollTop (24px offset + 72px šířka + mezera) */
  z-index:       900;
  display:       inline-flex;
  align-items:   center;
  gap:           6px;
  padding:       6px 12px 6px 10px;
  background:    rgba(255, 255, 255, .92);
  backdrop-filter: blur(4px);
  border:        1px solid var(--ds-teal-light, #A8E6DF);
  border-radius: var(--radius-full);
  box-shadow:    0 2px 12px rgba(0, 0, 0, .10);
  font-size:     0.75rem;
  font-weight:   600;
  color:         var(--ds-text-mid);
  cursor:        pointer;
  transition:    opacity .2s, transform .2s, box-shadow .15s;
  opacity:       0;
  transform:     translateY(8px);
}

.cookie-reopen-btn[hidden] {
  display: none;
}

.cookie-reopen-btn.is-visible {
  opacity:   1;
  transform: translateY(0);
}

.cookie-reopen-btn:hover {
  color:       var(--ds-teal-dark);
  box-shadow:  0 4px 20px rgba(0, 0, 0, .14);
  transform:   translateY(-2px);
}

.cookie-reopen-btn:focus-visible {
  outline:        3px solid var(--ds-teal);
  outline-offset: 2px;
}

/* ==========================================================================
   8. Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .cookie-banner,
  .cookie-modal__box,
  .cookie-modal__backdrop,
  .cookie-reopen-btn,
  .cookie-btn {
    transition: none;
  }
  .cookie-banner {
    transform: none;
  }
}
