/* Backdrop — blocca interazione col sito finché non si sceglie */
.cookie-banner-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 27, 42, 0.55);
  backdrop-filter: blur(3px);
  z-index: 99998;
  pointer-events: auto;
}

body.hwn-cookie-banner-open {
  overflow: hidden !important;
  touch-action: none;
}

body.hwn-cookie-banner-open #cookie-banner-backdrop,
body.hwn-cookie-banner-open #cookie-banner {
  pointer-events: auto;
}

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background-color: #fff;
  color: #333;
  padding: 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  transform: translateY(110%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 16px 16px 0 0;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

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

.cookie-content {
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Vista compatta */
.cookie-compact-view {
  padding: 20px 24px 12px;
}

.cookie-compact-header h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0d1b2a;
}

.cookie-compact-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #555;
}

.cookie-compact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.cookie-compact-links a {
  font-size: 13px;
  color: #0073aa;
  text-decoration: none;
  font-weight: 500;
}

.cookie-compact-links a:hover {
  text-decoration: underline;
}

.cookie-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: #0073aa;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.cookie-expand-btn:hover {
  color: #005a87;
}

.cookie-expand-btn[aria-expanded="true"] .cookie-expand-icon {
  transform: rotate(180deg);
}

.cookie-expand-icon {
  display: inline-block;
  transition: transform 0.2s ease;
}

/* Pannello espanso preferenze */
.cookie-expanded-panel {
  border-top: 1px solid #e8e8e8;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cookie-expanded-panel:not(.hidden) {
  max-height: min(52vh, 480px);
}

.cookie-expanded-panel .cookie-tab-content {
  overflow-y: auto;
  flex: 1 1 auto;
  padding: 12px 20px 16px;
  -webkit-overflow-scrolling: touch;
}

.cookie-expanded-panel .cookie-tabs {
  flex-shrink: 0;
}

.cookie-category-collapsed .cookie-category-details {
  display: none;
}

.cookie-category:not(.cookie-category-collapsed) .cookie-category-chevron {
  transform: rotate(90deg);
}

.cookie-category-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  flex: 1;
  min-width: 0;
}

.cookie-category-chevron {
  color: #888;
  font-size: 12px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.cookie-category {
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  background: #fafbfc;
}

.cookie-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.cookie-category-details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #ececec;
}

.cookie-category-details .cookie-category-desc {
  margin: 0 0 8px;
}

/* Tab Navigation */
.cookie-tabs {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
  background: #f8f9fa;
  border-radius: 0;
}

.cookie-tab {
  flex: 1;
  padding: 15px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
}

.cookie-tab.active {
  color: #0073aa;
  border-bottom-color: #0073aa;
  background: #fff;
}

.cookie-tab:hover {
  color: #0073aa;
  background: #f0f8ff;
}

/* Tab Content — pannello principale usa regole in .cookie-expanded-panel */
.cookie-tab-content {
  padding: 0;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.cookie-banner-header h3 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 18px;
  font-weight: 600;
}

.cookie-banner-body p {
  margin: 0 0 20px 0;
  line-height: 1.6;
  color: #666;
  font-size: 14px;
}

/* Cookie Categories */
.cookie-categories {
  margin-top: 0;
}

.cookie-category {
  margin-bottom: 10px;
}

.cookie-category-name {
  font-weight: 600;
  color: #333;
  font-size: 16px;
}

.cookie-category-desc {
  margin: 0;
  color: #666;
  font-size: 13px;
  line-height: 1.4;
}

/* Toggle Switch */
.cookie-toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.cookie-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.cookie-toggle input:checked + .toggle-slider {
  background-color: #0073aa;
}

.cookie-toggle input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

.cookie-toggle.disabled .toggle-slider {
  background-color: #e0e0e0;
  cursor: not-allowed;
}

.cookie-toggle.disabled .toggle-slider:before {
  background-color: #f5f5f5;
}

/* Cookie Details */
.cookie-details {
  margin-top: 20px;
}

.cookie-detail-item {
  margin-bottom: 25px;
  padding: 15px;
  border-left: 4px solid #0073aa;
  background: #f8f9fa;
}

.cookie-detail-item h4 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 16px;
}

