/* Dobby Writer Content Script Styles */
.dobby-popup {
  position: absolute;
  z-index: 999999;
  background: #FFFAF4;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: #000000;
  width: 320px;
  max-width: 90vw;
  max-height: 90vh;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  border: 1px solid #ECECEC;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dobby-popup.dragging {
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(239, 77, 50, 0.3);
  transform: translateY(0) scale(1.02);
}

.dobby-popup-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Header */
.dobby-header {
  background: linear-gradient(135deg, #EF4D32 0%, #fed18e 100%);
  padding: 12px 16px;
  border-radius: 16px 16px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  cursor: move;
  user-select: none;
  transition: background 0.2s ease;
}

.dobby-header:hover {
  background: linear-gradient(135deg, #fed18e 0%, #EF4D32 100%);
}

.dobby-header:active {
  opacity: 0.9;
}

.dobby-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: dobby-shimmer 3s ease-in-out infinite;
}

@keyframes dobby-shimmer {
  0%, 100% { transform: translateX(-100%) translateY(-100%) rotate(0deg); }
  50% { transform: translateX(0%) translateY(0%) rotate(180deg); }
}

.dobby-logo-placeholder {
  width: 20px;
  height: 20px;
  animation: dobby-float 2s ease-in-out infinite;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
  z-index: 1;
  position: relative;
  border-radius: 3px;
}

@keyframes dobby-float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-3px); }
}

.dobby-title {
  color: #FFFAF4;
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
  z-index: 1;
  position: relative;
}

.dobby-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #FFFAF4;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 1;
  position: relative;
}

.dobby-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Custom Section */
.dobby-custom-section {
  padding: 16px;
  background: #FFF4E8;
  border-bottom: 1px solid #ECECEC;
}

.dobby-custom-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ECECEC;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 10px;
  background: #FFFAF4;
  color: #000000;
  outline: none;
  transition: border-color 0.2s ease;
}

.dobby-custom-input:focus {
  border-color: #EF4D32;
}

.dobby-custom-input::placeholder {
  color: #9B9B9B;
}

/* Action Buttons */
.dobby-actions {
  padding: 12px 16px;
  background: #FFFAF4;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex-shrink: 0;
}

.dobby-btn {
  background: #FFF4E8;
  border: 1px solid #ECECEC;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  color: #000000;
}

.dobby-btn:hover {
  background: #EF4D32;
  color: #FFFAF4;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(239, 77, 50, 0.3);
}

.dobby-btn-custom {
  background: #EF4D32;
  color: #FFFAF4;
  border-color: #EF4D32;
  font-weight: 500;
}

.dobby-btn-custom:hover {
  background: #fed18e;
  border-color: #fed18e;
  color: #000000;
}

.dobby-icon {
  font-size: 14px;
}

/* Result Section */
.dobby-result {
  padding: 16px;
  background: #FFF4E8;
  border-top: 1px solid #ECECEC;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.dobby-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
  color: #000000;
}

.dobby-result-actions {
  display: flex;
  gap: 8px;
}

.dobby-result-btn {
  background: #EF4D32;
  color: #FFFAF4;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dobby-result-btn:hover {
  background: #fed18e;
  color: #000000;
}

/* Result text - make it selectable */
.dobby-result-text {
  background: #FFFAF4;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #ECECEC;
  font-size: 13px;
  line-height: 1.5;
  color: #000000;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  cursor: text;
}

/* Loading */
.dobby-loading {
  padding: 20px;
  text-align: center;
  background: #FFF4E8;
  color: #000000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.dobby-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #ECECEC;
  border-top: 3px solid #EF4D32;
  border-radius: 50%;
  animation: dobby-spin 1s linear infinite;
}

@keyframes dobby-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 480px) {
  .dobby-popup {
    width: 280px;
  }
  
  .dobby-actions {
    grid-template-columns: 1fr;
  }
  
  .dobby-btn {
    justify-content: center;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .dobby-popup {
    border: 2px solid #000;
  }
  
  .dobby-btn {
    border: 1px solid #666;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .dobby-popup,
  .dobby-btn,
  .dobby-logo-placeholder,
  .dobby-spinner {
    animation: none;
    transition: none;
  }
  
  .dobby-popup-visible {
    transform: none;
  }
}



/* Floating Action Button */
.dobby-floating-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #EF4D32 0%, #fed18e 100%);
  border-radius: 50%;
  cursor: pointer;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(239, 77, 50, 0.4);
  transition: all 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.dobby-floating-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 77, 50, 0.6);
}

.dobby-floating-icon {
  width: 24px;
  height: 24px;
  animation: dobby-float 2s ease-in-out infinite;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
  border-radius: 4px;
}

.dobby-floating-tooltip {
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  background: #000000;
  color: #FFFAF4;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.dobby-floating-button:hover .dobby-floating-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(-5px);
}

