@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

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

@layer base {
  body {
    @apply bg-neutral-50 text-neutral-900 antialiased;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  }
  
  .dark body {
    @apply bg-neutral-900 text-neutral-50;
  }
  
  h1, h2, h3, h4, h5, h6 {
    @apply font-semibold tracking-tight;
  }
  
  a {
    @apply text-primary-600 hover:text-primary-700 transition-colors;
  }
  
  .dark a {
    @apply text-primary-400 hover:text-primary-300;
  }
}




/* Form Styles - Outside @layer for higher priority */
.form-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
.form-select,
select:not([multiple]),
.form-textarea,
textarea {
  display: block !important;
  width: 100% !important;
  padding: 0.625rem 0.875rem !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.5rem !important;
  background-color: #ffffff !important;
  color: #111827 !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  transition: all 0.2s ease-in-out !important;
  box-sizing: border-box !important;
  font-family: inherit !important;
}

input[type="password"].form-input.password-input, input[type="text"].search-input {
  padding: 0.625rem 0.875rem 0.625rem 2rem !important;
}

.dark .form-input,
.dark input[type="text"],
.dark input[type="email"],
.dark input[type="password"],
.dark input[type="number"],
.dark input[type="tel"],
.dark input[type="url"],
.dark input[type="search"],
.dark .form-select,
.dark select:not([multiple]),
.dark .form-textarea,
.dark textarea {
  border-color: #4b5563 !important;
  background-color: #212529 !important;
  color: #f9fafb !important;
}

.form-input:hover,
input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
.form-select:hover,
select:hover,
.form-textarea:hover,
textarea:hover {
  border-color: #9ca3af !important;
}

.dark .form-input:hover,
.dark input[type="text"]:hover,
.dark input[type="email"]:hover,
.dark input[type="password"]:hover,
.dark .form-select:hover,
.dark select:hover,
.dark .form-textarea:hover,
.dark textarea:hover {
  border-color: #6b7280 !important;
}

.form-input::placeholder,
input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
.form-textarea::placeholder,
textarea::placeholder {
  color: #9ca3af !important;
  opacity: 1 !important;
}

.dark .form-input::placeholder,
.dark input[type="text"]::placeholder,
.dark input[type="email"]::placeholder,
.dark input[type="password"]::placeholder,
.dark .form-textarea::placeholder,
.dark textarea::placeholder {
  color: #6b7280 !important;
}

.form-input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
.form-select:focus,
select:focus,
.form-textarea:focus,
textarea:focus {
  outline: none !important;
  border-color: #2d8f8f !important;
  box-shadow: 0 0 0 3px rgba(45, 143, 143, 0.1) !important;
}

.dark .form-input:focus,
.dark input[type="text"]:focus,
.dark input[type="email"]:focus,
.dark input[type="password"]:focus,
.dark input[type="number"]:focus,
.dark .form-select:focus,
.dark select:focus,
.dark .form-textarea:focus,
.dark textarea:focus {
  border-color: #4aacac !important;
  box-shadow: 0 0 0 3px rgba(74, 172, 172, 0.2) !important;
}

.form-select,
select:not([multiple]) {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3E%3C/svg%3E") !important;
  background-position: right 0.75rem center !important;
  background-repeat: no-repeat !important;
  background-size: 1.25em 1.25em !important;
  padding-right: 2.75rem !important;
  cursor: pointer !important;
}

.form-textarea,
textarea {
  min-height: 120px !important;
  resize: vertical !important;
}

.form-input:disabled,
input:disabled,
.form-select:disabled,
select:disabled,
.form-textarea:disabled,
textarea:disabled {
  background-color: #f3f4f6 !important;
  color: #6b7280 !important;
  cursor: not-allowed !important;
  opacity: 0.6 !important;
}

.dark .form-input:disabled,
.dark input:disabled,
.dark .form-select:disabled,
.dark select:disabled,
.dark .form-textarea:disabled,
.dark textarea:disabled {
  background-color: #374151 !important;
  color: #9ca3af !important;
}

