/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 40px;
  color: white;
  position: relative;
}

header h1 {
  font-size: 3rem;
  margin-bottom: 5px;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  font-weight: 900;
  letter-spacing: 3px;
}

.brand-tagline {
  font-size: 1.2rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 15px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.95;
  max-width: 600px;
  margin: 0 auto;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 20px;
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

/* Main content */
main {
  flex: 1;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
}

main::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    #667eea,
    #764ba2,
    #f093fb,
    #f5576c,
    #4facfe
  );
  background-size: 300% 100%;
  animation: borderGlow 3s ease infinite;
}

@keyframes borderGlow {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Search section */
.search-section {
  margin-bottom: 30px;
}

.search-form {
  max-width: 600px;
  margin: 0 auto;
}

.input-group {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

#searchInput {
  flex: 1;
  padding: 16px 20px;
  border: 2px solid rgba(102, 126, 234, 0.3);
  border-radius: 15px;
  font-size: 16px;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  color: #333;
}

#searchInput:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2),
    0 4px 20px rgba(102, 126, 234, 0.3);
  background: rgba(255, 255, 255, 1);
  transform: translateY(-1px);
}

#searchBtn {
  padding: 16px 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  color: white;
  border: none;
  border-radius: 15px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  min-width: 120px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3),
    0 0 20px rgba(118, 75, 162, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

#searchBtn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4),
    0 0 30px rgba(118, 75, 162, 0.3);
  filter: brightness(1.1);
}

#searchBtn:active {
  transform: translateY(-1px);
}

#searchBtn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

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

.btn-text {
  display: inline;
}

#searchBtn.loading .btn-text {
  opacity: 0;
}

#searchBtn.loading .spinner {
  display: block;
}

.search-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
  color: #666;
  margin-top: 10px;
}

.basic-options {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.basic-options select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
}

.wildcard-options {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(102, 126, 234, 0.2);
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.wildcard-options::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    #667eea,
    #764ba2,
    transparent
  );
}

.wildcard-options h4 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 1.1rem;
  font-weight: 700;
  text-shadow: none;
}

.checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
  font-size: 0.9rem;
}

.checkbox-label:hover {
  background: rgba(102, 126, 234, 0.1);
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(102, 126, 234, 0.4);
  border-radius: 6px;
  position: relative;
  transition: all 0.3s ease;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-color: #667eea;
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3),
    0 0 15px rgba(118, 75, 162, 0.2);
  transform: scale(1.05);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Similarity Controls */
.similarity-controls {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 12px;
  padding: 20px;
  margin-top: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  position: relative;
}

.similarity-controls::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    #667eea,
    #764ba2,
    transparent
  );
}

.slider-label {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-weight: 500;
  color: #374151;
}

.slider-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.similarity-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #d1d5db;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.similarity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4),
    0 0 20px rgba(118, 75, 162, 0.3);
  transition: all 0.3s ease;
  border: 2px solid white;
}

.similarity-slider::-webkit-slider-thumb:hover {
  background: linear-gradient(135deg, #5a6fd8, #6a4c93);
  transform: scale(1.15);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5),
    0 0 25px rgba(118, 75, 162, 0.4);
}

.similarity-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4),
    0 0 20px rgba(118, 75, 162, 0.3);
  transition: all 0.3s ease;
}

.similarity-slider::-moz-range-thumb:hover {
  background: linear-gradient(135deg, #5a6fd8, #6a4c93);
  transform: scale(1.15);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5),
    0 0 25px rgba(118, 75, 162, 0.4);
}

.slider-values {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #6b7280;
}

.slider-value {
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #667eea, #764ba2);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3),
    0 0 15px rgba(118, 75, 162, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  min-width: 50px;
  text-align: center;
}

/* Error message */
.error-message {
  background: linear-gradient(
    135deg,
    rgba(255, 107, 107, 0.1),
    rgba(255, 159, 243, 0.1)
  );
  color: #d63384;
  padding: 20px;
  border-radius: 15px;
  border: 1px solid rgba(255, 107, 107, 0.3);
  margin-bottom: 25px;
  text-align: center;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.2),
    0 0 20px rgba(255, 159, 243, 0.1);
  backdrop-filter: blur(10px);
  position: relative;
}

