/* KN Cookie Banner Styles - Unique Namespace */

/* Reset box-sizing for all elements */
#kn-cookie-banner,
#kn-cookie-banner *,
#kn-cookie-banner *::before,
#kn-cookie-banner *::after {
  box-sizing: border-box;
}

#kn-cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  background: #1a1b3d;
  color: #f8f9fa;
  padding: 20px 30px;
  z-index: 9999;
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
  animation: kn-cookie-slideUp 0.3s ease-out;
  overflow-x: hidden;
  overflow-y: visible;
}

@keyframes kn-cookie-slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.kn-cookie-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 25px;
  align-items: flex-start;
  width: 100%;
  overflow-x: hidden;
}

.kn-cookie-text {
  flex: 1;
  min-width: 300px;
  max-width: 100%;
  color: #f8f9fa !important;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

/* More specific selectors to override global styles */
#kn-cookie-banner .kn-cookie-text p,
#kn-cookie-banner .kn-cookie-text h1,
#kn-cookie-banner .kn-cookie-text h2,
#kn-cookie-banner .kn-cookie-text h3,
#kn-cookie-banner .kn-cookie-text h4,
#kn-cookie-banner .kn-cookie-text h5,
#kn-cookie-banner .kn-cookie-text h6,
#kn-cookie-banner .kn-cookie-text span,
#kn-cookie-banner .kn-cookie-text div {
  color: #f8f9fa !important;
}

.kn-cookie-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 10px 0;
  color: #f8f9fa !important;
  line-height: 1.2;
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* More specific selector to override global styles */
#kn-cookie-banner .kn-cookie-title,
#kn-cookie-banner h2.kn-cookie-title {
  color: #f8f9fa !important;
}

/* More specific selectors to override global styles */
#kn-cookie-banner .kn-cookie-text p,
#kn-cookie-banner .kn-cookie-text p * {
  margin: 0 !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
  color: #f8f9fa !important;
}

/* More specific selectors to override global styles */
#kn-cookie-banner .kn-cookie-text p strong,
#kn-cookie-banner .kn-cookie-text strong {
  font-weight: 700 !important;
  color: #f8f9fa !important;
  font-size: 13px !important;
}

/* More specific selectors to override global styles */
#kn-cookie-banner .kn-cookie-link-primary,
#kn-cookie-banner a.kn-cookie-link-primary,
.kn-cookie-text .kn-cookie-link-primary,
.kn-cookie-text p .kn-cookie-link-primary,
.kn-cookie-right-section .kn-cookie-link-primary {
  color: #28b67a !important;
  text-decoration: underline !important;
  cursor: pointer !important;
  font-size: 13px !important;
  font-weight: normal !important;
  line-height: 1.5 !important;
  display: inline !important;
}

#kn-cookie-banner .kn-cookie-link-primary:hover,
#kn-cookie-banner a.kn-cookie-link-primary:hover,
.kn-cookie-text .kn-cookie-link-primary:hover,
.kn-cookie-text p .kn-cookie-link-primary:hover,
.kn-cookie-right-section .kn-cookie-link-primary:hover {
  color: #2ee08f !important;
}

.kn-cookie-geo-info {
  font-size: 11px;
  margin-top: 8px;
  opacity: 0.8;
  color: #f8f9fa;
  font-style: italic;
}

.kn-cookie-right-section {
  flex: 1;
  min-width: 300px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #f8f9fa;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.kn-cookie-right-section h1,
.kn-cookie-right-section h2,
.kn-cookie-right-section h3,
.kn-cookie-right-section h4,
.kn-cookie-right-section h5,
.kn-cookie-right-section h6,
.kn-cookie-right-section p,
.kn-cookie-right-section span,
.kn-cookie-right-section div,
.kn-cookie-right-section ul,
.kn-cookie-right-section li {
  color: #f8f9fa;
}

.kn-cookie-partners-header {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: #f8f9fa !important;
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* More specific selector to override global styles */
#kn-cookie-banner .kn-cookie-partners-header,
#kn-cookie-banner h3.kn-cookie-partners-header {
  color: #f8f9fa !important;
}

.kn-cookie-link-secondary {
  color: #f8f9fa;
  text-decoration: underline;
  font-size: 13px;
  cursor: pointer;
}

.kn-cookie-link-secondary:hover {
  color: #e9ecef;
}

.kn-cookie-buttons {
  display: flex;
  flex-direction: row;
  gap: 10px;
  margin-top: 5px;
  width: 100%;
  max-width: 100%;
  flex-wrap: nowrap;
}

.kn-cookie-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
  width: auto;
  min-width: 0;
  max-width: 100%;
  text-align: center;
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

.kn-cookie-btn-accept {
  background: #28b67a;
  color: #ffffff;
}

.kn-cookie-btn-accept:hover {
  background: #2ee08f;
}

.kn-cookie-btn-reject {
  background: #28b67a;
  color: #ffffff;
}

.kn-cookie-btn-reject:hover {
  background: #2ee08f;
}

.kn-cookie-btn-settings {
  background: transparent !important;
  border: 1px solid #27ad7a;
  color: #ffffff !important;
}

.kn-cookie-btn-settings:hover {
  background: rgba(39, 173, 122, 0.15) !important;
  border-color: #27ad7a;
  color: #ffffff !important;
}

.kn-cookie-buttons-wrap {
  flex-shrink: 0;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Modal Styles */
#kn-cookie-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.kn-cookie-modal-content {
  background: #ffffff;
  color: #1e2139;
  border-radius: 8px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: kn-cookie-fadeIn 0.3s ease-out;
}

@keyframes kn-cookie-fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

.kn-cookie-modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #1e2139;
}

