/**
 * Coffee Cookie Consent Styles
 */

/* Modal Container */
#coffee-cookie-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 20px;
  color-scheme: light;
}

#coffee-cookie-modal.visible {
  display: flex;
  animation: fadeIn 0.3s ease-out;
}

/* Obtrusive Modal (Default) */
#coffee-cookie-modal:not([data-modal-style]),
#coffee-cookie-modal[data-modal-style="obtrusive"] {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: none;
}

#coffee-cookie-modal[data-modal-style="obtrusive"].visible {
  display: flex;
}

/* Prominent Modal Style */
#coffee-cookie-modal[data-modal-style="prominent"] {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  top: auto;
  width: 100%;
  height: auto;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  overflow-y: auto;
  max-height: 90vh;
}

body.coffee-show-banner-prominent #coffee-cookie-modal[data-modal-style="prominent"] {
  display: flex !important;
  z-index: 9999;
}

#coffee-cookie-modal[data-modal-style="prominent"].visible {
  display: flex !important;
  z-index: 9999;
}

#coffee-cookie-modal[data-modal-style="prominent"] .coffee-modal-content {
  background: var(--cookie-background-color, #ffffff);
  width: 100% !important;
  max-width: 100% !important;
  border-radius: 0 !important;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
  /* padding: 40px; */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  border-width: 1px 0 0 0;
}

#coffee-cookie-modal[data-modal-style="prominent"] .coffee-modal-content > h2 {
  width: 100%;
  margin: 0 0 20px 0;
}

#coffee-cookie-modal[data-modal-style="prominent"] .coffee-content-row {
  display: flex;
  flex-direction: row;
  gap: 20px;
  width: 100%;
  align-items: end;
}

#coffee-cookie-modal[data-modal-style="prominent"] .coffee-content-left {
  flex: 1;
}

#coffee-cookie-modal[data-modal-style="prominent"] .coffee-content-right {
  flex-shrink: 0;
}

#coffee-cookie-modal[data-modal-style="prominent"] .coffee-modal-actions {
  display: flex;
  flex-direction: row;
  gap: 12px;
  margin: 0;
  padding: 0;
  justify-content: flex-end;
}

#coffee-cookie-modal[data-modal-style="prominent"] .coffee-modal-actions .coffee-btn {
  white-space: nowrap;
  width: auto;
}

#coffee-cookie-modal[data-modal-style="prominent"] .coffee-modal-view {
  display: block;
  width: 100%;
}

#coffee-cookie-modal[data-modal-style="prominent"] #coffee-initial-view {
  width: 100%;
}

/* Subtle Modal Style */
#coffee-cookie-modal[data-modal-style="subtle"] {
  display: none !important;
}

#coffee-cookie-modal[data-modal-style="subtle"].visible {
  display: flex !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(0, 0, 0, 0.7) !important;
  backdrop-filter: blur(5px) !important;
  -webkit-backdrop-filter: blur(5px) !important;
}

/* Show circle for subtle mode */
body:has(#coffee-cookie-modal[data-modal-style="subtle"]) .coffee-settings-circle {
  display: flex !important;
}

/* Modal Views */
.coffee-modal-view {
  display: none;
}

/* Initial Modal View */
#coffee-initial-view {
  display: block;
}

#coffee-expanded-view {
  display: none;
}