.error-message::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #ff6b6b, #ff9ff3);
  border-radius: 15px 15px 0 0;
}

/* Results section */
.results-section {
  margin-top: 30px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 20px;
}

.results-info {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination button {
  padding: 10px 20px;
  border: 1px solid rgba(102, 126, 234, 0.3);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.7)
  );
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  color: #333;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pagination button:hover:not(:disabled) {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3),
    0 0 20px rgba(118, 75, 162, 0.2);
  border-color: rgba(102, 126, 234, 0.5);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Results container */
.results-container {
  display: grid;
  gap: 20px;
}

.trademark-card {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.95),
    rgba(255, 255, 255, 0.85)
  );
  border: 1px solid rgba(102, 126, 234, 0.2);
  border-radius: 20px;
  padding: 25px;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.trademark-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #f5576c);
  background-size: 300% 100%;
  animation: cardBorderFlow 4s ease infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

@keyframes cardBorderFlow {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.trademark-card:hover {
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.15),
    0 4px 20px rgba(118, 75, 162, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1);
  transform: translateY(-5px) scale(1.02);
  border-color: rgba(102, 126, 234, 0.4);
}

.trademark-card:hover::before {
  opacity: 1;
}

/* Trademark Images */
.trademark-image-container {
  position: relative;
  width: 100%;
  height: 150px;
  background: #f8f9fa;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trademark-thumbnail {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: pointer;
}

.trademark-image-container:hover .image-overlay {
  opacity: 1;
}

.trademark-image-container:hover .trademark-thumbnail {
  transform: scale(1.05);
}

.zoom-icon {
  font-size: 2rem;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.trademark-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.header-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.trademark-name {
  font-size: 1.3rem;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.application-number {
  font-size: 0.9rem;
  color: #666;
  font-family: "Courier New", monospace;
}

.similarity-score {
  font-size: 0.8rem;
  background: linear-gradient(135deg, #feca57, #ff9ff3);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 700;
  cursor: help;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  box-shadow: 0 2px 8px rgba(254, 202, 87, 0.3),
    0 0 15px rgba(255, 159, 243, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.find-threats-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.find-threats-btn:hover {
  background: linear-gradient(135deg, #f97316, #ea580c);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.4);
}

.trademark-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-weight: 600;
  color: #333;
}

.status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status.registered {
  background: #d4edda;
  color: #155724;
}

.status.pending {
  background: #fff3cd;
  color: #856404;
}

.status.refused {
  background: #f8d7da;
  color: #721c24;
}

.nice-classes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.nice-class {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 6px 12px;
  border-radius: 15px;
  font-size: 0.75rem;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3),
    0 0 12px rgba(118, 75, 162, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.nice-class:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(102, 126, 234, 0.4),
    0 0 16px rgba(118, 75, 162, 0.3);
}

/* Modal */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  width: 100%;
}

.close {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #aaa;
  transition: color 0.2s;
}

.close:hover {
  color: #333;
}

/* Image Modal Styles */
.image-modal-content {
  text-align: center;
}

.image-modal-content h2 {
  margin-bottom: 20px;
  color: #333;
}

.image-loading {
  padding: 40px;
  color: #666;
  font-style: italic;
}

.trademark-full-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Footer */
footer {
  text-align: center;
  margin-top: 40px;
  padding: 20px 0;
  color: rgba(255, 255, 255, 0.8);
}

footer a {
  color: white;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  main {
    padding: 20px;
  }

  header h1 {
    font-size: 2rem;
  }

  .input-group {
    flex-direction: column;
  }

  .results-header {
    flex-direction: column;
    align-items: stretch;
  }

  .trademark-details {
    grid-template-columns: 1fr;
  }

  .modal-content {
    padding: 20px;
    margin: 10px;
  }

  .checkbox-group {
    grid-template-columns: 1fr;
  }

  .basic-options {
    flex-direction: column;
    text-align: center;
  }
}

/* Loading state */
.loading-placeholder {
  text-align: center;
  padding: 40px;
  color: #666;
}

.loading-placeholder::after {
  content: "";
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-top: 20px;
}
