/* GDPR Consent Management Styles */
/* Hebrew RTL support and Kindle-reader theme integration */

/* Consent Banner - Bottom Fixed Position */
.gdpr-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);
  z-index: 10000;
  font-family: "Georgia", serif;
  direction: rtl;
  text-align: right;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

/* Banner Content Layout */
.consent-banner-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Banner Text Section */
.consent-banner-text {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  flex: 1;
  min-width: 0; /* Allow text to shrink */
}

.consent-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 5px;
}

.consent-message {
  flex: 1;
  min-width: 0;
}

.consent-title {
  margin: 0 0 8px 0;
  font-size: 1.1rem;
  font-weight: normal;
  color: #2c2c2c;
  line-height: 1.3;
}

.consent-description {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #555;
  text-align: justify;
}

/* Privacy Policy Link in Banner */
.privacy-link {
  display: inline-block;
  margin-top: 8px;
  color: #007aff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: normal;
  border-bottom: 1px dotted #007aff;
  transition: all 0.2s ease;
}

.privacy-link:hover {
  color: #0056cc;
  border-bottom-style: solid;
  text-decoration: none;
}

.privacy-link:focus {
  outline: 2px solid #007aff;
  outline-offset: 2px;
  border-radius: 2px;
}

/* Banner Actions */
.consent-banner-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
  align-items: center;
}

/* Consent Buttons - Smaller Size */
.consent-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  font-family: "Georgia", serif;
  font-size: 0.75rem;
  font-weight: normal;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  direction: rtl;
  text-align: center;
  min-width: 60px;
}

.consent-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.consent-btn:active {
  transform: translateY(0);
}

.consent-btn:focus {
  outline: 2px solid #007aff;
  outline-offset: 2px;
}

/* Accept Button */
.consent-btn-accept {
  background: #28a745;
  color: white;
}

.consent-btn-accept:hover {
  background: #218838;
}

/* Decline Button - Less attractive */
.consent-btn-decline {
  background: transparent;
  color: #666;
  border: 1px solid #ddd;
  font-size: 0.85rem;
}

.consent-btn-decline:hover {
  background: #f8f9fa;
  color: #555;
  border-color: #ccc;
}

/* Settings Button - Less attractive */
.consent-btn-settings {
  background: transparent;
  color: #888;
  border: 1px solid #e0e0e0;
  font-size: 0.7rem;
  text-decoration: underline;
  padding: 4px 8px;
}

.consent-btn-settings:hover {
  background: #f5f5f5;
  color: #666;
  text-decoration: none;
}

/* Close button removed - users must make a choice */

/* Feedback Messages */
.consent-feedback {
  position: fixed;
  bottom: 100px;
  right: 20px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 12px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 10001;
  font-family: "Georgia", serif;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  direction: rtl;
  text-align: right;
  max-width: 300px;
}

.consent-feedback.visible {
  opacity: 1;
  transform: translateX(0);
}

.consent-feedback-success {
  border-color: #28a745;
  background: #d4edda;
  color: #155724;
}

.consent-feedback-info {
  border-color: #007aff;
  background: #cce7ff;
  color: #004085;
}

/* Modal Overlay */
.consent-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  direction: rtl;
}

/* Modal Content */
.consent-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  font-family: "Georgia", serif;
  direction: rtl;
  text-align: right;
}

/* Modal Header */
.consent-modal-header {
  padding: 25px 30px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  margin-bottom: 0;
  padding-bottom: 20px;
}

.consent-modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
  color: #2c2c2c;
  font-weight: normal;
}

.consent-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.consent-modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #666;
}

/* Modal Content */
.consent-modal-content {
  padding: 20px 30px;
}

.consent-category {
  margin-bottom: 25px;
}

.consent-category h3 {
  margin: 0 0 15px 0;
  font-size: 1.1rem;
  color: #2c2c2c;
  font-weight: normal;
}

.consent-category p {
  margin: 0 0 15px 0;
  line-height: 1.6;
  color: #555;
  text-align: justify;
}

.consent-category ul {
  margin: 15px 0;
  padding-right: 20px;
  color: #555;
}

.consent-category li {
  margin-bottom: 8px;
  line-height: 1.5;
}

/* Consent Choice */
.consent-category-choice {
  margin-top: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.consent-category-choice label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 1rem;
  color: #2c2c2c;
}