@layer components {
  /* Card Component */
  .forum-card {
    @apply bg-white transition-all duration-200;
  }
  
  .dark .forum-card {
    @apply bg-neutral-800;
  }
  
  /* Button Variants */
  .btn-primary {
    @apply bg-primary-600 text-white px-4 py-2 rounded-md font-medium;
    @apply hover:bg-primary-700 active:bg-primary-800;
    @apply transition-colors duration-150;
    @apply focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2;
  }
  
  .btn-secondary {
    @apply bg-neutral-100 text-neutral-700 px-4 py-2 rounded-md font-medium border border-neutral-300;
    @apply hover:bg-neutral-200 active:bg-neutral-300;
    @apply transition-colors duration-150;
    @apply focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2;
  }
  
  .dark .btn-secondary {
    @apply bg-neutral-700 text-neutral-200 border-neutral-600;
    @apply hover:bg-neutral-600 active:bg-neutral-500;
  }
  
  /* Badge Component */
  .badge {
    @apply inline-flex items-center px-2.5 py-0.5 rounded text-xs font-medium;
  }
  
  .badge-solved {
    @apply bg-success-100 text-success-800 border border-success-200;
  }
  
  .dark .badge-solved {
    @apply bg-success-900/30 text-success-300 border-success-700;
  }
  
  .badge-pending {
    @apply bg-accent-100 text-accent-800 border border-accent-200;
  }
  
  .dark .badge-pending {
    @apply bg-accent-900/30 text-accent-300 border-accent-700;
  }
  
  .badge-sticky {
    @apply bg-primary-100 text-primary-800 border border-primary-200;
  }
  
  .dark .badge-sticky {
    @apply bg-primary-900/30 text-primary-300 border-primary-700;
  }
  
  /* Form styles are now defined outside @layer for higher priority */
  
  /* Code Block Styles */
  .code-block {
    @apply bg-neutral-100 border border-neutral-200 rounded-md p-4 font-mono text-sm;
    @apply overflow-x-auto;
  }
  
  .dark .code-block {
    @apply bg-neutral-800 border-neutral-700;
  }
  
  /* Post Content */
  .post-content {
    @apply prose prose-sm max-w-none;
    @apply prose-headings:font-semibold prose-headings:text-neutral-900;
    @apply prose-p:text-neutral-700 prose-p:leading-relaxed;
    @apply prose-a:text-primary-600 prose-a:no-underline hover:prose-a:underline;
    @apply prose-code:text-accent-600 prose-code:bg-neutral-100 prose-code:px-1 prose-code:rounded;
    @apply prose-pre:bg-neutral-100 prose-pre:border prose-pre:border-neutral-200;
    @apply prose-blockquote:border-l-4 prose-blockquote:border-primary-500;
    @apply prose-blockquote:pl-4 prose-blockquote:italic;
  }
  
  .dark .post-content {
    @apply prose-invert;
    @apply prose-headings:text-neutral-50;
    @apply prose-p:text-neutral-300;
    @apply prose-a:text-primary-400;
    @apply prose-code:text-accent-400 prose-code:bg-neutral-800;
    @apply prose-pre:bg-neutral-800 prose-pre:border-neutral-700;
    @apply prose-blockquote:border-primary-400;
  }
  
  
  /* Spoiler Styles */
  .bbcode-spoiler {
    @apply my-4 border border-neutral-300 rounded-lg overflow-hidden;
  }
  
  .dark .bbcode-spoiler {
    @apply border-neutral-700;
  }
  
  .bbcode-spoiler-title {
    @apply cursor-pointer px-4 py-3 bg-neutral-100 font-semibold text-neutral-900;
    @apply hover:bg-neutral-200 transition-colors duration-150;
    @apply flex items-center gap-2;
  }
  
  .dark .bbcode-spoiler-title {
    @apply bg-neutral-800 text-neutral-100;
    @apply hover:bg-neutral-700;
  }
  
  .bbcode-spoiler-title .spoiler-icon {
    @apply inline-block transition-transform duration-200;
  }
  
  .bbcode-spoiler-title.active .spoiler-icon {
    @apply transform rotate-90;
  }
  
  .bbcode-spoiler-content {
    @apply px-4 py-3 bg-white text-neutral-900;
    @apply border-t border-neutral-300;
  }
  
  .dark .bbcode-spoiler-content {
    @apply bg-neutral-900 text-neutral-100;
    @apply border-neutral-700;
  }
}

