/* Convert It Pro - Kush-Tech Solutions - Modern Responsive Design System */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Syne:wght@600;700;800;900&family=Space+Grotesk:wght@500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Rich Modern Typography Stack */
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Space Grotesk', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, Menlo, Consolas, monospace;

  /* Color Palette */
  --bg-dark: #050711;
  --bg-card: rgba(13, 18, 36, 0.76);
  --bg-card-hover: rgba(18, 26, 52, 0.88);
  --border-glass: rgba(255, 255, 255, 0.09);
  --border-glass-focus: rgba(129, 140, 248, 0.55);
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.45);
  
  --purple: #a855f7;
  --purple-hover: #9333ea;
  --purple-glow: rgba(168, 85, 247, 0.45);
  
  --emerald: #10b981;
  --emerald-hover: #059669;
  --emerald-glow: rgba(16, 185, 129, 0.45);

  --rose: #f43f5e;
  --amber: #f59e0b;
  --cyan: #06b6d4;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --radius-2xl: 24px;
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  /* Safe Area Variables */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 15% 5%, rgba(99, 102, 241, 0.22) 0px, transparent 40vw),
    radial-gradient(circle at 85% 12%, rgba(168, 85, 247, 0.20) 0px, transparent 42vw),
    radial-gradient(circle at 50% 90%, rgba(16, 185, 129, 0.15) 0px, transparent 45vw),
    radial-gradient(circle at 92% 85%, rgba(6, 182, 212, 0.15) 0px, transparent 40vw);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-body);
  letter-spacing: -0.012em;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-left: var(--sal);
  padding-right: var(--sar);
}

/* Typography Hierarchy */
h1, h2, h3, h4, .font-heading {
  font-family: var(--font-heading);
  letter-spacing: -0.03em;
  font-feature-settings: "ss01" on, "cv01" on;
}

code, pre, .font-mono {
  font-family: var(--font-mono);
}

/* Custom Sleek Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(8, 12, 26, 0.7);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.32);
}

/* Glassmorphism Panels */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-2xl);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, box-shadow 0.25s ease;
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.glass-subcard {
  background: rgba(255, 255, 255, 0.038);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Glass Inputs & Form Controls */
.glass-input {
  background: rgba(8, 13, 28, 0.85);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.935rem;
  font-family: var(--font-body);
  transition: all 0.2s ease;
  outline: none;
  width: 100%;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.glass-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow), inset 0 2px 4px rgba(0, 0, 0, 0.3);
  background: rgba(8, 13, 28, 0.98);
}

select.glass-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px;
}

select.glass-input option {
  background-color: #0b1122;
  color: #f8fafc;
  padding: 12px;
}

/* Gradients */
.gradient-primary {
  background: linear-gradient(135deg, #a5b4fc 0%, #c084fc 45%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gradient-audio {
  background: linear-gradient(135deg, #c084fc 0%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gradient-dl {
  background: linear-gradient(135deg, #34d399 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Responsive Navigation Tabs */
.nav-tabs-container {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  padding: 4px;
  position: relative;
  touch-action: pan-x;
}

.nav-tabs-container::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  background: transparent;
  color: var(--text-muted);
  padding: 9px 18px;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: var(--font-body);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  touch-action: manipulation;
  user-select: none;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.07);
}

.nav-tab.active {
  background: rgba(99, 102, 241, 0.22);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Sub tabs for tool modes (Audio Lab, etc.) */
.sub-tab {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  touch-action: manipulation;
  user-select: none;
}

.sub-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.sub-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 16px var(--primary-glow);
}

/* Upload Dropzone */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  padding: 30px 18px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  background: rgba(255, 255, 255, 0.02);
  position: relative;
  touch-action: manipulation;
}

.dropzone:hover, .dropzone.dragover {
  border-color: #818cf8;
  background: rgba(99, 102, 241, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px -5px rgba(99, 102, 241, 0.24);
}

.dropzone.dragover {
  border-style: solid;
}

/* File Queue Cards */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  gap: 12px;
  transition: all 0.2s ease;
  animation: slideIn 0.25s ease;
}

.file-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.file-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.file-item-name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f1f5f9;
}

.file-item-size {
  font-size: 0.725rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  min-width: 34px;
  min-height: 34px;
  touch-action: manipulation;
}

.btn-icon:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.12);
}

.btn-icon.danger:hover {
  color: var(--rose);
  background: rgba(244, 63, 94, 0.18);
}

/* Action Buttons */
.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  font-family: var(--font-body);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.95rem;
  box-shadow: 0 10px 24px -5px var(--primary-glow);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  min-height: 48px;
  touch-action: manipulation;
  user-select: none;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px -5px var(--primary-glow);
  filter: brightness(1.1);
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.btn-purple {
  background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
  box-shadow: 0 10px 24px -5px var(--purple-glow);
}