.consent-category-choice input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Modal Actions */
.consent-modal-actions {
  padding: 0 30px 30px;
  display: flex;
  gap: 15px;
  justify-content: flex-end;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
  .consent-banner-content {
    flex-direction: column;
    gap: 15px;
    padding: 20px 15px;
    text-align: center;
  }

  .consent-banner-text {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  .consent-icon {
    align-self: center;
    margin-top: 0;
  }

  .consent-banner-actions {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .consent-btn {
    flex: 1;
    min-width: 80px;
    padding: 8px 12px;
    font-size: 0.7rem;
  }

  /* Close button removed */

  .consent-feedback {
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .consent-modal {
    margin: 10px;
    max-height: 90vh;
  }

  .consent-modal-header,
  .consent-modal-content,
  .consent-modal-actions {
    padding-left: 20px;
    padding-right: 20px;
  }

  .consent-modal-actions {
    flex-direction: column;
  }

  .consent-btn {
    width: 100%;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .consent-banner-content {
    padding: 15px 10px;
  }

  .consent-title {
    font-size: 1rem;
  }

  .consent-description {
    font-size: 0.9rem;
  }

  .consent-btn {
    font-size: 0.7rem;
    padding: 6px 10px;
    min-width: 70px;
  }

  .consent-modal-header h2 {
    font-size: 1.1rem;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .gdpr-consent-banner {
    background: white;
    border-top: 2px solid black;
  }

  .consent-btn {
    border: 2px solid currentColor;
  }

  .consent-btn-accept {
    background: #000;
    color: #fff;
  }

  .consent-btn-decline {
    background: transparent;
    color: #666;
    border: 2px solid #666;
  }

  .consent-btn-settings {
    background: transparent;
    color: #888;
    border: 2px solid #888;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .gdpr-consent-banner,
  .consent-btn,
  .consent-feedback,
  .consent-modal-close {
    transition: none;
  }
}

/* Focus indicators for keyboard navigation */
.consent-btn:focus-visible,
.consent-modal-close:focus-visible {
  outline: 3px solid #007aff;
  outline-offset: 2px;
}

/* Dark mode support (if needed in the future) */
@media (prefers-color-scheme: dark) {
  .gdpr-consent-banner {
    background: rgba(30, 30, 30, 0.98);
    border-top-color: rgba(255, 255, 255, 0.2);
  }

  .consent-title {
    color: #e0e0e0;
  }

  .consent-description {
    color: #b0b0b0;
  }

  .consent-modal {
    background: #2c2c2c;
    color: #e0e0e0;
  }

  .consent-modal-header {
    border-bottom-color: #444;
  }

  .consent-category-choice {
    background: #3a3a3a;
    border-color: #555;
  }
}

/* Integration with existing Kindle reader styles */
.kindle-overlay-visible .gdpr-consent-banner {
  bottom: 44px; /* Adjust for footer overlay */
}

/* Ensure banner doesn't interfere with existing progress bar */
.kindle-progress {
  z-index: 9999; /* Lower than consent banner */
}

/* Banner visibility animation classes */
.gdpr-consent-banner.show {
  transform: translateY(0);
  opacity: 1;
}

.gdpr-consent-banner.hide {
  transform: translateY(100%);
  opacity: 0;
}

/* Settings Modal Additional Styles */
.consent-intro {
  margin-bottom: 25px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 4px solid #007aff;
}

.consent-intro p {
  margin: 0;
  color: #555;
  font-style: italic;
}

/* Current Status Display */
.consent-current-status {
  margin-bottom: 30px;
  padding: 20px;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
}

.consent-current-status h3 {
  margin: 0 0 15px 0;
  color: #2c2c2c;
  font-size: 1.1rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 6px;
  font-weight: normal;
}

.status-indicator.accepted {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-indicator.declined {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.status-indicator.pending {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.status-icon {
  font-size: 1.2rem;
  font-weight: bold;
}

.status-text {
  flex: 1;
  font-weight: bold;
}

.status-date {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* Category Header with Toggle */
.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.category-header h3 {
  margin: 0;
  color: #2c2c2c;
  font-size: 1.1rem;
}

/* Toggle Switch */
.consent-toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.consent-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: .4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

.consent-toggle input:checked + .toggle-slider {
  background-color: #28a745;
}

.consent-toggle input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

.consent-toggle input:focus + .toggle-slider {
  box-shadow: 0 0 0 2px #007aff;
}

/* Category Details */
.category-description {
  color: #555;
  line-height: 1.6;
}

.category-details {
  margin-top: 20px;
}

.category-details h4 {
  margin: 20px 0 10px 0;
  color: #2c2c2c;
  font-size: 1rem;
  font-weight: bold;
}

.category-details ul {
  margin: 10px 0;
  padding-right: 20px;
}

.category-details li {
  margin-bottom: 6px;
}

/* Cookie List */
.cookie-list {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 15px;
  margin-top: 10px;
}

.cookie-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e9ecef;
  gap: 15px;
}

.cookie-item:last-child {
  border-bottom: none;
}

.cookie-item code {
  background: #e9ecef;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.85rem;
  color: #495057;
  white-space: nowrap;
}

.cookie-item span:not(code) {
  color: #666;
  font-size: 0.9rem;
}

/* Essential Info */
.consent-essential-info {
  margin: 30px 0;
  padding: 20px;
  background: #e7f3ff;
  border: 1px solid #b3d9ff;
  border-radius: 6px;
}

.consent-essential-info h3 {
  margin: 0 0 10px 0;
  color: #004085;
}

.consent-essential-info p {
  margin: 0 0 10px 0;
  color: #004085;
}

.consent-essential-info ul {
  margin: 10px 0 0 0;
  padding-right: 20px;
  color: #004085;
}

/* Withdrawal Section */
.consent-withdrawal-section {
  margin: 30px 0;
  padding: 20px;
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 6px;
}

.consent-withdrawal-section h3 {
  margin: 0 0 10px 0;
  color: #c53030;
}

.consent-withdrawal-section p {
  margin: 0 0 15px 0;
  color: #744210;
}

.consent-btn-danger {
  background: #dc3545;
  color: white;
}

.consent-btn-danger:hover {
  background: #c82333;
}

/* Legal Info */
.consent-legal-info {
  margin-top: 30px;
  padding: 20px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  border-right: 4px solid #6c757d;
}

.consent-legal-info h3 {
  margin: 0 0 15px 0;
  color: #2c2c2c;
}

.consent-legal-info p {
  margin: 0 0 10px 0;
  color: #555;
}

.consent-legal-info ul {
  margin: 10px 0;
  padding-right: 20px;
  color: #555;
}

/* Toast Notifications */
.consent-toast {
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 12px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  font-family: "Georgia", serif;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  direction: rtl;
  text-align: right;
  max-width: 350px;
  word-wrap: break-word;
}

.consent-toast.visible {
  opacity: 1;
  transform: translateX(0);
}

.consent-toast-success {
  border-color: #28a745;
  background: #d4edda;
  color: #155724;
}

.consent-toast-info {
  border-color: #007aff;
  background: #cce7ff;
  color: #004085;
}