/* /public/css/upload.css */
/* ============================================
   UPLOAD PAGE - REDESIGNED
   Matching scan.html design language
   ============================================ */

/* Page Background */
.upload-page {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ============================================
   FIXED HEADER
   ============================================ */

.upload-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.upload-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: white;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.2s;
}

.upload-back-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.back-icon {
  font-size: 18px;
}

.upload-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-weight: 600;
  font-size: 16px;
}

.header-icon {
  font-size: 18px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.upload-main {
  padding: 80px 16px 30px;
  max-width: 600px;
  margin: 0 auto;
}

.upload-section {
  margin-bottom: 20px;
}

/* ============================================
   GLASS CARD STYLE
   ============================================ */

.glass-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.section-card {
  padding: 24px 20px;
}

/* ============================================
   SECTION HEADER
   ============================================ */

.section-header {
  text-align: center;
  margin-bottom: 24px;
}

.section-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

.section-header h2 {
  font-size: 22px;
  color: #1f2937;
  margin-bottom: 6px;
}

.section-header p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

/* ============================================
   INPUT STYLES
   ============================================ */

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.input-wrapper {
  position: relative;
}

.input-wrapper input {
  width: 100%;
  padding: 14px 16px;
  padding-right: 45px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #f9fafb;
}

.input-wrapper input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: white;
}

.input-wrapper .input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  opacity: 0.5;
}

/* ============================================
   BUTTON STYLES
   ============================================ */

.upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.upload-btn.primary {
  color: white;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

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

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

.upload-btn.secondary {
  color: #4f46e5;
  background: rgba(99, 102, 241, 0.1);
  box-shadow: none;
}

.upload-btn.secondary:hover {
  background: rgba(99, 102, 241, 0.15);
}

.upload-btn.large {
  padding: 18px 28px;
  font-size: 18px;
  border-radius: 16px;
}

.upload-btn:disabled {
  background: #9ca3af !important;
  cursor: not-allowed;
  box-shadow: none !important;
  transform: none !important;
}

.btn-icon {
  font-size: 20px;
}

/* ============================================
   ERROR MESSAGE
   ============================================ */

.error-message {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #dc2626;
  font-size: 14px;
}

.error-icon {
  font-size: 16px;
}

/* ============================================
   LOGGED IN INDICATOR
   ============================================ */

.logged-in-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 12px;
  margin-bottom: 20px;
}

.logged-in-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #166534;
  font-weight: 600;
  font-size: 14px;
}

.logged-in-icon {
  font-size: 18px;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.1);
  border: none;
  border-radius: 8px;
  color: #dc2626;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ============================================
   EVENT SELECTOR
   ============================================ */

.event-select-wrapper {
  position: relative;
  margin-bottom: 16px;
}

.event-dropdown {
  width: 100%;
  padding: 14px 40px 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  background: #f9fafb;
  cursor: pointer;
  appearance: none;
  transition: border-color 0.2s;
}

.event-dropdown:focus {
  outline: none;
  border-color: #6366f1;
  background: white;
}

.select-arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
  font-size: 12px;
}

/* Event Storage Mini */
.event-storage {
  padding: 14px;
  background: #f8fafc;
  border-radius: 10px;
}

.storage-bar-mini {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.storage-fill-mini {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  border-radius: 4px;
  transition: width 0.3s;
}

.storage-fill-mini.warning {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.storage-fill-mini.danger {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.storage-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6b7280;
}

/* No Events */
.no-events {
  text-align: center;
  padding: 20px;
}

.no-events-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 10px;
}

.no-events p {
  color: #6b7280;
  margin-bottom: 12px;
}

.create-event-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6366f1;
  font-weight: 600;
  text-decoration: none;
}

.create-event-link:hover {
  text-decoration: underline;
}

/* ============================================
   STORAGE OVERVIEW
   ============================================ */

.storage-overview {
  padding: 20px;
}

.storage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.storage-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.storage-icon {
  font-size: 20px;
}

.storage-title h3 {
  font-size: 16px;
  color: #1f2937;
  margin: 0;
}

.refresh-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.refresh-btn:hover {
  background: rgba(99, 102, 241, 0.15);
}

.refresh-btn:active {
  transform: rotate(180deg);
}

/* Storage Bar */
.storage-bar-container {
  margin-bottom: 16px;
}

.storage-bar {
  height: 12px;
  background: #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}

.storage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  border-radius: 6px;
  transition: width 0.3s;
}

.storage-bar-fill.warning {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.storage-bar-fill.danger {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.storage-text {
  display: flex;
  justify-content: flex-start;
  gap: 4px;
  font-size: 14px;
}

#storage-used {
  font-weight: 600;
  color: #1f2937;
}

#storage-total {
  color: #6b7280;
}

/* Storage Stats */
.storage-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: #f8fafc;
  border-radius: 10px;
}

.stat-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 2px;
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
}

/* Storage Warning */
.storage-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 14px;
  background: #fef3c7;
  border-radius: 8px;
  color: #92400e;
  font-size: 13px;
  font-weight: 500;
}