.kn-cookie-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #6c7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.kn-cookie-modal-close:hover {
  background: #f4f5f7;
  color: #1e2139;
}

.kn-cookie-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.kn-cookie-modal-body > p {
  margin: 0 0 20px 0;
  color: #6c7280;
  font-size: 14px;
  line-height: 1.6;
}

.kn-cookie-category {
  margin-bottom: 24px;
  padding: 16px;
  background: #fafbfc;
  border-radius: 6px;
  border: 1px solid #e6e8eb;
}

.kn-cookie-category-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.kn-cookie-category-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kn-cookie-category-info strong {
  font-size: 16px;
  color: #1e2139;
}

.kn-cookie-required {
  font-size: 12px;
  color: #6c7280;
  font-weight: normal;
}

.kn-cookie-category-desc {
  margin: 0;
  font-size: 13px;
  color: #6c7280;
  line-height: 1.5;
  padding-left: 48px;
}

/* Toggle Switch */
.kn-cookie-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

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

.kn-cookie-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.3s;
  border-radius: 50%;
}

.kn-cookie-toggle input:checked + .kn-cookie-slider {
  background-color: #28b67a;
}

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

.kn-cookie-toggle input:disabled + .kn-cookie-slider {
  background-color: #28b67a;
  cursor: not-allowed;
  opacity: 0.6;
}

.kn-cookie-modal-footer {
  padding: 20px;
  border-top: 1px solid #e6e8eb;
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.kn-cookie-modal-footer .kn-cookie-btn {
  min-width: 100px;
  text-transform: uppercase;
}

.kn-cookie-btn-modal-outline {
  background: transparent !important;
  border: 1px solid #27ad7a;
  color: #1f2043 !important;
}

.kn-cookie-btn-modal-outline:hover {
  background: rgba(39, 173, 122, 0.08) !important;
  border-color: #27ad7a;
  color: #1f2043 !important;
}

.kn-cookie-btn-modal-accept {
  background: #27ad7a !important;
  color: #ffffff !important;
  border: 1px solid #27ad7a;
}

.kn-cookie-btn-modal-accept:hover {
  background: #2ebb84 !important;
  color: #ffffff !important;
  border-color: #27ad7a;
}

.kn-cookie-mehr-infos {
  display: inline !important;
  margin-top: 6px;
  color: #27AD7A !important;
  font-family: "Lato-local", Sans-serif !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  text-decoration: none !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.kn-cookie-mehr-infos:hover {
  text-decoration: underline;
  color: #2ebb84;
}

/* Category Toggle Arrow */
.kn-cookie-category-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 16px;
  color: #6c7280;
  cursor: pointer;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  user-select: none;
}

.kn-cookie-category-toggle.expanded {
  transform: rotate(90deg);
}

/* Category Count Badge */
.kn-cookie-category-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: #e6e8eb;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  color: #1e2139;
  margin-left: 8px;
}

/* Category Content */
.kn-cookie-category-content {
  padding-left: 20px;
  margin-top: 12px;
}

/* Provider Styles */
.kn-cookie-providers {
  margin-top: 16px;
}

.kn-cookie-provider {
  border: 1px solid #e6e8eb;
  border-radius: 6px;
  margin-bottom: 12px;
  background: #ffffff;
  overflow: hidden;
}

.kn-cookie-provider-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.kn-cookie-provider-header:hover {
  background: #f8f9fa;
}

.kn-cookie-provider-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 14px;
  color: #6c7280;
  margin-right: 10px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.kn-cookie-provider-toggle.expanded {
  transform: rotate(90deg);
}

.kn-cookie-provider-name {
  font-size: 15px;
  font-weight: 600;
  color: #1e2139;
  flex: 1;
}

.kn-cookie-provider-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  background: #e6e8eb;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #1e2139;
}

.kn-cookie-provider-link {
  display: block;
  padding: 0 16px 12px 42px;
  font-size: 13px;
  color: #27AD7A;
  text-decoration: none;
}

.kn-cookie-provider-link:hover {
  text-decoration: underline;
  color: #2ebb84;
}

.kn-cookie-provider-content {
  padding: 0 16px 16px 42px;
  border-top: 1px solid #e6e8eb;
  background: #fafbfc;
}

.kn-cookie-provider-desc {
  margin: 16px 0;
  font-size: 13px;
  color: #6c7280;
  line-height: 1.5;
}

/* Individual Cookie Item */
.kn-cookie-item {
  border: 1px solid #e6e8eb;
  border-left: 3px solid #27AD7A;
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #ffffff;
}

