@tailwind base;
@tailwind components;
@tailwind utilities;

@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");

body {
  font-family: "poppins", sans-serif;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(75, 85, 99, 0.8) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background-color: rgba(75, 85, 99, 0.8);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(75, 85, 99, 1);
}

/* Dropdown Button */
.dropbtn {
  font-size: 14px;
  border: none;
  cursor: pointer;
}

/* The search field */
.myInput {
  box-sizing: border-box;
  background-image: url("search-icon.svg");
  background-position: 14px 12px;
  background-repeat: no-repeat;
  font-size: 16px;
  padding: 14px 20px 12px 20px;
  border: none;
  border-bottom: 1px solid #ddd;
  border-radius: 12px;
}

/* The container <div> - needed to position the dropdown content */
.dropdown {
  position: relative;
  display: inline-block;
}

/* Dropdown Content (Hidden by Default) */
.dropdown-content {
  display: none;
  position: absolute;
  top: 32px;
  background-color: #fff;
  min-width: 230px;
  border: 1px solid #ddd;
  z-index: 1;
  box-shadow: 0 2px 7px #00000026, 0 5px 17px #0003;
  border-radius: 12px;
  overflow: hidden;
  overflow: hidden;
}

/* Links inside the dropdown */
.dropdown-content a,
.dropdown-content button {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}

/* Change color of dropdown links on hover */
.dropdown-content a:hover,
.dropdown-content button:hover {
  background-color: #f1f1f1;
}

/* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) */
.show {
  display: block;
}

.chat-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 40px;
  background-color: #fff;
  min-width: 240px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  z-index: 1000;
  padding: 4px 0;
}

.chat-dropdown-menu.show {
  display: block;
}

.chat-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #111b21;
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.1s;
  cursor: pointer;
}

.chat-dropdown-item:hover {
  background-color: #f5f6f6;
}

.chat-dropdown-item svg {
  flex-shrink: 0;
}

/* tom select */
.ts-hidden-accessible {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.ts-wrapper {
  position: relative;
}

.ts-control input {
  width: 100%;
  border: none;
  outline: 0;
  box-shadow: none;
  cursor: pointer;
  background-color: inherit;
  padding: 0px; 

}

.focus .ts-control {
  border-radius: 8px;
  border-color: #86b7fe;
  box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
  outline: 0;
}

.ts-dropdown .option, .no-results {
  padding: 3px .75rem;
}

.ts-dropdown{
  position: absolute;
  width: 100%;
  color: #343a40;
  border: 1px solid rgba(0, 0, 0, .17);
  border-radius: 6px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
  margin-top: 5px;
  z-index: 1000;
  background-color: #fff;
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.ts-dropdown::-webkit-scrollbar {
  width: 6px;
}

.ts-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.ts-dropdown::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.ts-dropdown .active {
  background-color: #f4f6fa;
}

.ts-dropdown-content {
  padding: 5px 0;
  cursor: pointer;
}

.ts-control {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  border: 1px solid #d1d5db;
  padding: 6px 36px 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.item {
  position: relative;
  white-space: nowrap; 
  width: fit-content; 
  padding: 0px ;
  border-radius: 7px;
}

@keyframes modalSlideDown {
  0% {
    opacity: 0;
    transform: translateY(-40px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-modalSlideDown {
  animation: modalSlideDown 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.ts-control .placeholder {
  display: none !important;
}

/* Or target specific selects */
[data-controller="tom-select"] .ts-control .placeholder {
  display: none !important;
}

/* END */

/* Car Models Multi Select */

.tom-select-model-names .item {
  position: static !important;
  display: inline-flex !important;
  gap: 6px;
  align-items: center;
  background-color: #0076ff20;
  border: 1px solid #0076ff40;
  border-radius: 6px;
  padding: 2px 6px;
  margin-right: 4px;
  margin-bottom: 4px;
  white-space: nowrap;
  font-size: 13px;
  color: #0076ff;
}

.tom-select-model-names .ts-control {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  border: 1px solid #d1d5db;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: text;
  overflow: visible;
}

.tom-select-model-names .custom-tomselect-item {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  background-color: #0076ff20;
  border: 1px solid #0076ff40;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 13px;
  color: #0076ff;
}

.tom-select-model-names .ts-control input {
  min-width: 80px;
  flex: 1;
  border: none;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
}

.tom-select-model-names .ts-wrapper.focus .ts-control {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.tom-select-model-names .ts-dropdown {
  display: none !important;
}

/* END */

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

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

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

@keyframes liked-cars-fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes liked-cars-slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.6s ease-out forwards;
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.6s ease-out forwards;
  opacity: 0;
}

.animate-fade-in-right {
  animation: fadeInRight 0.6s ease-out forwards;
  opacity: 0;
}

.animate-slide-down {
  animation: slideDown 0.5s ease-out forwards;
  opacity: 0;
}

.liked-cars-page-fade-in {
  animation: liked-cars-fadeIn 0.5s ease-out;
}

.liked-cars-page-slide-up {
  animation: liked-cars-slideUp 0.6s ease-out;
}

.liked-cars-hero-icon-shadow {
  filter: drop-shadow(0 2px 4px rgba(239, 68, 68, 0.2));
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-message-in {
  animation: messageIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.animate-shake {
  animation: shake 0.4s ease-in-out;
}

.chat-container {
  height: calc(100vh - 120px);
  max-height: 880px;
}

.chat-messages-bg {
  background-image: url('data:image/svg+xml,%3Csvg width="100" height="100" xmlns="http://www.w3.org/2000/svg"%3E%3Cdefs%3E%3Cpattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse"%3E%3Cpath d="M 100 0 L 0 0 0 100" fill="none" stroke="%23d4d4d4" stroke-width="0.5" opacity="0.1"/%3E%3C/pattern%3E%3C/defs%3E%3Crect width="100%25" height="100%25" fill="url(%23grid)"/%3E%3C/svg%3E');
}

@media (prefers-reduced-motion: reduce) {
  .liked-cars-page-fade-in,
  .liked-cars-page-slide-up {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
.optgroup{
  @apply border-b border-gray-200 pb-2 mb-2;
}

.optgroup:last-child {
  @apply border-b-0 pb-0 mb-0;
}

.optgroup-header{
  @apply text-sm font-semibold text-gray-600 px-3 py-2 bg-gray-50;
}
/* Trix Content Restoration */
.trix-content h1,
trix-editor h1 {
  @apply text-3xl font-bold mb-4 mt-6;
}
.trix-content h2,
trix-editor h2 {
  @apply text-2xl font-bold mb-3 mt-5;
}
.trix-content h3,
trix-editor h3 {
  @apply text-xl font-bold mb-2 mt-4;
}
.trix-content ul,
trix-editor ul {
  @apply list-disc list-outside ml-5 mb-4;
}
.trix-content ol,
trix-editor ol {
  @apply list-decimal list-outside ml-5 mb-4;
}
.trix-content a,
trix-editor a {
  @apply text-blue-600 underline hover:text-blue-800;
}
.trix-content blockquote,
trix-editor blockquote {
  @apply border-l-4 border-gray-300 pl-4 italic my-4 text-gray-700;
}
.trix-content pre,
trix-editor pre {
  @apply bg-gray-100 p-4 rounded-lg overflow-x-auto my-4 text-sm font-mono;
}
.trix-content p,
trix-editor p {
  @apply mb-4 leading-relaxed;
}

.bg-pattern {
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
