/* Speech to Text Component Styles */

.speech-to-text-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 320px;
  min-width: 200px;
  min-height: 150px;
  max-width: 600px;
  max-height: 500px;
  z-index: 9999;
  background: linear-gradient(145deg, #f0f4f8, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-family: "Roboto", sans-serif;
  resize: both;
  overflow: hidden;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Add dragging state styles */
.speech-to-text-container.dragging {
  cursor: move;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.2s ease;
}

.speech-to-text-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg, #e2e8f0, #cbd5e1);
  border-radius: 12px 12px 0 0;
  cursor: move;
  user-select: none;
}

.speech-to-text-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #2d3748;
  flex-grow: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stt-status {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 16px;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stt-status.listening {
  background: linear-gradient(145deg, #c6f6d5, #9ae6b4);
  color: #22543d;
}

.stt-status.stopped {
  background: linear-gradient(145deg, #fed7d7, #feb2b2);
  color: #742a2a;
}

.stt-status.error {
  background: linear-gradient(145deg, #fed7d7, #feb2b2);
  color: #742a2a;
}

.speech-to-text-content {
  padding: 12px;
}

.speech-output {
  min-height: 60px;
  max-height: 150px;
  overflow-y: auto;
  padding: 12px;
  background: linear-gradient(145deg, #f1f5f9, #e2e8f0);
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #2d3748;
  cursor: text;
  user-select: text;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.edit-textarea {
  width: 100%;
  min-height: 100px;
  border: 1px solid #ddd;
  background: white;
  resize: vertical;
  font-family: "Roboto", sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: #333;
  outline: none;
  padding: 8px;
  margin: 0;
  border-radius: 4px;
  box-sizing: border-box;
}

.speech-output .interim {
  color: #666;
  font-style: italic;
}

.stt-toggle-button {
  background: linear-gradient(145deg, #4299e1, #3182ce);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  width: 100%;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(66, 153, 225, 0.2);
}

.stt-toggle-button:hover:not(:disabled) {
  background: linear-gradient(145deg, #3182ce, #2b6cb0);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(66, 153, 225, 0.3);
}

.stt-toggle-button:active:not(:disabled) {
  transform: translateY(0);
}

.stt-toggle-button.active {
  background: linear-gradient(145deg, #e53e3e, #c53030);
  box-shadow: 0 2px 6px rgba(229, 62, 62, 0.2);
}

.stt-toggle-button:disabled {
  background: #bdbdbd;
  cursor: not-allowed;
  opacity: 0.7;
}

.speech-to-text-footer {
  padding: 0 16px 16px;
  font-size: 11px;
  color: #718096;
  text-align: center;
  font-weight: 400;
}

/* Copy button styles */
.copy-button {
  background: linear-gradient(145deg, #48bb78, #38a169);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  width: 100%;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(72, 187, 120, 0.2);
}

/* Gemini button styles */
.gemini-button {
  background: linear-gradient(145deg, #805ad5, #6b46c1);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  width: 100%;
  margin-bottom: 12px;
  box-shadow: 0 4px 10px rgba(128, 90, 213, 0.3);
  position: relative;
  overflow: hidden;
}

.gemini-button:hover:not(:disabled) {
  background: linear-gradient(145deg, #6b46c1, #553c9a);
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(128, 90, 213, 0.4);
}

.gemini-button:active:not(:disabled) {
  transform: translateY(0);
}

/* Processing state for Gemini buttons */
.gemini-button:disabled {
  background: linear-gradient(145deg, #6b46c1, #553c9a) !important;
  opacity: 0.8;
  cursor: not-allowed;
  position: relative;
  box-shadow: 0 2px 4px rgba(128, 90, 213, 0.2);
}

.gemini-button:disabled::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
}

.gemini-button.processing {
  animation: pulse 1.5s infinite;
  position: relative;
}

.gemini-button.processing::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 10px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

.gemini-button.processing span {
  margin-left: 20px;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(123, 31, 162, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(123, 31, 162, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(123, 31, 162, 0);
  }
}

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

/* Clear button styles */
.clear-button {
  background: linear-gradient(145deg, #f56565, #e53e3e);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  width: 100%;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(245, 101, 101, 0.2);
}

/* Text processing button styles */
.text-process-button {
  background: linear-gradient(145deg, #ed8936, #dd6b20);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  width: 100%;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(237, 137, 54, 0.2);
}

.text-process-button:hover:not(:disabled) {
  background: linear-gradient(145deg, #dd6b20, #c05621);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(237, 137, 54, 0.3);
}

.text-process-button:active:not(:disabled) {
  transform: translateY(0);
}

.text-process-button:disabled {
  background: #bdbdbd;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Minimize button styles */
.minimize-button {
  background: linear-gradient(145deg, #e2e8f0, #cbd5e1);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  color: #4a5568;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.minimize-button:hover {
  background: linear-gradient(145deg, #cbd5e1, #a0aec0);
  color: #2d3748;
  transform: scale(1.05);
}

/* Resize handles */
.resize-handle-top-left {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  background: linear-gradient(-45deg, transparent 30%, #666 30%, #666 50%, transparent 50%, transparent 100%);
  border-radius: 8px 0 0 0;
  z-index: 10000;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.resize-handle-top-left:hover {
  opacity: 1;
}

.resize-handle-bottom-right {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 30%, #666 30%, #666 50%, transparent 50%, transparent 100%);
  border-radius: 0 0 8px 0;
  z-index: 10000;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.resize-handle-bottom-right:hover {
  opacity: 1;
}

.copy-button:hover:not(:disabled) {
  background: linear-gradient(145deg, #38a169, #2f855a);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(72, 187, 120, 0.3);
}

.copy-button:active:not(:disabled) {
  transform: translateY(0);
}

.copy-button:disabled {
  background: #bdbdbd;
  cursor: not-allowed;
  opacity: 0.7;
}

.clear-button:hover:not(:disabled) {
  background: linear-gradient(145deg, #e53e3e, #c53030);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(245, 101, 101, 0.3);
}

.clear-button:active:not(:disabled) {
  transform: translateY(0);
}

/* Gemini Integration Styles */
.gemini-integration-container {
  position: fixed;
  bottom: 20px;
  right: 360px;
  width: 300px;
  min-height: 200px;
  z-index: 10000;
  background: linear-gradient(145deg, #f0f4f8, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-family: "Roboto", sans-serif;
  overflow: hidden;
}

.gemini-integration-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg, #e2e8f0, #cbd5e1);
  border-radius: 12px 12px 0 0;
}

.gemini-integration-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #2d3748;
}

.close-gemini-button {
  background: linear-gradient(145deg, #e2e8f0, #cbd5e1);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  color: #4a5568;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.close-gemini-button:hover {
  background: linear-gradient(145deg, #cbd5e1, #a0aec0);
  color: #2d3748;
  transform: scale(1.05);
}

.gemini-integration-content {
  padding: 12px;
}

.gemini-api-key-section {
  margin-bottom: 12px;
}

.gemini-api-key-section label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: #4a5568;
  font-weight: 500;
}

.gemini-api-key-section input {
  width: 100%;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  box-sizing: border-box;
  background: linear-gradient(145deg, #f8fafc, #edf2f7);
  color: #2d3748;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.gemini-buttons {
  margin-bottom: 12px;
}

.custom-instruction-section {
  margin-bottom: 12px;
}

.custom-instruction-section label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: #4a5568;
  font-weight: 500;
}

.custom-instruction-section textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  box-sizing: border-box;
  min-height: 80px;
  resize: vertical;
  background: linear-gradient(145deg, #f8fafc, #edf2f7);
  color: #2d3748;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
  font-family: "Roboto", sans-serif;
}

.gemini-status {
  font-size: 13px;
  padding: 10px;
  border-radius: 6px;
  text-align: center;
  display: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.gemini-status.processing {
  background: linear-gradient(145deg, #bee3f8, #90cdf4);
  color: #2a4365;
  display: block;
}

.gemini-status.success {
  background: linear-gradient(145deg, #c6f6d5, #9ae6b4);
  color: #22543d;
  display: block;
}

.gemini-status.error {
  background: linear-gradient(145deg, #fed7d7, #feb2b2);
  color: #742a2a;
  display: block;
}

/* Large screens */
@media (min-width: 1200px) {
  .speech-to-text-container {
    max-width: 800px;
    max-height: 600px;
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .speech-to-text-container {
    width: calc(100% - 40px);
    max-width: none;
    bottom: 20px;
    right: 20px;
    left: 20px;
    resize: vertical;
  }

  .speech-output {
    min-height: 50px;
    font-size: 13px;
    padding: 10px;
  }
  
  .speech-to-text-header {
    padding: 10px 14px;
  }
  
  .speech-to-text-content {
    padding: 14px;
  }
  
  .speech-to-text-footer {
    padding: 0 14px 14px;
    font-size: 11px;
  }
  
  /* Ensure resize handles are visible on mobile */
  .resize-handle-top-left,
  .resize-handle-bottom-right {
    width: 20px;
    height: 20px;
  }
  
  /* Adjust Gemini integration for mobile */
  .gemini-integration-container {
    width: calc(100% - 80px);
    right: 20px;
    bottom: 200px;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .speech-to-text-container {
    width: calc(100% - 20px);
    bottom: 10px;
    right: 10px;
    left: 10px;
    resize: vertical;
  }
  
  .speech-output {
    min-height: 40px;
    font-size: 12px;
    padding: 8px;
  }
  
  .stt-toggle-button,
  .copy-button,
  .gemini-button,
  .clear-button,
  .text-process-button {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .resize-handle-top-left,
  .resize-handle-bottom-right {
    width: 15px;
    height: 15px;
  }
  
  .minimize-button {
    width: 24px;
    height: 24px;
    font-size: 16px;
  }
  
  .edit-textarea {
    min-height: 80px;
    font-size: 12px;
    padding: 10px;
  }
  
  /* Adjust Gemini integration for extra small devices */
  .gemini-integration-container {
    width: calc(100% - 40px);
    right: 10px;
    bottom: 180px;
  }
}