.cookie-detail-item p {
  margin: 0;
  color: #666;
  line-height: 1.5;
  font-size: 14px;
}

.hwn-banner-cookie-details .hwn-banner-cookie-count {
  font-size: 13px;
  font-weight: 500;
  color: #0073aa;
}

.hwn-banner-cookie-list {
  margin: 10px 0 0 18px;
  padding: 0;
}

.hwn-banner-cookie-list li {
  margin-bottom: 10px;
  color: #555;
  font-size: 13px;
  line-height: 1.45;
}

.hwn-banner-cookie-chip {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  background: #eef6fb;
  color: #0b5ed7;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
}

.hwn-banner-cookie-vendor {
  font-weight: 600;
  color: #333;
}

.hwn-banner-cookie-purpose,
.hwn-banner-cookie-duration {
  display: block;
  margin-top: 3px;
  color: #777;
  font-size: 12px;
}

.hwn-banner-consent-cookies {
  margin-top: 8px;
}

.hwn-banner-consent-cookie-list {
  margin-top: 8px;
  max-height: 120px;
  overflow-y: auto;
  padding-right: 4px;
}

.hwn-banner-category-empty {
  margin: 8px 0 0;
  padding: 8px 10px;
  background: #f8f9fa;
  border: 1px dashed #d0d7de;
  border-radius: 6px;
  color: #666;
  font-size: 12px;
  line-height: 1.45;
}

.hwn-banner-cookie-more {
  font-size: 11px;
  color: #888;
  font-style: italic;
}

/* Cookie Info */
.cookie-info h4 {
  margin: 20px 0 10px 0;
  color: #333;
  font-size: 16px;
}

.cookie-info p {
  margin: 0 0 15px 0;
  color: #666;
  line-height: 1.5;
  font-size: 14px;
}

