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

:root {
  --bg-color: #0f172a;
  --surface-color: rgba(30, 41, 59, 0.7);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(15, 23, 42, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --danger-color: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 25%);
  background-attachment: fixed;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(to right, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.025em;
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

.stats-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
}

.stat-card h3 {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-card p {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  background: linear-gradient(to right, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.controls-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

input[type="text"], input[type="file"] {
  flex-grow: 1;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease;
}

input[type="text"]:focus {
  border-color: var(--accent-color);
}

button {
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

button:hover {
  background-color: var(--accent-hover);
  transform: scale(1.02);
}

button:active {
  transform: scale(0.98);
}

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

.face-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.3s ease;
}

.face-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.face-item:hover img {
  transform: scale(1.05);
}

.face-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  padding: 1rem 0.5rem 0.5rem;
  font-size: 0.875rem;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.face-item:hover .face-info {
  opacity: 1;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pending { background-color: rgba(234, 179, 8, 0.2); color: #facc15; }
.status-scraping { background-color: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.status-done { background-color: rgba(34, 197, 94, 0.2); color: #4ade80; }
.status-error { background-color: rgba(239, 68, 68, 0.2); color: #f87171; }

.website-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.website-list::-webkit-scrollbar {
  width: 6px;
}
.website-list::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.website-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

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

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

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-color);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

.modal-close:hover {
  color: var(--text-primary);
}

#modal-image {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
}

/* Navigation Styles */
.nav-btn {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.nav-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

/* Scraper Tab Selector Styles */
.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  padding: 0.35rem 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Smart Finder Styles */
#smart-extracted-section th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--glass-border);
}

#smart-extracted-section td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
  padding: 8px;
}

#smart-extracted-section tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.smart-item-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-color);
}

/* Multi-face search bounding boxes and preview elements */
.query-bbox-overlay {
  position: absolute;
  border: 2px solid var(--accent-color);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  z-index: 10;
}

.query-bbox-overlay:hover, .query-bbox-overlay.active {
  border-color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.8);
  background-color: rgba(16, 185, 129, 0.15);
}

.query-bbox-overlay-label {
  position: absolute;
  top: -22px;
  left: -2px;
  background-color: var(--accent-color);
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px 4px 0 0;
  white-space: nowrap;
  transition: background-color 0.2s;
}

.query-bbox-overlay:hover .query-bbox-overlay-label, .query-bbox-overlay.active .query-bbox-overlay-label {
  background-color: #10b981;
}

.query-face-row {
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(30, 41, 59, 0.3);
  padding: 1.5rem;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.query-face-row:hover {
  border-color: rgba(59, 130, 246, 0.3);
}
