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

:root {
  /* Premium Color Palette (HSL for easy manipulation) */
  --primary-hue: 243;
  --primary: hsl(var(--primary-hue), 75%, 59%);
  --primary-dark: hsl(var(--primary-hue), 75%, 45%);
  --primary-light: hsl(var(--primary-hue), 80%, 95%);

  --secondary-hue: 262;
  --secondary: hsl(var(--secondary-hue), 80%, 50%);

  --accent: #22d3ee;

  --bg-gradient: radial-gradient(at 0% 0%, hsla(243, 75%, 59%, 0.15) 0, transparent 50%),
    radial-gradient(at 100% 100%, hsla(262, 80%, 50%, 0.15) 0, transparent 50%),
    #f8fafc;

  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

  --text-main: #1e293b;
  --text-muted: #64748b;

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 8px;

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --glass-border-light: rgba(255, 255, 255, 0.2);
}

/* Staging Environment Indicator */
.staging-banner {
  background: repeating-linear-gradient(45deg,
      #fbbf24,
      #fbbf24 10px,
      #f59e0b 10px,
      #f59e0b 20px);
  color: #000;
  text-align: center;
  padding: 0.5rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  position: sticky;
  top: 0;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: none;
}

.staging-mode .staging-banner {
  display: block;
}

.staging-mode .header {
  border-top: 4px solid #f59e0b;
}

/* Tab Navigation */
.tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 1rem;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.75rem 1.5rem;
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border-radius: var(--radius-sm);
  position: relative;
}

.tab-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.tab-btn.active {
  color: var(--primary);
  background: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1rem;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 3px;
}

.tab-content {
  display: none;
  animation: slideIn 0.4s ease-out;
}

.tab-content.active {
  display: block;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Input Styles */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-group input {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: white;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  transition: var(--transition);
  width: 100%;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  font-family: 'Outfit', sans-serif;
  margin: 0;
  letter-spacing: -0.02em;
}

/* Layout Container */
.app-shell {
  width: 100%;
  max-width: 900px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 1rem;
}

.header h1 {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
  text-shadow: 0 4px 30px rgba(79, 70, 229, 0.15);
}

.header p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.header-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.header-features li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

/* Glass Card Base */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  padding: 2.5rem;
  transition: var(--transition);
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.1);
}

/* Smart Upload Hub */
.upload-hub {
  text-align: center;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 4rem 2rem;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.3);
}

.upload-hub:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-hub.dragover {
  border-color: var(--accent);
  background: rgba(34, 211, 238, 0.1);
  transform: scale(1.02);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  transition: var(--transition);
}

.upload-hub:hover .upload-icon {
  transform: scale(1.2) rotate(-5deg);
}

.upload-hub h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.upload-hub p {
  color: var(--text-muted);
}

input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Controls Dashboard */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

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

.control-card h3 {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}

/* Custom Range Input */
input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 5px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.3);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 15px rgba(79, 70, 229, 0.5);
}

/* iOS Toggle Switches */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 100%;
  height: 100%;
  position: absolute;
  cursor: pointer;
  z-index: 1;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #e2e8f0;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

input:checked+.slider {
  background-color: var(--primary);
}

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

.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
}

/* Action Buttons */
.btn {
  padding: 1rem 2rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
  font-size: 1.1rem;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-primary:disabled {
  background: #cbd5e1;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
  width: 100%;
}

.btn-outline {
  background: white;
  border: 1px solid #e2e8f0;
  color: var(--text-main);
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline:active,
.btn-outline:focus {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: scale(0.97);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

/* Metadata Badge (Premium style - full width with flash) */
.metadata-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(139, 92, 246, 0.1));
  color: var(--primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid rgba(79, 70, 229, 0.2);
  margin-bottom: 1rem;
  animation: flashBadge 1.5s ease-out;
}

.metadata-badge .view-link {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.metadata-badge .view-link:hover {
  background: var(--secondary);
  transform: scale(1.05);
}

@keyframes flashBadge {
  0% {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.4), rgba(139, 92, 246, 0.4));
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.4);
  }

  50% {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.2), rgba(139, 92, 246, 0.2));
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.2);
  }

  100% {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(139, 92, 246, 0.1));
    box-shadow: none;
  }
}

/* Legacy metadata pill for backwards compatibility */
.metadata-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.5rem 1rem;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid hsla(var(--primary-hue), 75%, 59%, 0.1);
}

/* Preview Canvas */
.preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

canvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  background: #fff;
}

