/* ================= GLOBAL STYLES ================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fafafa;
  color: #1a1a1a;
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
}

/* ========== HEADER ========== */
.header {
  background: #ffffff;
  border-bottom: 1px solid #e0e0e0;
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  color: #000;
  text-decoration: none;
  letter-spacing: -0.5px;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo:hover {
  transform: scale(1.02);
}

.logo-icon {
  font-size: 22px;
}

.logo-text {
  font-weight: 900;
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav-link {
  color: #666;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  padding: 4px 0;
}

.nav-link:hover {
  color: #000;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: #10b981;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover::after {
  width: 100%;
}

.github-link {
  background: #000;
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 6px;
}

.github-link:hover {
  background: #333;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ========== HERO SECTION ========== */
.hero-container {
  max-width: 100%;
  height: calc(100vh - 56px);
  margin: 0 auto;
  padding: 24px 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
  overflow: hidden;
}

.hero-content {
  max-width: 540px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.badge {
  display: inline-block;
  padding: 6px 12px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 12px;
  margin-bottom: 16px;
  letter-spacing: 1px;
  text-transform: uppercase;
  width: fit-content;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.hero-title {
  font-size: 42px;
  font-weight: 900;
  color: #000;
  line-height: 1;
  margin-bottom: 16px;
  letter-spacing: -2px;
}

.hero-subtitle {
  font-size: 16px;
  color: #333;
  line-height: 1.4;
  margin-bottom: 10px;
  font-weight: 700;
}

.hero-description {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 20px;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.feature-item {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: #333;
  font-weight: 600;
  padding: 6px 0;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-item:hover {
  transform: translateX(4px);
}

.feature-icon {
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
  font-weight: bold;
  margin-right: 10px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.performance-note {
  font-size: 11px;
  color: #666;
  font-style: italic;
  padding: 10px 12px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-left: 3px solid #10b981;
  border-radius: 6px;
  line-height: 1.5;
}

/* ========== UPLOAD SECTION ========== */
.upload-section {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  border: 1px solid #e0e0e0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  height: fit-content;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.upload-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.upload-header {
  text-align: center;
  margin-bottom: 20px;
}

.upload-header h2 {
  font-size: 20px;
  font-weight: 900;
  color: #000;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.upload-header p {
  font-size: 12px;
  color: #666;
  font-weight: 500;
}

/* ========== DIVIDER ========== */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: #999;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e0e0e0;
}

.divider span {
  padding: 0 12px;
}

/* ========== UPLOAD AREA ========== */
.upload-area {
  border: 2px dashed #d0d0d0;
  border-radius: 8px;
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: #fafafa;
  margin-bottom: 16px;
  position: relative;
}

.upload-area:hover {
  background: #f0fdf4;
  border-color: #10b981;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.upload-area.has-files {
  background: #f0fdf4;
  border-color: #10b981;
  border-style: solid;
}

.upload-icon {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.9;
}

.upload-text {
  font-size: 14px;
  font-weight: 700;
  color: #000;
  margin-bottom: 4px;
}

.upload-hint {
  font-size: 12px;
  color: #666;
  font-weight: 500;
}

.file-count {
  font-size: 12px;
  color: #10b981;
  font-weight: 700;
  margin-top: 10px;
  padding: 6px 12px;
  background: #f0fdf4;
  border: 1px solid #10b981;
  border-radius: 6px;
  display: inline-block;
}

#fileInput {
  display: none;
}

/* ========== BUTTONS ========== */
.button-group {
  display: flex;
  gap: 8px;
}

.btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-secondary {
  background: #fff;
  color: #555;
  border: 1px solid #d0d0d0;
}

.btn-secondary:hover {
  background: #f5f5f5;
  border-color: #bbb;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.demo-btn {
  width: 100%;
  margin-bottom: 0;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  color: #374151;
  border: 1px solid #d1d5db;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.demo-btn:hover {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border-color: #9ca3af;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ========== DEMO IMAGES MODAL ========== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
  opacity: 1;
}

.modal-container {
  background: white;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-header {
  padding: 20px 28px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to bottom, #ffffff 0%, #fafafa 100%);
  border-radius: 12px 12px 0 0;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 900;
  color: #000;
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

.modal-close {
  background: #fff;
  border: 1px solid #e5e7eb;
  font-size: 20px;
  color: #9ca3af;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1;
  font-weight: 700;
}

.modal-close:hover {
  background: #f3f4f6;
  color: #374151;
  transform: rotate(90deg);
}

.modal-controls {
  padding: 14px 28px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fafafa;
}

.control-btn {
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.control-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.selection-count {
  margin-left: auto;
  font-size: 11px;
  color: #6b7280;
  font-weight: 700;
  padding: 6px 12px;
  background: white;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.modal-body {
  padding: 20px 28px;
  overflow-y: auto;
  flex: 1;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.demo-image-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: #fff;
  aspect-ratio: 1;
}

.demo-image-item:hover {
  border-color: #10b981;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.demo-image-item.selected {
  border-color: #10b981;
  background: #f0fdf4;
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.25);
}

.demo-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.demo-checkbox {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  background: white;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  z-index: 10;
}

.demo-image-item.selected .demo-checkbox {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #10b981;
  transform: scale(1.05);
}

.demo-checkbox::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.2s;
}

.demo-image-item.selected .demo-checkbox::after {
  opacity: 1;
}

.demo-image-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 6px;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  z-index: 5;
  letter-spacing: 0.3px;
}

.modal-footer {
  padding: 18px 28px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  background: linear-gradient(to top, #fafafa 0%, #ffffff 100%);
  border-radius: 0 0 12px 12px;
}

.modal-footer .btn {
  flex: 1;
}

/* ========== LOADING & ERROR STATES ========== */
.loading-state {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: #10b981;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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

.error-state {
  text-align: center;
  padding: 40px 20px;
  color: #ef4444;
  font-weight: 600;
}

/* ========== PROCESSING OVERLAY ========== */
.processing-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.processing-content {
  background: white;
  padding: 40px 50px;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  text-align: center;
  max-width: 450px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.processing-icon {
  margin-bottom: 16px;
}

.processing-icon svg {
  color: #10b981;
  animation: rotate 1.5s linear infinite;
}

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

.processing-content h3 {
  font-size: 20px;
  font-weight: 900;
  color: #000;
  margin-bottom: 20px;
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

.progress-container {
  width: 100%;
  background: #f0f0f0;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  height: 10px;
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #059669 50%, #10b981 100%);
  background-size: 200% 100%;
  width: 0%;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: shimmer 2s linear infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.processing-text {
  font-size: 13px;
  color: #666;
  font-weight: 600;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .hero-container {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 16px 20px;
    height: auto;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }
  
  .hero-content {
    max-width: 100%;
  }
  
  .hero-title {
    font-size: 32px;
    letter-spacing: -1.5px;
  }
  
  .hero-subtitle {
    font-size: 15px;
  }
  
  .hero-description {
    font-size: 13px;
  }
  
  .header {
    padding: 0 20px;
  }
  
  .upload-section {
    padding: 20px;
    max-height: none;
    overflow-y: visible;
  }
  
  .demo-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  
  .badge {
    font-size: 9px;
    padding: 5px 10px;
  }
  
  .feature-list {
    gap: 6px;
    margin-bottom: 20px;
  }
  
  .feature-item {
    font-size: 12px;
  }
  
  .performance-note {
    font-size: 10px;
    padding: 8px 10px;
  }
}

@media (max-width: 640px) {
  body {
    overflow: auto;
    height: auto;
  }
  
  .hero-container {
    grid-template-columns: 1fr;
    padding: 12px 16px;
    gap: 16px;
    height: auto;
    overflow-y: visible;
  }
  
  .hero-title {
    font-size: 26px;
    letter-spacing: -1px;
    margin-bottom: 12px;
  }
  
  .hero-subtitle {
    font-size: 14px;
    margin-bottom: 8px;
  }
  
  .hero-description {
    font-size: 12px;
    margin-bottom: 16px;
  }
  
  .header {
    padding: 0 12px;
    height: 52px;
  }
  
  .logo {
    font-size: 16px;
  }
  
  .logo-icon {
    font-size: 20px;
  }
  
  .nav-links {
    gap: 8px;
  }
  
  .nav-link {
    font-size: 12px;
  }
  
  .github-link {
    padding: 6px 10px;
    font-size: 11px;
  }
  
  .github-link span {
    display: none;
  }
  
  .upload-section {
    padding: 16px;
    max-height: none;
    overflow-y: visible;
  }
  
  .upload-header h2 {
    font-size: 18px;
  }
  
  .upload-header p {
    font-size: 11px;
  }
  
  .upload-area {
    padding: 28px 16px;
  }
  
  .upload-icon {
    font-size: 32px;
    margin-bottom: 8px;
  }
  
  .upload-text {
    font-size: 13px;
  }
  
  .upload-hint {
    font-size: 11px;
  }
  
  .file-count {
    font-size: 11px;
    padding: 5px 10px;
  }
  
  .btn {
    padding: 10px 16px;
    font-size: 12px;
    letter-spacing: 0.3px;
  }
  
  .button-group {
    flex-direction: column;
    gap: 6px;
  }
  
  .divider {
    margin: 12px 0;
    font-size: 10px;
  }
  
  .badge {
    font-size: 8px;
    padding: 4px 8px;
    margin-bottom: 12px;
  }
  
  .feature-list {
    gap: 5px;
    margin-bottom: 16px;
  }
  
  .feature-item {
    font-size: 11px;
    padding: 4px 0;
  }
  
  .feature-icon {
    width: 16px;
    height: 16px;
    font-size: 9px;
    margin-right: 8px;
  }
  
  .performance-note {
    font-size: 9px;
    padding: 8px 10px;
  }
  
  /* Modal adjustments */
  .modal-container {
    width: 95%;
    max-width: 95%;
    max-height: 90vh;
    border-radius: 8px;
  }
  
  .modal-header {
    padding: 14px 16px;
    border-radius: 8px 8px 0 0;
  }
  
  .modal-header h3 {
    font-size: 14px;
  }
  
  .modal-close {
    width: 28px;
    height: 28px;
    font-size: 18px;
  }
  
  .modal-controls {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .control-btn {
    padding: 6px 10px;
    font-size: 10px;
  }
  
  .selection-count {
    width: 100%;
    margin-left: 0;
    margin-top: 6px;
    font-size: 10px;
    padding: 5px 10px;
  }
  
  .modal-body {
    padding: 12px 16px;
  }
  
  .demo-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }
  
  .demo-image-item {
    border-radius: 6px;
  }
  
  .demo-checkbox {
    width: 20px;
    height: 20px;
    top: 4px;
    right: 4px;
  }
  
  .demo-checkbox::after {
    font-size: 12px;
  }
  
  .demo-image-name {
    font-size: 9px;
    padding: 6px 4px;
  }
  
  .modal-footer {
    padding: 12px 16px;
    gap: 6px;
    border-radius: 0 0 8px 8px;
  }
  
  /* Processing overlay */
  .processing-content {
    padding: 24px 28px;
    max-width: 90%;
    border-radius: 8px;
  }
  
  .processing-content h3 {
    font-size: 16px;
    margin-bottom: 16px;
  }
  
  .progress-container {
    height: 8px;
    margin-bottom: 10px;
  }
  
  .processing-text {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 22px;
  }
  
  .hero-subtitle {
    font-size: 13px;
  }
  
  .hero-description {
    font-size: 11px;
  }
  
  .demo-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
  }
  
  .modal-header h3 {
    font-size: 13px;
  }
}