.kn-cookie-item:last-child {
  margin-bottom: 0;
}

.kn-cookie-item-name {
  font-size: 14px;
  font-weight: 700;
  color: #1e2139;
  margin-bottom: 6px;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
}

.kn-cookie-item-desc {
  margin: 0 0 12px 0;
  font-size: 13px;
  color: #6c7280;
  line-height: 1.5;
}

.kn-cookie-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: #6c7280;
}

.kn-cookie-item-meta span {
  display: inline-block;
}

.kn-cookie-item-meta strong {
  color: #1e2139;
  font-weight: 600;
}

/* Make category header clickable */
.kn-cookie-category-header {
  cursor: pointer;
}

.kn-cookie-category-header:hover {
  opacity: 0.9;
}

.kn-cookie-btn-primary {
  background: #28b67a;
  color: #ffffff;
}

.kn-cookie-btn-primary:hover {
  background: #2ee08f;
}

.kn-cookie-btn-secondary {
  background: #1e2139;
  color: #ffffff;
}

.kn-cookie-btn-secondary:hover {
  background: #2a2d4a;
}

/* Responsive Design - Tablet */
@media (max-width: 1024px) and (min-width: 769px) {
  #kn-cookie-banner {
    padding: 18px 20px;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  .kn-cookie-content {
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .kn-cookie-title {
    font-size: 20px;
  }

  .kn-cookie-text {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
  }

  .kn-cookie-text p {
    font-size: 12px !important;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
  }

  .kn-cookie-right-section,
  .kn-cookie-buttons-wrap {
    width: 100%;
    max-width: 100%;
    align-self: stretch;
    align-items: stretch;
  }

  .kn-cookie-buttons {
    width: 100%;
    max-width: 100%;
    flex-direction: row;
    gap: 10px;
    overflow-x: hidden;
  }

  .kn-cookie-btn {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
  #kn-cookie-banner {
    padding: 12px 15px;
    max-height: none;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3);
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    left: 0;
    right: 0;
  }

  .kn-cookie-content {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
  }

  /* Hide full text on mobile, show only summary */
  .kn-cookie-text {
    display: none !important;
  }

  .kn-cookie-text-mobile {
    display: block !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
    color: #f8f9fa !important;
    margin: 0 0 10px 0;
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
  }

  .kn-cookie-text-mobile p {
    margin: 0 !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
    color: #f8f9fa !important;
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
  }

  /* Hide title on mobile */
  .kn-cookie-title {
    display: none !important;
  }

  .kn-cookie-partners-header {
    display: none !important;
  }

  .kn-cookie-right-section,
  .kn-cookie-buttons-wrap {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    gap: 8px;
    overflow-x: hidden;
    align-self: stretch;
    align-items: stretch;
  }

  .kn-cookie-buttons {
    width: 100%;
    max-width: 100%;
    flex-direction: row;
    gap: 8px;
    margin-top: 0;
    overflow-x: hidden;
    flex-wrap: nowrap;
  }

  .kn-cookie-btn {
    flex: 1 1 auto;
    padding: 10px 8px;
    font-size: 12px;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .kn-cookie-link-secondary,
  .kn-cookie-link-primary {
    font-size: 11px !important;
    margin-top: 6px;
    display: block;
    text-align: center;
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
  }

  .kn-cookie-category-desc {
    padding-left: 0;
    margin-top: 8px;
  }

  .kn-cookie-modal-content {
    margin: 10px;
    max-height: calc(100vh - 20px);
  }

  .kn-cookie-modal-footer {
    flex-direction: column;
  }

  .kn-cookie-modal-footer .kn-cookie-btn {
    width: 100%;
  }

  /* Hide geo info on mobile */
  .kn-cookie-geo-info {
    display: none !important;
  }

  /* Cookie Declaration Mobile Styles */
  .kn-cookie-category-content {
    padding-left: 0;
  }

  .kn-cookie-provider-content {
    padding: 0 12px 12px 12px;
  }

  .kn-cookie-provider-link {
    padding: 0 12px 10px 12px;
  }

  .kn-cookie-item-meta {
    flex-direction: column;
    gap: 6px;
  }

  .kn-cookie-provider-header {
    padding: 12px;
  }

  .kn-cookie-item {
    padding: 12px;
  }
}

/* Show mobile-specific elements only on mobile */
.kn-cookie-text-mobile {
  display: none;
}

/* Ensure mobile summary links are styled correctly */
.kn-cookie-text-mobile .kn-cookie-link-primary {
  color: #28b67a !important;
  text-decoration: underline !important;
  font-size: 12px !important;
}

/* Prevent horizontal overflow on body when banner is visible */
body.kn-cookie-banner-active {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Additional overflow protection for very small screens */
@media (max-width: 480px) {
  #kn-cookie-banner {
    padding: 10px 12px;
  }

  .kn-cookie-btn {
    padding: 10px 6px;
    font-size: 11px;
  }

  .kn-cookie-text-mobile {
    font-size: 11px !important;
  }

  .kn-cookie-text-mobile p {
    font-size: 11px !important;
  }
}
