/*
 * O.Translator Tools - Base Styles (Media-Query Aware)
 * ---------------------------------------------------------
 */

/* 1. Global Styles (Light Theme Default) */
body {
  background-color: #f9fafb; /* gray-50 */
  font-family: "Inter", sans-serif;
  color: #1f2937; /* gray-800 */
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* 2. Content Section Components (Light Theme) */
.content-section {
  max-width: 64rem; /* 1024px */
  margin-left: auto;
  margin-right: auto;
  margin-top: 4rem; /* 64px */
  background-color: #ffffff;
  border: 1px solid #e5e7eb; /* gray-200 */
  border-radius: 1rem; /* 16px */
  padding: 2.5rem; /* 40px */
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.section-title {
  font-size: 2.25rem; /* 36px */
  line-height: 2.5rem; /* 40px */
  font-weight: 700;
  color: #111827; /* gray-900 */
  text-align: center;
  margin-bottom: 3rem; /* 48px */
}

.feature-card {
  background-color: #f9fafb; /* gray-50 */
  border: 1px solid #e5e7eb; /* gray-200 */
  border-radius: 0.75rem; /* 12px */
  padding: 1.5rem; /* 24px */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}
.feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 4rem;
  width: 4rem;
  border-radius: 9999px;
  background-color: #e0e7ff; /* indigo-100 */
  color: #4f46e5; /* indigo-600 */
  margin: 0 auto 1.5rem;
  font-weight: 700;
  font-size: 1.5rem;
  border: 2px solid #c7d2fe; /* indigo-200 */
}
.feature-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937; /* gray-800 */
  margin-bottom: 0.5rem;
}
.feature-description {
  color: #6b7280; /* gray-500 */
}

.feature-highlight-card {
  display: flex;
  align-items: flex-start;
  padding: 1.5rem;
}
.feature-highlight-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 3rem;
  width: 3rem;
  border-radius: 9999px;
  background-color: #d1fae5; /* green-100 */
  color: #059669; /* green-600 */
  border: 1px solid #a7f3d0; /* green-200 */
}
.feature-highlight-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1f2937; /* gray-800 */
}
.feature-highlight-description {
  margin-top: 0.5rem;
  color: #6b7280; /* gray-500 */
}

.faq-item details {
  background-color: #f9fafb; /* gray-50 */
  border: 1px solid #e5e7eb; /* gray-200 */
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}
.faq-question {
  padding: 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style-type: none;
  display: flex;
  justify-content: space-between;
  color: #1f2937; /* gray-800 */
}
.faq-answer {
  padding: 0 1rem 1rem;
  border-top: 1px solid #e5e7eb; /* gray-200 */
  color: #6b7280; /* gray-500 */
}
.faq-answer p {
  padding-top: 1rem;
}

.link-card {
  background-color: #f9fafb; /* gray-50 */
  border: 1px solid #e5e7eb; /* gray-200 */
  border-radius: 0.75rem;
  padding: 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.link-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
  border-color: #93c5fd; /* blue-300 */
}
.link-card-title {
  font-weight: 700;
  color: #3b82f6; /* blue-500 */
}
.link-card:hover .link-card-title {
  color: #2563eb; /* blue-600 */
}
.link-card-description {
  font-size: 0.875rem;
  color: #6b7280; /* gray-500 */
  margin-top: 0.5rem;
}

/*
 * Dark Theme Overrides
 * -----------------------------------------
 */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #0d1117;
    color: #c9d1d9;
  }
  .content-section {
    background: linear-gradient(145deg, rgba(22, 27, 34, 0.6), rgba(13, 17, 23, 0.4));
    border-color: #30363d;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
  }
  .content-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #30a8ff, transparent);
    animation: beam-animation 5s linear infinite;
  }
  .section-title {
    color: #ffffff;
    text-shadow: 0 0 8px rgba(52, 152, 219, 0.5);
  }
  .feature-card {
    background-color: rgba(34, 41, 51, 0.5);
    border-color: #30363d;
  }
  .feature-card:hover {
    box-shadow: 0 8px 25px rgba(48, 168, 255, 0.15);
    border-color: #30a8ff;
  }
  .feature-icon {
    background-color: rgba(30, 58, 138, 0.5);
    color: #93c5fd;
    border-color: #1d4ed8;
  }
  .feature-title {
    color: #ffffff;
  }
  .feature-description {
    color: #9ca3af;
  }
  .feature-highlight-card {
    background-color: transparent;
  }
  .feature-highlight-icon {
    background-color: rgba(20, 83, 45, 0.5);
    color: #4ade80;
    border-color: #15803d;
  }
  .feature-highlight-title {
    color: #ffffff;
  }
  .feature-highlight-description {
    color: #9ca3af;
  }
  .faq-item details {
    background-color: rgba(34, 41, 51, 0.5);
    border-color: #30363d;
  }
  .faq-question {
    color: #ffffff;
  }
  .faq-answer {
    border-color: #374151;
    color: #9ca3af;
  }
  .link-card {
    background-color: rgba(34, 41, 51, 0.5);
    border-color: #30363d;
  }
  .link-card:hover {
    box-shadow: 0 8px 25px rgba(48, 168, 255, 0.15);
    border-color: #30a8ff;
  }
  .link-card-title {
    color: #60a5fa;
  }
  .link-card:hover .link-card-title {
    color: #93c5fd;
  }
  .link-card-description {
    color: #9ca3af;
  }
}

