/* Modern Face Recognition Demo Styles */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #2d3748;
  line-height: 1.6;
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #2d3748;
}

.logo {
  font-size: 2rem;
}

.badge {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.header-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Main Layout */
.app-main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 2rem;
}

/* Camera Section */
.camera-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.camera-container {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.video-wrapper {
  position: relative;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #1a202c;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.camera-overlay-info {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.camera-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.model-select {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: #4a5568;
  min-width: 200px;
}

/* Action Cards */
.action-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.action-card {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.card-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #2d3748;
}

.card-header p {
  color: #718096;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.card-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Results Section */
.results-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.results-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.results-panel, .preview-panel {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.results-panel h3, .preview-panel h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #2d3748;
}

.metrics-display {
  background: #f7fafc;
  border-radius: 0.75rem;
  padding: 1rem;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  min-height: 200px;
  white-space: pre-wrap;
  color: #4a5568;
  overflow-y: auto;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #68d391;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.face-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

#crop {
  border: 2px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #f7fafc;
}

.preview-info {
  font-size: 0.875rem;
  color: #718096;
}

/* Database Section */
.database-section {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.database-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.database-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #2d3748;
}

.database-actions {
  display: flex;
  gap: 0.5rem;
}

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

.person-card {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.person-card:hover {
  border-color: #667eea;
  transform: translateY(-1px);
}

.person-card .name {
  font-weight: 600;
  color: #2d3748;
}

.person-card .muted {
  font-size: 0.75rem;
  color: #718096;
}

.person-card button {
  align-self: flex-start;
}

.model-badge {
  font-size: 0.625rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-weight: 600;
  text-transform: uppercase;
  background: #667eea;
  color: white;
}

.model-badge.unknown {
  background: #cbd5e0;
  color: #4a5568;
}

/* Enrollment Mode Selector */
.enroll-mode-selector {
  margin-bottom: 1.5rem;
}

.mode-tabs {
  display: flex;
  background: #f7fafc;
  border-radius: 0.5rem;
  padding: 0.25rem;
  gap: 0.25rem;
}

.mode-tab {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  color: #4a5568;
}

.mode-tab.active {
  background: white;
  color: #667eea;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mode-tab:hover:not(.active) {
  color: #2d3748;
}

/* Upload Area */
.upload-area {
  border: 2px dashed #cbd5e0;
  border-radius: 0.75rem;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #f7fafc;
}

.upload-area:hover {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.05);
}

.upload-area.dragover {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.1);
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.upload-icon {
  font-size: 2rem;
  opacity: 0.7;
}

.upload-content p {
  font-weight: 500;
  color: #4a5568;
  margin: 0;
}

.upload-content small {
  color: #718096;
  font-size: 0.75rem;
}

/* Upload Preview */
.upload-preview {
  margin-top: 1rem;
  text-align: center;
}

.preview-image {
  max-width: 100%;
  max-height: 200px;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.preview-info {
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: #f7fafc;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  color: #4a5568;
}

.mode-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Form Elements */
.form-input, .form-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: border-color 0.2s ease;
  background: #f7fafc;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: #667eea;
  background: white;
}

.form-input-small {
  padding: 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  width: 80px;
  background: #f7fafc;
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.875rem;
  color: #4a5568;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #718096;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #4a5568;
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #48bb78, #38a169);
  color: white;
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

.btn-outline {
  background: transparent;
  color: #667eea;
  border: 1px solid #667eea;
}

.btn-outline:hover:not(:disabled) {
  background: #667eea;
  color: white;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  background: #e2e8f0;
  color: #4a5568;
}

.btn-small:hover:not(:disabled) {
  background: #cbd5e0;
}

.btn-icon {
  font-size: 1rem;
}

.button-group {
  display: flex;
  gap: 0.75rem;
}

/* Toggle Switch */
.toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: #4a5568;
}

.toggle input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background: #cbd5e0;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.toggle input:checked + .toggle-slider {
  background: #667eea;
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Advanced Settings */
.advanced-settings {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  margin: 2rem;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.settings-toggle {
  width: 100%;
  padding: 1rem 1.5rem;
  background: transparent;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.settings-toggle:hover {
  background: rgba(102, 126, 234, 0.1);
}

.settings-content {
  padding: 1.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.settings-row {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .app-main {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
  
  .action-cards {
    grid-template-columns: 1fr;
  }
  
  .results-container {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  .results-container {
    grid-template-columns: 1fr;
  }
  
  .button-group {
    flex-direction: column;
  }
  
  .form-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}