/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --secondary-color: #8b5cf6;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --bg-color: #0f172a;
  --bg-light: #1e293b;
  --bg-card: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: linear-gradient(135deg, var(--bg-color) 0%, #1a1f36 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Navbar */
.navbar {
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .container.navbar-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.logo-section {
  flex-shrink: 0;
}

.logo {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

.partnership-badge-header {
  flex: 1;
  display: flex;
  justify-content: center;
}

.partnership-badge-header .partnership-text {
  color: var(--text-primary);
  font-size: 0.9rem;
  margin: 0;
  padding: 0.5rem 1rem;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 0.75rem;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary-color);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary-color);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 2rem 0 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.safety-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--error-color) 0%, var(--warning-color) 100%);
  color: white;
  padding: 0.5rem 1.5rem;
  border-radius: 2rem;
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
  }
}

.hero-headline {
  font-size: 3rem;
  margin-bottom: 1rem;
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--error-color) 0%, var(--warning-color) 50%, var(--text-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subhead {
  color: var(--text-secondary);
  font-size: 1.25rem;
  line-height: 1.7;
  margin-bottom: 2rem;
}

.hero-subhead strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* Upload Section */
.upload-section {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 0;
}

/* Upload Tabs */
.upload-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  background: var(--bg-card);
  border-radius: 0.75rem;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 600;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--text-primary);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
}

.tab-btn svg {
  width: 20px;
  height: 20px;
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

.tab-info {
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid rgba(239, 68, 68, 0.3);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.tab-info.registry-info {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

.tab-info h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.tab-info p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.upload-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: 0.75rem;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(99, 102, 241, 0.05);
}

.upload-area:hover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
}

.upload-area.dragover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.15);
  transform: scale(1.02);
}

.upload-area svg {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.upload-area h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.upload-area p {
  color: var(--text-secondary);
}

.preview-area {
  position: relative;
  margin-bottom: 1.5rem;
}

.preview-area img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
}

.name-input-area {
  margin-bottom: 1.5rem;
}

.name-label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.name-input {
  width: 100%;
  padding: 0.875rem 1rem;
  background: rgba(30, 41, 59, 0.5);
  border: 2px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.name-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(30, 41, 59, 0.7);
}

.name-input::placeholder {
  color: var(--text-secondary);
}

.name-hint {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.info-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  background: rgba(30, 41, 59, 0.5);
  border: 2px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
  transition: all 0.3s ease;
}

.info-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(30, 41, 59, 0.7);
}

.info-textarea::placeholder {
  color: var(--text-secondary);
}

.btn-remove {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-remove:hover {
  background: var(--error-color);
  transform: scale(1.05);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  margin-top: 1.5rem;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.5);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-urgent {
  background: linear-gradient(135deg, var(--error-color) 0%, var(--warning-color) 100%);
  font-weight: 700;
  font-size: 1.125rem;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-urgent:hover:not(:disabled) {
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.6);
  transform: translateY(-3px);
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(99, 102, 241, 0.2);
  border-radius: 2px;
  margin-top: 1rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  width: 0%;
  transition: width 0.3s ease;
}

/* Results Section */
.results-section {
  margin-top: 2rem;
}

.results-section h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.result-success {
  border-left: 4px solid var(--success-color);
}

.result-info {
  border-left: 4px solid var(--primary-color);
}

.result-message {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.result-icon {
  font-size: 1.5rem;
}

.matches-list {
  margin-top: 1rem;
}

.match-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

.match-item img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 0.5rem;
}

/* Match Item with Photo */
.match-item-with-photo {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 59, 59, 0.1);
  border: 2px solid var(--error-color);
  border-radius: 0.75rem;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.match-item-with-photo:hover {
  background: rgba(255, 59, 59, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 59, 59, 0.2);
}

.match-photo {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 2px solid var(--error-color);
}

.match-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.match-details {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.match-info {
  flex: 1;
}

.match-name {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
  text-transform: capitalize;
}

.match-location {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0 0 0.5rem 0;
}

.match-filename {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

.match-confidence-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255, 59, 59, 0.2);
  border-radius: 0.5rem;
  min-width: 80px;
}

.match-confidence-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--error-color);
  line-height: 1;
}

.match-confidence-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.25rem;
}

.match-confidence {
  margin-left: auto;
  font-weight: 600;
  color: var(--success-color);
}

/* Info Section */
.info-section {
  padding: 3rem 0;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
}

.info-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.info-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.info-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.info-card p {
  color: var(--text-secondary);
}

/* Registry Section */
.registry-section {
  padding: 2rem 0;
  min-height: 50vh;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-state svg {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

/* Contribute Card */
.contribute-card {
  position: relative;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-section) 100%);
  border: 2px dashed var(--primary-color);
  border-radius: 0.75rem;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.3s ease;
  aspect-ratio: 1;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-primary);
}