.cookie-info .cookie-links {
  margin-top: 20px;
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.cookie-info .cookie-links a {
  color: #0073aa;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 12px;
  border: 1px solid #0073aa;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.cookie-info .cookie-links a:hover {
  background: #0073aa;
  color: white;
}

/* Footer Buttons */
.cookie-banner-footer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 14px 20px 18px;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.cookie-banner-footer button {
  padding: 11px 18px;
  font-size: 13px;
  border-radius: 8px;
  min-width: 0;
  flex: 1 1 140px;
  max-width: 240px;
}

.cookie-content > p {
  margin: 0 0 20px 0;
  font-size: 15px;
  line-height: 1.5;
}

.cookie-actions {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: center;
}

.cookie-actions button {
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: #0073aa;
  color: white;
  font-weight: 600;
  min-width: 120px;
}

.btn-primary:hover {
  background-color: #005a87;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 115, 170, 0.3);
}

.btn-deny {
  background-color: #dc3545;
  color: white;
  font-weight: 600;
  min-width: 120px;
}

.btn-deny:hover {
  background-color: #c82333;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.btn-secondary {
  background-color: transparent;
  color: #0073aa;
  border: 2px solid #0073aa;
  font-weight: 600;
  min-width: 120px;
}

.btn-secondary:hover {
  background-color: #0073aa;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 115, 170, 0.3);
}

.cookie-logo {
  display: inline-block;
  margin-bottom: 10px;
}

.cookie-logo img {
  display: block;
  max-height: 50px;
  height: auto;
  margin: 0 auto;
}

.preferences-panel {
  margin-top: 20px;
  padding: 20px;
  background-color: #f5f5f5;
  border-radius: 8px;
}

.preferences-panel h4 {
  margin: 0 0 15px 0;
  font-size: 18px;
  color: #333;
}

.preferences-panel label {
  display: flex;
  align-items: center;
  margin: 10px 0;
  font-size: 15px;
  cursor: pointer;
}

.preferences-panel input[type="checkbox"] {
  margin-right: 10px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.btn-save {
  margin-top: 15px;
  padding: 10px 20px;
  background-color: #0073aa;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn-save:hover {
  background-color: #005a87;
}

.hidden {
  display: none !important;
}

/* Widget Styles */
.cookie-widget {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9998;
}

.cookie-settings-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #0073aa;
  color: white;
  border: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.cookie-settings-btn:hover {
  background-color: #005a87;
  transform: scale(1.05);
}

/* Modal Styles */
.cookie-settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.cookie-settings-content {
  background-color: white;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.cookie-settings-header {
  padding: 20px;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cookie-settings-header h3 {
  margin: 0;
  font-size: 20px;
  color: #333;
}

.close-btn {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: #333;
}

.cookie-settings-body {
  padding: 20px;
}

.cookie-category {
  margin-bottom: 25px;
  padding-bottom: 25px;
  border-bottom: 1px solid #e5e5e5;
}

.cookie-category:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.cookie-switch {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-bottom: 10px;
}

.cookie-switch input[type="checkbox"] {
  display: none;
}

.cookie-switch .slider {
  width: 44px;
  height: 24px;
  background-color: #ccc;
  border-radius: 24px;
  position: relative;
  transition: background-color 0.3s;
  margin-right: 12px;
}

.cookie-switch .slider:before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: white;
  top: 3px;
  left: 3px;
  transition: transform 0.3s;
}

.cookie-switch input:checked + .slider {
  background-color: #0073aa;
}

.cookie-switch input:checked + .slider:before {
  transform: translateX(20px);
}

.cookie-switch input:disabled + .slider {
  opacity: 0.6;
  cursor: not-allowed;
}

.cookie-switch .label {
  font-size: 16px;
  font-weight: 500;
  color: #333;
}

.cookie-description {
  margin: 0;
  font-size: 14px;
  color: #666;
  line-height: 1.5;
  padding-left: 56px;
}

.cookie-settings-footer {
  padding: 20px;
  border-top: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.cookie-settings-footer button {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-withdraw {
  background-color: #dc3545;
  color: white;
}

.btn-withdraw:hover {
  background-color: #c82333;
}

.btn-cancel {
  background-color: #e5e5e5;
  color: #333;
}

.btn-cancel:hover {
  background-color: #d5d5d5;
}

.btn-save-widget {
  background-color: #0073aa;
  color: white;
}

.btn-save-widget:hover {
  background-color: #005a87;
}

.btn-primary, .btn-secondary, .btn-save {
  margin-right: 10px;
  margin-top: 10px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.3s ease;
}

/* Stili per le descrizioni nel pannello preferenze */
.cookie-option {
  margin-bottom: 20px;
}

.cookie-option label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 500;
}

.cookie-option input[type="checkbox"] {
  margin-right: 10px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.cookie-name {
  font-size: 16px;
  color: #333;
}

.cookie-desc {
  margin: 5px 0 0 28px;
  font-size: 14px;
  color: #666;
  line-height: 1.4;
}

/* Footer con link */
.cookie-footer {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #e5e5e5;
}

.cookie-links {
  text-align: center;
}

.cookie-links a {
  color: #0073aa;
  text-decoration: none;
  font-size: 14px;
  margin: 0 10px;
  transition: color 0.3s ease;
}

.cookie-links a:hover {
  color: #005a87;
  text-decoration: underline;
}

@media (max-width: 768px) {
  .cookie-banner {
    border-radius: 14px 14px 0 0;
    max-height: 96vh;
  }

  .cookie-compact-view {
    padding: 16px 16px 10px;
  }

  .cookie-expanded-panel:not(.hidden) {
    max-height: min(48vh, 360px);
  }

  .cookie-banner-footer {
    flex-direction: column;
    padding: 12px 16px 16px;
  }

  .cookie-banner-footer button {
    width: 100%;
    max-width: none;
    flex: 1 1 auto;
  }
  
  .cookie-banner {
    padding: 0;
  }
  
  .cookie-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .cookie-actions button {
    width: 100%;
    margin: 5px 0;
  }
  
  .btn-primary, .btn-secondary, .btn-save {
    display: block;
    width: 100%;
    max-width: 200px;
    margin: 5px auto;
  }
  
  .cookie-widget {
    bottom: 10px;
    left: 10px;
  }
  
  .cookie-settings-btn {
    width: 45px;
    height: 45px;
  }
  
  .cookie-settings-footer {
    flex-direction: column;
  }
  
  .cookie-settings-footer button {
    width: 100%;
  }
  
  .cookie-links a {
    display: block;
    margin: 5px 0;
  }
}