/*
 * Tool-Specific Styles
 * -----------------------------------------
 */
.gradient-text {
  background-image: linear-gradient(to right, #a855f7, #34d399);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.gradient-button {
  background-image: linear-gradient(to right, #8b5cf6, #10b981);
  transition: all 0.3s ease;
}
.gradient-button:hover {
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
  transform: translateY(-2px);
}

/* Light theme secondary button */
.secondary-button {
  border: 1px solid #d1d5db; /* gray-300 */
  color: #374151; /* gray-700 */
  background-color: #ffffff;
  transition: all 0.3s ease;
}
.secondary-button:hover {
  background-color: #f9fafb; /* gray-50 */
  border-color: #9ca3af; /* gray-400 */
}
.secondary-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #f9fafb;
  border-color: #d1d5db;
}

.color-source.active-color-source {
  border-color: #a855f7;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.8);
}

.cropper-container-wrapper {
  height: 55vh;
  width: 100%;
  background-color: #f3f4f6; /* gray-100 */
  border-radius: 0.75rem;
  position: relative;
}
#image-to-crop {
  display: block;
  max-width: 100%;
}
.editor-canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#display-canvas,
#drawing-canvas {
  position: absolute;
  max-width: 100%;
  max-height: 100%;
  cursor: crosshair;
  touch-action: none;
}

#upload-section.drag-over {
  border-color: #8b5cf6;
  background-color: rgba(139, 92, 246, 0.1);
}

#toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
#toast.show {
  opacity: 1;
  visibility: visible;
}
.toast-error {
  background-color: #e74c3c;
  color: white;
}
.toast-info {
  background-color: #3498db;
  color: white;
}

.toggle-checkbox {
  background-color: #e5e7eb; /* gray-200 */
}
.toggle-checkbox:checked {
  right: 0;
  border-color: #8b5cf6;
  background-color: #f9fafb; /* gray-50 */
}
.toggle-checkbox:checked + .toggle-label {
  background-color: #8b5cf6;
}

.spinner {
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.checkerboard {
  background-image: linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
    linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

#magnifier {
  position: absolute;
  border: 3px solid #a855f7;
  border-radius: 50%;
  cursor: none;
  width: 120px;
  height: 120px;
  z-index: 1000;
  display: none;
  pointer-events: none;
  background-repeat: no-repeat;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
.preview-item-wrapper {
  position: relative;
  cursor: crosshair;
}
.preview-item-wrapper p {
  color: #6b7280; /* gray-500 */
}
.preview-item-wrapper img {
  border-radius: 4px;
}

/* Dark theme tool-specific overrides */
@media (prefers-color-scheme: dark) {
  .secondary-button {
    border-color: #4b5563;
    color: #d1d5db;
    background-color: transparent;
  }
  .secondary-button:hover {
    background-color: #374151;
    border-color: #6b7280;
  }
  .secondary-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: transparent;
    border-color: #4b5563;
  }
  .cropper-container-wrapper {
    background-color: #1f2937;
  }
  .toggle-checkbox {
    background-color: #4b5563;
  }
  .toggle-checkbox:checked {
    background-color: #374151;
  }
  .toggle-checkbox:checked + .toggle-label {
    background-color: #8b5cf6;
  }
  .checkerboard {
    background-image: linear-gradient(45deg, #374151 25%, transparent 25%),
      linear-gradient(-45deg, #374151 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, #374151 75%),
      linear-gradient(-45deg, transparent 75%, #374151 75%);
  }
  .preview-item-wrapper p {
    color: #9ca3af;
  }
  .preview-item-wrapper.bg-gray-900\/50 {
    background-color: rgba(17, 24, 39, 0.5);
  }
}

@keyframes beam-animation {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}