/* Floating Message */
.dobby-floating-message {
  position: fixed;
  bottom: 90px;
  right: 20px;
  background: #000000;
  color: #FFFAF4;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 999997;
  opacity: 0;
  transform: translateY(10px);
  animation: dobby-message-show 2s ease forwards;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

@keyframes dobby-message-show {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  10%, 90% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* Mobile responsiveness for floating button */
@media (max-width: 768px) {
  .dobby-floating-button {
    width: 50px;
    height: 50px;
    bottom: 15px;
    right: 15px;
  }
  
  .dobby-floating-icon {
    font-size: 20px;
  }
  
  .dobby-floating-tooltip {
    display: none;
  }
  
  .dobby-floating-message {
    right: 15px;
    bottom: 75px;
    font-size: 13px;
  }
}


/* Floating Chatbox Container - Enhanced for dark mode */
.dobby-chatbox-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999998;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Chatbox Button */
.dobby-chatbox-button {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #EF4D32 0%, #fed18e 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(239, 77, 50, 0.4);
  transition: all 0.3s ease;
  position: relative;
}

.dobby-chatbox-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 77, 50, 0.6);
}

.dobby-chatbox-icon {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
  border-radius: 4px;
}

.dobby-chatbox-tooltip {
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%);
  background: #000000;
  color: #FFFAF4;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.dobby-chatbox-button:hover .dobby-chatbox-tooltip {
  opacity: 1;
}

/* Chatbox Window - Fixed for dark mode */
.dobby-chatbox {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 350px;
  height: 500px;
  background: #FFFAF4 !important;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: dobby-chatbox-open 0.3s ease;
  border: 2px solid #ECECEC;
}

@keyframes dobby-chatbox-open {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Chatbox Header */
.dobby-chatbox-header {
  background: linear-gradient(135deg, #EF4D32 0%, #fed18e 100%);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #FFFAF4;
}

.dobby-chatbox-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.dobby-chatbox-logo {
  width: 20px;
  height: 20px;
  border-radius: 3px;
}

.dobby-chatbox-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #FFFAF4;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.dobby-chatbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Chatbox Messages - Enhanced for dark mode */
.dobby-chatbox-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #FFFAF4 !important;
}

.dobby-chat-message {
  padding: 12px;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
  animation: dobby-message-appear 0.3s ease;
  color: #000000 !important;
  border: 1px solid #ECECEC;
}

@keyframes dobby-message-appear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dobby-chat-user {
  background: #FFF4E8 !important;
  align-self: flex-end;
  margin-left: auto;
  border-color: #EF4D32;
}

.dobby-chat-dobby {
  background: #fed18e !important;
  align-self: flex-start;
  border-color: #fed18e;
}

.dobby-chat-error {
  background: #EF4D32 !important;
  color: #FFFAF4 !important;
  align-self: center;
  text-align: center;
  border-color: #EF4D32;
}

.dobby-chat-label {
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  opacity: 0.8;
  color: inherit !important;
}

/* Chatbox Input Container */
.dobby-chatbox-input-container {
  border-top: 1px solid #ECECEC;
  padding: 12px;
  background: #FFFAF4 !important;
}

/* Enhancement Tools */
.dobby-chatbox-enhance-tools {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.dobby-enhance-btn {
  background: #FFF4E8 !important;
  border: 1px solid #ECECEC;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: #000000 !important;
}

.dobby-enhance-btn:hover {
  background: #EF4D32 !important;
  color: #FFFAF4 !important;
  transform: translateY(-1px);
  border-color: #EF4D32;
}

.dobby-enhance-btn.loading {
  pointer-events: none;
  opacity: 0.6;
}

.dobby-enhance-btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid #EF4D32;
  border-radius: 50%;
  border-top-color: transparent;
  animation: dobby-spin 0.8s linear infinite;
}

/* Chatbox Input Wrapper */
.dobby-chatbox-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.dobby-chatbox-input {
  flex: 1;
  background: #FFF4E8 !important;
  border: 1px solid #ECECEC;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.4;
  color: #000000 !important;
}

.dobby-chatbox-input:focus {
  background: #FFFAF4 !important;
  border-color: #EF4D32;
}

.dobby-chatbox-input::placeholder {
  color: #9B9B9B !important;
}

.dobby-chatbox-send {
  background: linear-gradient(135deg, #EF4D32 0%, #fed18e 100%);
  border: none;
  color: #FFFAF4;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.dobby-chatbox-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 77, 50, 0.3);
}

/* Chat Notification */
.dobby-chat-notification {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: #000000 !important;
  color: #FFFAF4 !important;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  animation: dobby-notification-show 3s ease forwards;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

@keyframes dobby-notification-show {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  10%, 90% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .dobby-chatbox {
    width: calc(100vw - 20px);
    height: calc(100vh - 100px);
    right: 10px;
    bottom: 80px;
  }
  
  .dobby-chatbox-button {
    width: 50px;
    height: 50px;
  }
  
  .dobby-chatbox-icon {
    font-size: 20px;
  }
  
  .dobby-chatbox-tooltip {
    display: none;
  }
}