@layer utilities {
  .text-balance {
    text-wrap: balance;
  }
}

/* Enhanced Post Content Typography - Outside @layer for higher priority */

.post-content p {
  margin-bottom: 0 !important;
  color: #374151 !important;
  line-height: 1.75 !important;
  font-size: 0.9375rem !important;
}

.dark .post-content p {
  color: #d1d5db !important;
}

.post-content p:last-child {
  margin-bottom: 0 !important;
}

.post-content h1 {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  color: #111827 !important;
  margin-top: 1.5rem !important;
  margin-bottom: 1rem !important;
  line-height: 1.25 !important;
}

.post-content h2 {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: #111827 !important;
  margin-top: 1.25rem !important;
  margin-bottom: 0.75rem !important;
  line-height: 1.25 !important;
}

.post-content h3 {
  font-size: 1.125rem !important;
  font-weight: 600 !important;
  color: #111827 !important;
  margin-top: 1rem !important;
  margin-bottom: 0.75rem !important;
  line-height: 1.25 !important;
}

.post-content h4 {
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: #111827 !important;
  margin-top: 1rem !important;
  margin-bottom: 0.5rem !important;
  line-height: 1.25 !important;
}

.post-content h5 {
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  color: #111827 !important;
  margin-top: 0.75rem !important;
  margin-bottom: 0.5rem !important;
  line-height: 1.25 !important;
}

.post-content h6 {
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  color: #1f2937 !important;
  margin-top: 0.75rem !important;
  margin-bottom: 0.5rem !important;
  line-height: 1.25 !important;
}

.dark .post-content h1,
.dark .post-content h2,
.dark .post-content h3,
.dark .post-content h4,
.dark .post-content h5,
.dark .post-content h6 {
  color: #f9fafb !important;
}

.post-content h1:first-child,
.post-content h2:first-child,
.post-content h3:first-child,
.post-content h4:first-child,
.post-content h5:first-child,
.post-content h6:first-child {
  margin-top: 0 !important;
}

.post-content strong {
  font-weight: 600 !important;
  color: #111827 !important;
}

.dark .post-content strong {
  color: #f9fafb !important;
}

.post-content em,
.post-content i {
  font-style: italic !important;
  color: #374151 !important;
}

.dark .post-content em,
.dark .post-content i {
  color: #d1d5db !important;
}

.post-content a {
  color: #2d8f8f !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  transition: all 0.2s ease-in-out !important;
}

.dark .post-content a {
  color: #4aacac !important;
}

.post-content a:hover {
  color: #1e6b6b !important;
  text-decoration: underline !important;
  text-underline-offset: 2px !important;
}

.dark .post-content a:hover {
  color: #5fc5c5 !important;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1rem !important;
  margin-left: 1.5rem !important;
  padding-left: 0 !important;
}

.post-content ul {
  list-style-type: disc !important;
}

.post-content ol {
  list-style-type: decimal !important;
}

.post-content li {
  margin-bottom: 0.5rem !important;
  color: #374151 !important;
  line-height: 1.75 !important;
  font-size: 0.9375rem !important;
}

.dark .post-content li {
  color: #d1d5db !important;
}

.post-content blockquote {
  border-left: 4px solid #2d8f8f !important;
  padding-left: 1rem !important;
  font-style: italic !important;
  margin: 1rem 0 !important;
  color: #4b5563 !important;
}

.dark .post-content blockquote {
  border-left-color: #4aacac !important;
  color: #9ca3af !important;
}