.contribute-card:hover {
  transform: translateY(-5px);
  border-color: var(--secondary-color);
  box-shadow: 0 0 30px rgba(31, 107, 255, 0.3);
}

.contribute-icon {
  margin-bottom: 1rem;
  color: var(--primary-color);
  transition: all 0.3s ease;
}

.contribute-card:hover .contribute-icon {
  color: var(--secondary-color);
  transform: scale(1.1);
}

.contribute-card h4 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
}

.contribute-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0 0 1rem 0;
  line-height: 1.5;
}

.contribute-btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  background: var(--primary-color);
  color: white;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.3s ease;
}

.contribute-card:hover .contribute-btn {
  background: var(--secondary-color);
  box-shadow: 0 0 20px rgba(45, 226, 230, 0.4);
}

/* Registry Card Styles */
.registry-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.registry-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.registry-card-image {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
}

.registry-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.registry-card-content {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.registry-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  text-transform: capitalize;
  color: var(--text-primary);
}

.registry-location {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.registry-photo-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.registry-aliases {
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: rgba(31, 107, 255, 0.1);
  padding: 0.5rem;
  border-radius: 0.375rem;
  border-left: 3px solid var(--primary-color);
}

.registry-aliases strong {
  color: var(--text-primary);
  font-weight: 600;
}

.registry-details-section {
  margin-top: 0.5rem;
}

.btn-view-details {
  width: 100%;
  padding: 0.625rem 1rem;
  background: rgba(31, 107, 255, 0.1);
  border: 1px solid var(--primary-color);
  border-radius: 0.375rem;
  color: var(--primary-color);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-view-details:hover {
  background: rgba(31, 107, 255, 0.2);
  border-color: var(--secondary-color);
  color: var(--secondary-color);
}

.details-icon {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

.registry-details-content {
  margin-top: 0.75rem;
  padding: 0.875rem;
  background: rgba(13, 20, 32, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.registry-details-content p {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Legacy image card styles (kept for backwards compatibility) */
.image-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  overflow: hidden;
  transition: all 0.3s ease;
  aspect-ratio: 1;
}

.image-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.7), transparent);
  padding: 3rem 1rem 1rem;
  color: white;
}

.image-name {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  text-transform: capitalize;
  color: var(--text-primary);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.image-photo-number {
  font-size: 0.875rem;
  margin: 0.25rem 0 0;
  color: var(--text-secondary);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.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;
}

.image-card:hover .image-overlay {
  opacity: 1;
}

.btn-delete {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--error-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-delete:hover {
  background: #dc2626;
  transform: scale(1.05);
}

/* Footer */
footer {
  background: var(--bg-light);
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  text-align: center;
  margin-top: 4rem;
}

.partnership-badge {
  margin-bottom: 1rem;
  padding: 1rem;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 0.75rem;
  display: inline-block;
}

.partnership-text {
  color: var(--text-primary);
  font-size: 1rem;
  margin: 0;
}

.partnership-text a {
  color: var(--primary-color);
  text-decoration: none;
  transition: all 0.3s ease;
}

.partnership-text a:hover {
  color: var(--secondary-color);
  text-decoration: underline;
}

.partnership-text strong {
  font-weight: 700;
}

.copyright {
  color: var(--text-secondary);
  margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .navbar .container.navbar-flex {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .partnership-badge-header {
    order: -1;
    justify-content: center;
  }

  .partnership-badge-header .partnership-text {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
    text-align: center;
  }

  .logo-section {
    text-align: center;
  }

  .logo {
    font-size: 1.5rem;
  }

  .nav-links {
    gap: 1rem;
    justify-content: center;
  }

  .hero-headline {
    font-size: 2rem;
  }

  .hero-subhead {
    font-size: 1.125rem;
  }

  .safety-badge {
    font-size: 0.75rem;
    padding: 0.4rem 1rem;
  }

  .upload-card {
    padding: 1.5rem;
  }

  .upload-area {
    padding: 2rem 1rem;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
  }

  .upload-tabs {
    flex-direction: column;
    gap: 0.5rem;
  }

  .tab-btn {
    width: 100%;
  }

  /* Match items responsive */
  .match-item-with-photo {
    flex-direction: column;
    padding: 0.75rem;
  }

  .match-photo {
    width: 100%;
    height: 200px;
  }

  .match-details {
    flex-direction: column;
    align-items: stretch;
  }

  .match-confidence-badge {
    width: 100%;
  }

  .match-name {
    font-size: 1.125rem;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.upload-card,
.result-card,
.info-card,
.image-card {
  animation: fadeIn 0.5s ease-out;
}
