/* ============================================
   Cookie Banner — Sonar Speech
   ============================================ */

   #cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    box-sizing: border-box;
    background: rgba(20, 20, 30, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  
  #cookie-banner.show {
    transform: translateY(0);
  }
  
  .cookie-banner-inner {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 24px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }
  
  /* === Шапка === */
  .cookie-banner-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
  }
  
  .cookie-banner-text {
    color: var(--sonar-text-muted);
    font-size: 14px;
    line-height: 1.55;
    margin: 0;
    flex: 1 1 320px;
    min-width: 0;
    font-family: var(--sonar-font-sans);
  }
  
  .cookie-banner-text a {
    color: var(--sonar-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.25s ease;
  }
  
  .cookie-banner-text a:hover {
    color: var(--sonar-brand-2);
  }
  
  .cookie-banner-actions {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
    flex-wrap: wrap;
  }
  
  /* === Кнопки (общее) === */
  .cookie-btn {
    padding: 11px 22px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    white-space: nowrap;
    font-family: var(--sonar-font-sans);
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1;
  }
  
  .cookie-btn:active {
    transform: translateY(0);
  }
  
  /* Primary — фирменный градиент */
  .cookie-btn--primary {
    background: linear-gradient(135deg, var(--sonar-brand) 0%, var(--sonar-brand-2) 100%);
    color: var(--sonar-text-on-brand);
    box-shadow: 0 4px 12px var(--sonar-brand-glow);
  }
  
  .cookie-btn--primary:hover {
    box-shadow: 0 6px 18px var(--sonar-brand-glow);
    transform: translateY(-2px);
  }
  
  /* Ghost — для "Настроить" */
  .cookie-btn--ghost {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.16);
  }
  
  .cookie-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
    transform: translateY(-2px);
  }
  
  /* Шестерёнка */
  .cookie-gear-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform 0.4s ease;
  }
  
  #customize-cookies[aria-expanded="true"] .cookie-gear-icon {
    transform: rotate(90deg);
  }
  
  /* === Панель настроек (плавное раскрытие через grid) === */
  .cookie-settings {
    display: grid;
    grid-template-rows: 0fr;
    margin-top: 0;
    padding-top: 0;
    border-top: 1px solid rgba(255, 255, 255, 0);
    overflow: hidden;
    transition:
      grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      margin-top 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      padding-top 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      border-top-color 0.3s ease;
  }
  
  .cookie-settings.is-open {
    grid-template-rows: 1fr;
    margin-top: 18px;
    padding-top: 18px;
    border-top-color: rgba(255, 255, 255, 0.08);
  }
  
  .cookie-settings-wrap {
    min-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition:
      opacity 0.3s ease 0.05s,
      transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .cookie-settings.is-open .cookie-settings-wrap {
    opacity: 1;
    transform: translateY(0);
  }
  
  .cookie-settings-inner {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 20px 22px;
  }
  
  .cookie-settings-title {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 6px;
    font-family: var(--sonar-font-sans);
  }
  
  .cookie-settings-subtitle {
    color: var(--sonar-text-muted);
    font-size: 12.5px;
    line-height: 1.5;
    margin: 0 0 16px;
    font-family: var(--sonar-font-sans);
  }
  
  .cookie-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  
  .cookie-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  
  .cookie-option:last-child {
    border-bottom: none;
  }
  
  .cookie-option-text {
    flex: 1 1 auto;
    min-width: 0;
  }
  
  .cookie-option-title {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px;
    font-family: var(--sonar-font-sans);
  }
  
  .cookie-option-desc {
    color: var(--sonar-text-muted);
    font-size: 12.5px;
    line-height: 1.5;
    margin: 0;
    font-family: var(--sonar-font-sans);
  }
  
  /* === Переключатель === */
  .cookie-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
  }
  
  .cookie-toggle input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 2;
  }
  
  .cookie-toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    transition: background 0.25s ease, border-color 0.25s ease;
  }
  
  .cookie-toggle-slider::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
  
  .cookie-toggle input:checked + .cookie-toggle-slider {
    background: linear-gradient(135deg, var(--sonar-brand) 0%, var(--sonar-brand-2) 100%);
    border-color: transparent;
  }
  
  .cookie-toggle input:checked + .cookie-toggle-slider::before {
    transform: translateX(20px);
  }
  
  .cookie-toggle input:focus-visible + .cookie-toggle-slider {
    outline: 2px solid var(--sonar-brand);
    outline-offset: 2px;
  }
  
  .cookie-toggle--disabled {
    cursor: not-allowed;
    opacity: 0.85;
  }
  
  .cookie-toggle--disabled input {
    cursor: not-allowed;
  }
  
  /* === Кнопка сохранения === */
  .cookie-settings-buttons {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
  }
  
  /* ============================================
     Адаптив
     ============================================ */
  
  /* Планшеты */
  @media (max-width: 991px) {
    .cookie-banner-inner {
      padding: 18px 18px;
      padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    }
  
    .cookie-banner-head {
      gap: 14px;
    }
  
    .cookie-banner-text {
      flex: 1 1 100%;
      font-size: 13px;
    }
  
    .cookie-banner-actions {
      width: 100%;
      justify-content: stretch;
    }
  
    .cookie-banner-actions .cookie-btn {
      flex: 1 1 calc(50% - 5px);
    }
  
    .cookie-settings-inner {
      padding: 18px;
    }
  }
  
  /* Мобильные */
  @media (max-width: 560px) {
    .cookie-banner-inner {
      padding: 16px 14px;
      padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
  
    .cookie-banner-actions {
      flex-direction: column;
      gap: 8px;
    }
  
    .cookie-banner-actions .cookie-btn {
      width: 100%;
      flex: 1 1 auto;
      padding: 12px 18px;
    }
  
    .cookie-option {
      gap: 14px;
      padding: 12px 0;
    }
  
    .cookie-option-title {
      font-size: 13.5px;
    }
  
    .cookie-option-desc {
      font-size: 12px;
    }
  
    .cookie-settings-buttons {
      justify-content: stretch;
    }
  
    .cookie-settings-buttons .cookie-btn {
      width: 100%;
    }
  }
  
  /* Очень узкие экраны */
  @media (max-width: 359px) {
    .cookie-banner-inner {
      padding: 14px 12px;
      padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }
  
    .cookie-banner-text {
      font-size: 12px;
    }
  
    .cookie-btn {
      font-size: 13px;
      padding: 11px 14px;
    }
  }