.help-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--text-muted);
  background: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  opacity: 0.7;
}

.help-btn:hover {
  opacity: 1;
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* Presets Grid */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.btn-preset {
  font-size: 0.85rem !important;
  padding: 0.75rem 0.5rem !important;
  border-radius: var(--radius-md) !important;
  border-color: rgba(79, 70, 229, 0.2) !important;
}

.btn-preset:hover {
  background: var(--primary-light) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

/* Metadata Viewer (Premium Grid) */
.metadata-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.metadata-item {
  background: var(--primary-light);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid hsla(var(--primary-hue), 75%, 59%, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: var(--transition);
}

.metadata-item:hover {
  transform: translateY(-2px);
  background: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.05);
}

.metadata-item label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.metadata-item span {
  font-size: 0.95rem;
  color: var(--text-main);
  word-break: break-all;
  font-family: 'Inter', monospace;
  /* Monospace for values looks technical yet clean */
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  /* Controlled by JS */
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: white;
  width: 100%;
  max-width: 800px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
  /* Prevent content-level scroll */
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  z-index: 10;
}

.modal-header h2 {
  font-size: 1.5rem;
  margin: 0;
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
}

/* Premium Scrollbar */
.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f1f5f9;
}

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

.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.close-modal {
  font-size: 2rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  line-height: 1;
}

.close-modal:hover {
  color: var(--primary);
  transform: rotate(90deg);
}

/* FAQ & Intro */
.info-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.info-card h3 {
  margin-bottom: 0.75rem;
}

.info-card p,
.info-card li {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-muted);
}

/* Privacy Page Sections */
.privacy-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.privacy-section:last-of-type {
  border-bottom: none;
}

.privacy-section h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.privacy-section p {
  color: var(--text-muted);
  line-height: 1.7;
}

/* Social Footer */
.footer {
  margin-top: auto;
  padding: 3rem 1rem;
  text-align: center;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.social-links a {
  color: var(--text-muted);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-links a:hover {
  color: var(--primary);
  transform: translateY(-3px) scale(1.1);
}

.social-links svg {
  width: 28px;
  height: 28px;
}

.upload-hub.compact {
  padding: 1.5rem;
  border-style: solid;
  background: rgba(255, 255, 255, 0.4);
}

.upload-hub.compact .upload-icon,
.upload-hub.compact p {
  display: none;
}

.upload-hub.compact h2 {
  font-size: 1.1rem;
  margin: 0;
}

.batch-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 1rem;
  padding-right: 0.5rem;
}

.batch-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  transition: var(--transition);
}

.batch-item .thumb {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: #eee;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.batch-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px var(--primary);
}

.batch-item:hover {
  background: white;
  border-color: var(--primary);
}

.batch-item .file-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.batch-item .meta-btn {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.2);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.batch-item .meta-btn:hover {
  background: var(--primary);
  color: white;
}

.batch-item .status {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  min-width: 80px;
  text-align: right;
}

.batch-item.processing .status {
  color: var(--primary);
  animation: pulse 1s infinite alternate;
}

.batch-item.done .status {
  color: #10b981;
}

.batch-item.done {
  border-color: #10b981;
}

.preview-grid {
  display: grid;
  gap: 1.5rem;
  width: 100%;
  margin-top: 1rem;
}

.preview-grid.count-1 {
  grid-template-columns: 1fr;
  width: 100%;
  margin-inline: auto;
}

.preview-grid.count-2 {
  grid-template-columns: 1fr 1fr;
}

.preview-grid.count-more {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Share Button Styles */
.share-btn {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

.share-btn:hover {
  background: rgba(79, 70, 229, 0.05) !important;
}

.btn-sm {
  padding: 4px 12px !important;
  font-size: 0.8rem !important;
  margin-top: 0.5rem !important;
}

.share-individual-btn {
  width: auto !important;
  align-self: center !important;
}

.preview-item {
  display: flex !important;
  flex-direction: column !important;
}

.preview-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.preview-item canvas {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.preview-item span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

@keyframes pulse {
  from {
    opacity: 0.6;
  }

  to {
    opacity: 1;
  }
}

#sizeEstimate {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 0.5rem;
  background: rgba(255, 255, 255, 0.3);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Mobile Adjustments */
@media (max-width: 640px) {
  .btn-group {
    grid-template-columns: 1fr;
  }

  .app-shell {
    padding: 1rem;
  }

  .header h1 {
    font-size: 2.2rem;
  }
}