/* ============================================
   MODELS LOADING
   ============================================ */

.models-loading {
  padding: 40px 20px;
  text-align: center;
}

.loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loading-logo {
  font-size: 56px;
  margin-bottom: 16px;
  animation: pulse 2s ease-in-out infinite;
}

.models-loading .spinner {
  width: 40px;
  height: 40px;
  margin-bottom: 16px;
}

.models-loading #loading-text {
  color: #6b7280;
  font-size: 14px;
  margin-bottom: 20px;
}

/* Model Stages */
.model-stages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 240px;
}

.model-stage {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f3f4f6;
  border-radius: 10px;
  font-size: 13px;
  color: #6b7280;
  transition: all 0.3s;
}

.model-stage.active {
  background: #eef2ff;
  color: #4f46e5;
}

.model-stage.complete {
  background: #ecfdf5;
  color: #059669;
}

.stage-icon {
  font-size: 16px;
}

.model-stage.active .stage-icon {
  animation: spin 1s linear infinite;
}

/* ============================================
   UPLOAD CONTENT
   ============================================ */

.upload-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Selected Event Badge */
.selected-event {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.event-badge-icon {
  font-size: 24px;
}

.event-badge-info {
  display: flex;
  flex-direction: column;
}

.event-badge-label {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.event-badge-name {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

/* Info Note */
.info-note {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.info-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.info-text {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}

/* ============================================
   DROP ZONE
   ============================================ */

.drop-zone {
  position: relative;
  padding: 40px 20px;
  text-align: center;
  border: 3px dashed #d1d5db;
  transition: border-color 0.3s, background 0.3s;
}

.drop-zone.drag-over {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.05);
}

.drop-zone.drag-over .drop-zone-content {
  opacity: 0;
}

.drop-zone.drag-over .drop-zone-active {
  opacity: 1;
}

.drop-zone-content {
  transition: opacity 0.3s;
}

.drop-icon-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 16px;
}

.drop-icon {
  font-size: 56px;
  display: block;
}

.drop-icon-ring {
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-radius: 50%;
  animation: ringPulse 2s ease-in-out infinite;
}

@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.5; }
}

.drop-zone h3 {
  font-size: 18px;
  color: #1f2937;
  margin-bottom: 8px;
}

.drop-subtitle {
  font-size: 14px;
  color: #9ca3af;
  margin-bottom: 16px;
}

.file-select-btn {
  cursor: pointer;
}

.file-select-btn input {
  display: none;
}

/* Drop Active Overlay */
.drop-zone-active {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.drop-active-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: bounce 0.5s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.drop-zone-active p {
  font-size: 16px;
  font-weight: 600;
  color: #6366f1;
}

/* ============================================
   FILES PREVIEW
   ============================================ */

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

.file-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  aspect-ratio: 1;
}

.file-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-item .remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.file-item:hover .remove-btn {
  opacity: 1;
}

.file-item .face-count {
  position: absolute;
  bottom: 6px;
  left: 6px;
  padding: 4px 8px;
  border-radius: 12px;
  background: #22c55e;
  color: white;
  font-size: 10px;
  font-weight: 600;
}

.file-item .file-status {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 9px;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
}

.file-item .file-status.optimizing {
  background: #f59e0b;
}

.file-item .file-status.done {
  background: #22c55e;
}

/* ============================================
   PROGRESS SECTION
   ============================================ */

.progress-section {
  padding: 20px;
}

.progress-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.progress-icon {
  font-size: 20px;
}

.progress-label {
  font-size: 14px;
  color: #1f2937;
  font-weight: 500;
}

/* ============================================
   UPLOAD RESULTS
   ============================================ */

.upload-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.upload-result-item img {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
}

.upload-result-item.success {
  border-left: 4px solid #22c55e;
}

.upload-result-item.error {
  border-left: 4px solid #ef4444;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (min-width: 768px) {
  .upload-main {
    padding-top: 100px;
  }
  
  .upload-header {
    padding: 16px 24px;
  }
  
  .section-card {
    padding: 32px;
  }
  
  .section-icon {
    font-size: 56px;
  }
  
  .section-header h2 {
    font-size: 26px;
  }
  
  .files-preview {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

/* Small screens */
@media (max-height: 650px) {
  .section-icon {
    font-size: 40px;
    margin-bottom: 8px;
  }
  
  .section-header {
    margin-bottom: 16px;
  }
  
  .loading-logo {
    font-size: 44px;
  }
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */

.toast-notification {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 14px 24px;
  background: #1f2937;
  color: white;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 9999;
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-success {
  background: #059669;
}

.toast-error {
  background: #dc2626;
}

.toast-info {
  background: #2563eb;
}

/* ============================================
   SPINNER FOR UPLOAD PAGE
   ============================================ */

.models-loading .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

/* ============================================
   BUTTON RIPPLE
   ============================================ */

.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
  width: 300px;
  height: 300px;
}