/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: linear-gradient(#ffffff, #f5efdc);
  color: var(--text-secondary);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius);
  max-height: 80vh;
  width: 90%;
  max-width: 480px;
  overflow: visible;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px;
  text-align: center;
  animation: modalIn 0.18s ease-out;
}

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

.modal-body {
  padding: 2px;
  overflow-y: auto;
  max-height: calc(80vh - 40px);
  min-height: 160px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: stretch;
  justify-content: center;
  text-align: center;
}

.modal-body h2 {
  margin: 0 0 2px 0;
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 500;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 2px;
}

.btn-cancel,
.btn-confirm {
  border-radius: var(--radius);
  padding: 2px 6px;
  cursor: pointer;
  font-weight: 500;
}

.btn-cancel {
  background: var(--chat-bg);
  color: var(--text);
  border: 1px solid var(--glass-border);
}

.btn-confirm {
  background: var(--accent);
  color: var(--text-inverse);
  border: none;
}

.close {
  position: absolute;
  top: 2px;
  right: 2px;
  color: var(--muted);
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.1);
}

/* Custom Prompt Modal */
#custom-prompt-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(8px);
}

#custom-prompt-modal.show {
  display: flex;
}

#custom-prompt-modal .modal-content {
  background: linear-gradient(#ffffff, #f5efdc);
  color: var(--text-secondary);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius);
  width: 90%;
  max-width: 420px;
  overflow: visible;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2);
  animation: modalIn 0.18s ease-out;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px;
}

#custom-prompt-modal .modal-body {
  padding: 2px;
  gap: 2px;
  align-items: stretch;
}

#custom-prompt-modal #custom-prompt-title {
  margin: 0 0 2px 0;
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 500;
  text-align: center;
}

#custom-prompt-modal #custom-prompt-input {
  width: 100%;
  padding: 2px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 0.92rem;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

#custom-prompt-modal #custom-prompt-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(76, 52, 255, 0.2);
  background: #ffffff;
}

#custom-prompt-modal #custom-prompt-input::placeholder {
  color: rgba(0, 0, 0, 0.3);
}

#custom-prompt-modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  margin-top: 2px;
}

#custom-prompt-modal .btn-cancel,
#custom-prompt-modal .btn-confirm {
  border-radius: var(--radius);
  padding: 2px 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  border: none;
  min-width: 80px;
}

#custom-prompt-modal .btn-cancel {
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

#custom-prompt-modal .btn-cancel:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text);
  transform: translateY(-1px);
}

#custom-prompt-modal .btn-confirm {
  background: var(--accent);
  color: var(--text-inverse);
  box-shadow: 0 6px 18px rgba(76, 52, 255, 0.2);
}

#custom-prompt-modal .btn-confirm:hover {
  background: linear-gradient(135deg, var(--accent), #7c84ff);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(76, 52, 255, 0.28);
}

#custom-prompt-modal .btn-confirm:active {
  transform: translateY(0);
}

#custom-prompt-modal .close {
  position: absolute;
  top: 2px;
  right: 2px;
  color: var(--muted);
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

#custom-prompt-modal .close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.1);
}

/* Responsive para modal de prompt */
@media (max-width: 768px) {
  #custom-prompt-modal .modal-content {
    width: 95%;
    max-width: none;
    margin: 10px;
  }

  #custom-prompt-modal .modal-body {
    padding: 20px;
  }

  #custom-prompt-modal .modal-actions {
    gap: 8px;
  }

  #custom-prompt-modal .btn-cancel,
  #custom-prompt-modal .btn-confirm {
    padding: 8px 16px;
    font-size: 0.85rem;
  }
}

/* Scrollbar styles for modals */
#custom-prompt-modal .modal-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.3) rgba(255, 255, 255, 0.03);
}

#custom-prompt-modal .modal-body::-webkit-scrollbar {
  width: 8px;
}

#custom-prompt-modal .modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
}

#custom-prompt-modal .modal-body::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#custom-prompt-modal .modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.5);
}