.coffee-modal-content {
  background: var(--cookie-background-color, #ffffff);
  border-radius: var(--cookie-modal-border-radius, 12px);
  padding: 20px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  color-scheme: light;
  color: var(--cookie-text-color, #000000);
  position: relative;
  border: 1px solid color-mix(in oklab, black 10%, var(--cookie-background-color, #ffffff) 100%);
}

.coffee-modal-content h2 {
  margin: 0 0 15px 0;
  font-size: 1.8em;
  font-weight: 700;
  color: var(--cookie-text-color, #000000);
}

.coffee-modal-content p {
  margin: 12px 0;
  line-height: 1.6;
  color: var(--cookie-text-color, #000000);
  font-size: 0.95em;

  &:first-of-type {
    margin-top: 0;
  }

  &:last-of-type {
    margin-bottom: 0;
  }
}

.coffee-modal-content a {
  color: var(--cookie-link-color, #0066cc);
  text-decoration: none;
  font-weight: 500;
}

.coffee-modal-content a:hover {
  text-decoration: underline;
}

/* Expanded Content Modal */
.coffee-expanded-content {
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  color-scheme: light;
  color: var(--cookie-text-color, #000000);
}

.coffee-expanded-content h2 {
  margin-bottom: 20px;
}

/* Action Buttons */
.coffee-modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 25px;
  flex-wrap: wrap;
}

.coffee-expanded-actions {
  margin-top: 30px;
  gap: 15px;
}

.coffee-btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--cookie-button-border-radius, 6px);
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.coffee-btn:hover {
  /* transform: translateY(-2px); */
  /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); */
}

.coffee-btn:active {
  transform: translateY(0);
}

.coffee-btn-primary {
  background: var(--cookie-primary-color, #2d7984);
  color: var(--cookie-contrast-color, #ffffff);
  flex: 1;
  min-width: 140px;
}

.coffee-btn-primary:hover {
  background: color-mix(in oklab, black 20%, var(--cookie-primary-color, #2d7984) 100%);
}

.coffee-btn-secondary {
  background: transparent;
  color: var(--cookie-text-color, #0066cc);
  border: 2px solid var(--cookie-text-color, #0066cc);
  flex: 1;
  min-width: 140px;
}

.coffee-btn-secondary:hover {
  background: color-mix(in oklab, black 5%, var(--cookie-background-color, #ffffff) 100%);
}

.coffee-btn-withdraw {
  background: #e74c3c;
  color: white;
  padding: 10px 20px;
}

.coffee-btn-withdraw:hover {
  background: #c0392b;
}

/* Close Button */
.coffee-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 32px;
  color: #333333;
  cursor: pointer;
  font-weight: 300;
  transition: color 0.3s;
  z-index: 1000;
}

.coffee-close-btn:hover {
  color: #000000;
}

.coffee-close-expanded {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 32px;
  color: #333333;
  cursor: pointer;
  font-weight: 300;
  transition: color 0.3s;
}

.coffee-close-expanded:hover {
  color: #000000;
}

/* Categories List */
.coffee-categories-list {
  margin: 25px 0;
  border: 1px solid #e0e0e0;
  border-radius: var(--cookie-item-border-radius, 8px);
  overflow: hidden;
}

.coffee-category-item {
  border-bottom: 1px solid #e0e0e0;
}

.coffee-category-item:last-child {
  border-bottom: none;
}

/* Category Header */
.coffee-category-header {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: #f9f9f9;
  transition: background 0.3s ease;
}

.coffee-category-header:hover {
  background: #f5f5f5;
}

.coffee-category-item.expanded .coffee-category-header {
  background: #f0f7ff;
  border-bottom: 1px solid #d0e8ff;
}

.coffee-category-info {
  flex: 1;
}

.coffee-category-info h3 {
  margin: 0 0 5px 0;
  font-size: 1.1em;
  font-weight: 600;
  color: var(--cookie-text-color, #000000);
}

.coffee-category-info p {
  margin: 0;
  font-size: 0.9em;
  color: var(--cookie-text-color, #000000);
}

/* Toggle Switch */
.coffee-category-toggle {
  margin-left: 20px;
  flex-shrink: 0;
}

.coffee-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.coffee-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

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

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

input:checked + .coffee-slider {
  background-color: var(--cookie-primary-color, #2d7984);
}

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

input:disabled + .coffee-slider {
  background-color: #e0e0e0;
  cursor: not-allowed;
}

/* Always Active Label */
.coffee-always-active {
  display: inline-block;
  background: var(--cookie-primary-color, #2d7984);
  color: var(--cookie-contrast-color, #ffffff);
  padding: 6px 12px;
  border-radius: var(--cookie-input-border-radius, 6px);
  font-size: 0.85em;
  font-weight: 600;
}

/* Cookie Details */
.coffee-category-cookies {
  max-height: 300px;
  overflow-y: auto;
  padding: 15px 20px;
  background: #fafafa;
  border-top: 1px solid #e0e0e0;
}

.coffee-category-empty {
  padding: 15px 20px;
  background: #fafafa;
  border-top: 1px solid #e0e0e0;
  color: #666666;
  font-style: italic;
}

.coffee-cookies-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.coffee-cookie-item {
  background: white;
  padding: 12px;
  border-radius: var(--cookie-item-border-radius, 8px);
  border-left: 4px solid #27ae60;
}

.coffee-cookie-name,
.coffee-cookie-duration,
.coffee-cookie-description {
  margin-bottom: 8px;
  font-size: 0.9em;
  color: var(--cookie-text-color, #000000);
  line-height: 1.5;
}

.coffee-cookie-name:last-child,
.coffee-cookie-duration:last-child,
.coffee-cookie-description:last-child {
  margin-bottom: 0;
}

.coffee-cookie-name strong,
.coffee-cookie-duration strong,
.coffee-cookie-description strong {
  color: var(--cookie-text-color, #000000);
  font-weight: 600;
  margin-right: 6px;
}

/* Floating Circle Widget */
.coffee-settings-circle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 50px;
  height: 50px;
  background: var(--cookie-primary-color, #2d7984);
  color: var(--cookie-contrast-color, #ffffff);
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  z-index: 98;
  transition: all 0.2s ease;
  font-weight: bold;
}

/* Show circle in subtle mode */
#coffee-cookie-modal[data-modal-style="subtle"] ~ .coffee-settings-circle,
body.coffee-show-circle #coffee-cookie-modal[data-modal-style="subtle"] ~ .coffee-settings-circle {
  display: flex !important;
}

.coffee-settings-circle:hover {
  transform: scale(1.1);
  /* box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3); */
}

.coffee-settings-circle::after {
  content: "";
}

.coffee-circle-icon {
  width: auto;
  height: 28px;
  fill: currentColor;
  color: var(--cookie-contrast-color, #ffffff);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Body Classes */
body.coffee-show-banner {
  overflow: hidden !important;
}

body.coffee-show-banner #coffee-cookie-modal:not([data-modal-style="prominent"]) {
  display: flex;
}

body.coffee-show-banner-prominent #coffee-cookie-modal[data-modal-style="prominent"] {
  display: flex !important;
}

body.coffee-show-circle .coffee-settings-circle,
#coffee-cookie-modal[data-modal-style="subtle"] ~ .coffee-settings-circle {
  display: flex;
}

/* Responsive Design */
@media (max-width: 768px) {
  #coffee-cookie-modal {
    padding: 10px;
  }

  #coffee-cookie-modal[data-modal-style="prominent"] {
    padding: 0;
  }

  #coffee-cookie-modal[data-modal-style="prominent"] .coffee-modal-content {
    border-radius: 12px 12px 0 0;
    max-width: 100%;
    width: calc(100% - 0px);
    display: flex;
    flex-direction: column;
  }

  #coffee-cookie-modal[data-modal-style="prominent"] .coffee-content-row {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: start;
  }

  #coffee-cookie-modal[data-modal-style="prominent"] .coffee-modal-actions {
    flex-direction: row;
    gap: 12px;
    margin-top: 10px;
  }

  #coffee-cookie-modal[data-modal-style="prominent"] .coffee-modal-actions .coffee-btn {
    flex: 1;
    width: auto;
  }

  .coffee-modal-content {
    padding: 25px;
    max-width: 100%;
  }

  .coffee-expanded-content {
    padding: 20px;
    max-height: 85vh;
  }

  .coffee-modal-content h2 {
    font-size: 1.5em;
  }

  .coffee-modal-actions {
    flex-direction: column;
    gap: 10px;
  }

  .coffee-btn {
    width: 100%;
    min-width: unset;
  }

  .coffee-category-header {
    padding: 15px;
    flex-direction: column;
    align-items: flex-start;
  }

  .coffee-category-toggle {
    margin-left: 0;
    margin-top: 10px;
    align-self: flex-start;
  }

  .coffee-close-expanded {
    top: 15px;
    right: 15px;
    font-size: 28px;
  }

  /* Adjust circle position for mobile */
  .coffee-settings-circle {
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    font-size: 24px;
    background: var(--cookie-primary-color, #2d7984);
    color: var(--cookie-contrast-color, #ffffff);
  }
}

@media (max-width: 480px) {
  #coffee-cookie-modal {
    padding: 5px;
  }

  .coffee-modal-content {
    padding: 20px;
    border-radius: var(--cookie-modal-border-radius, 12px);
  }

  .coffee-expanded-content {
    padding: 15px;
  }

  .coffee-modal-content h2 {
    font-size: 1.3em;
    margin-bottom: 10px;
  }

  .coffee-modal-content p {
    font-size: 0.9em;
  }

  .coffee-category-header {
    padding: 12px;
  }

  .coffee-category-info h3 {
    font-size: 1em;
  }

  .coffee-category-info p {
    font-size: 0.85em;
  }

  .coffee-switch {
    width: 45px;
    height: 22px;
  }

  .coffee-slider:before {
    height: 16px;
    width: 16px;
  }

  input:checked + .coffee-slider:before {
    transform: translateX(23px);
  }

  .coffee-settings-circle {
    width: 45px;
    height: 45px;
    font-size: 20px;
    bottom: 15px;
    left: 15px;
    background: var(--cookie-primary-color, #2d7984);
    color: var(--cookie-contrast-color, #ffffff);
  }
}

/* Print Styles */
@media print {
  #coffee-cookie-modal,
  .coffee-settings-circle {
    display: none !important;
  }
}