.post-content code {
  background-color: #f3f4f6 !important;
  color: #dc2626 !important;
  padding: 0.125rem 0.375rem !important;
  border-radius: 0.25rem !important;
  font-family: 'JetBrains Mono', 'Courier New', monospace !important;
  font-size: 0.875rem !important;
}

.dark .post-content code {
  background-color: #1f2937 !important;
  color: #fca5a5 !important;
}

.post-content pre {
  background-color: #f3f4f6 !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 0.5rem !important;
  padding: 1rem !important;
  overflow-x: auto !important;
  margin: 1rem 0 !important;
  font-family: 'JetBrains Mono', 'Courier New', monospace !important;
  font-size: 0.875rem !important;
}

.dark .post-content pre {
  background-color: #1f2937 !important;
  border-color: #374151 !important;
}

.post-content pre code {
  background-color: transparent !important;
  padding: 0 !important;
  color: #111827 !important;
}

.dark .post-content pre code {
  color: #f9fafb !important;
}

.post-content hr {
  border-color: #e5e7eb !important;
  margin: 1.5rem 0 !important;
  border-width: 1px !important;
  border-style: solid !important;
}

.dark .post-content hr {
  border-color: #374151 !important;
}

.post-content img {
  border-radius: 0.5rem !important;
  margin: 1rem 0 !important;
  max-width: 100% !important;
  height: auto !important;
}

.post-content table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 1rem 0 !important;
}

.post-content table th,
.post-content table td {
  border: 1px solid #e5e7eb !important;
  padding: 0.5rem 1rem !important;
  font-size: 0.875rem !important;
}

.dark .post-content table th,
.dark .post-content table td {
  border-color: #374151 !important;
}

.post-content table th {
  background-color: #f3f4f6 !important;
  font-weight: 600 !important;
  color: #111827 !important;
}

.dark .post-content table th {
  background-color: #1f2937 !important;
  color: #f9fafb !important;
}

.post-content table td {
  color: #374151 !important;
}

.dark .post-content table td {
  color: #d1d5db !important;
}

/* Toggle Switch Styles */
.toggle-switch {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch-track {
  width: 3.5rem;
  height: 1.75rem;
  background-color: #d1d5db;
  border-radius: 9999px;
  transition: background-color 0.2s ease-in-out;
  position: relative;
}

.dark .toggle-switch-track {
  background-color: #4b5563;
}

.toggle-switch-thumb {
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 1.5rem;
  height: 1.5rem;
  background-color: #ffffff;
  border-radius: 9999px;
  transition: transform 0.2s ease-in-out;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.dark .toggle-switch-thumb {
  background-color: #f9fafb;
}

.toggle-switch:checked ~ .relative .toggle-switch-track {
  background-color: #2d8f8f;
}

.dark .toggle-switch:checked ~ .relative .toggle-switch-track {
  background-color: #1e6b6b;
}

.toggle-switch:checked ~ .relative .toggle-switch-thumb {
  transform: translateX(1.75rem);
}

.toggle-switch:focus ~ .relative .toggle-switch-track {
  outline: 2px solid #2d8f8f;
  outline-offset: 2px;
}

.toggle-switch:disabled ~ .relative .toggle-switch-track {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Related Topics Slider Styles */
.related-topic-card {
  min-width: 0;
}

.related-topics-nav-btn {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  color: #374151;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
}

.related-topics-nav-btn:hover:not(:disabled) {
  background-color: #f9fafb;
  border-color: #2563eb;
  color: #2563eb;
}

.related-topics-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.related-topics-nav-btn:disabled:hover {
  background-color: #ffffff;
  border-color: #d1d5db;
  color: #374151;
}

/* Cookie Consent Banner Styles */
.cookie-banner-hidden {
  transform: translateX(100%);
  opacity: 0;
}

.cookie-banner-visible {
  transform: translateX(0);
  opacity: 1;
}

@media (max-width: 640px) {
  .cookie-banner-hidden {
    transform: translateY(100%);
  }
}
.rounded-none {
  border-radius: 0 !important;
}