.btn-purple:hover:not(:disabled) {
  box-shadow: 0 16px 32px -5px var(--purple-glow);
}

.btn-emerald {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 10px 24px -5px var(--emerald-glow);
}

.btn-emerald:hover:not(:disabled) {
  box-shadow: 0 16px 32px -5px var(--emerald-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  font-family: var(--font-body);
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  touch-action: manipulation;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Waveform Canvas & Trimmer */
.waveform-container {
  background: rgba(8, 13, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-lg);
  padding: 14px;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.waveform-canvas {
  width: 100%;
  height: 90px;
  display: block;
}

/* Range Slider */
input[type="range"] {
  accent-color: var(--primary);
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

/* Modals */
.modal-overlay {
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-dialog {
  background: #0d1326;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-2xl);
  max-width: 620px;
  width: 100%;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.9);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-dialog {
  transform: scale(1) translateY(0);
}

/* Toasts */
#toast-container {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 16px));
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 380px;
  width: calc(100% - 32px);
}

.toast {
  pointer-events: auto;
  background: rgba(13, 19, 38, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideInRight 0.3s ease;
  transition: all 0.3s ease;
}

.toast.toast-success { border-left: 4px solid var(--emerald); }
.toast.toast-error { border-left: 4px solid var(--rose); }
.toast.toast-info { border-left: 4px solid var(--primary); }
.toast.toast-warning { border-left: 4px solid var(--amber); }

/* Global Progress Modal */
#global-progress-modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#global-progress-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
  margin: 16px 0 8px 0;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #a855f7, #38bdf8);
  border-radius: 9999px;
  transition: width 0.25s ease;
}

/* Micro Animations */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-indigo { background: rgba(99, 102, 241, 0.18); color: #c7d2fe; border: 1px solid rgba(99, 102, 241, 0.38); }
.badge-purple { background: rgba(168, 85, 247, 0.18); color: #e9d5ff; border: 1px solid rgba(168, 85, 247, 0.38); }
.badge-emerald { background: rgba(16, 185, 129, 0.18); color: #a7f3d0; border: 1px solid rgba(16, 185, 129, 0.38); }

/* Recording pulse */
.recording-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #ef4444;
  animation: recPulse 1s infinite alternate;
}

@keyframes recPulse {
  0% { transform: scale(0.85); opacity: 0.5; }
  100% { transform: scale(1.25); opacity: 1; box-shadow: 0 0 12px #ef4444; }
}

/* ==========================================================================
   Comprehensive Multi-Screen Viewport Media Queries & Adaptations
   ========================================================================== */

/* 1. Large Desktops & 4K Displays (>= 1440px) */
@media (min-width: 1440px) {
  .glass-panel {
    padding: 32px 28px !important;
  }
}

/* 2. Standard Desktops & Laptops (1024px - 1439px) */
@media (min-width: 1024px) and (max-width: 1439px) {
  .glass-panel {
    padding: 24px 20px !important;
  }
}

/* 3. Tablets & Small Laptops (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .glass-panel {
    padding: 22px 18px !important;
  }
  
  #main-tools-grid.grid-cols-3 {
    grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    gap: 24px !important;
  }
}

/* 4. Mobile Devices & Small Screens (<= 767px) */
@media (max-width: 767px) {
  /* Prevent iOS Safari auto-zoom on input focus */
  .glass-input, select.glass-input, input[type="text"], input[type="url"], input[type="number"] {
    font-size: 16px !important;
  }

  .nav-tabs-container {
    width: 100%;
    justify-content: flex-start;
    padding: 3px;
  }

  .nav-tab {
    padding: 8px 14px;
    font-size: 0.8rem;
    gap: 6px;
  }

  .glass-panel {
    padding: 20px 16px !important;
    border-radius: var(--radius-xl);
  }

  .dropzone {
    padding: 22px 14px;
  }

  #toast-container {
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    top: max(12px, env(safe-area-inset-top, 12px));
  }

  .modal-dialog {
    padding: 20px 16px !important;
    border-radius: var(--radius-xl);
    max-height: calc(100dvh - 32px);
  }
}

/* 5. Compact Mobile Screens (<= 380px: iPhone SE, Galaxy Fold cover, etc.) */
@media (max-width: 380px) {
  .nav-tab {
    padding: 7px 11px;
    font-size: 0.75rem;
    gap: 4px;
  }

  .glass-panel {
    padding: 16px 12px !important;
    border-radius: 16px;
  }

  .dropzone {
    padding: 18px 10px;
  }

  .btn-primary {
    padding: 12px 16px;
    font-size: 0.9rem;
  }
}

