:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg-dark: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --border-color: rgba(255, 255, 255, 0.1);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-gold: #fbbf24;
  --success: #22c55e;
  --error: #ef4444;
  --glass-bg: rgba(15, 23, 42, 0.8);
  --sidebar-width: 280px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

/* Status Bar */
.status-bar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: 48px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  z-index: 100;
  transition: all 0.3s ease;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--error);
  box-shadow: 0 0 10px var(--error);
}

.status-bar.online .status-dot {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.status-bar span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.btn-setup {
  margin-left: auto;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: 0.2s;
}

.btn-setup:hover {
  background: rgba(255,255,255,0.1);
}

/* App Layout */
.app-container {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: #020617;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 32px 16px;
  z-index: 101;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 48px;
  padding: 0 8px;
}

.logo {
  width: 32px;
  height: 32px;
}

.sidebar-header h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.sidebar-header h1 span {
  color: var(--primary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.nav-btn i {
  font-size: 18px;
}

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

.nav-btn.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 80px 40px 40px;
  overflow-y: auto;
}

.tab-content {
  display: none;
  max-width: 1000px;
  margin: 0 auto;
  animation: slideUp 0.4s cubic-bezier(0, 0, 0.2, 1);
}

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

.content-header {
  margin-bottom: 32px;
}

.content-header h2 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

.content-header p {
  color: var(--text-muted);
  font-size: 16px;
}

/* Cards */
.tool-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Media Hub Styles */
.input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 8px 8px 8px 20px;
  gap: 12px;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--primary);
}

.link-icon {
  color: var(--text-muted);
}

.input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 16px;
  outline: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.format-options {
  display: flex;
  gap: 12px;
}

.chip-label {
  cursor: pointer;
}

.chip-label input {
  display: none;
}

.chip-label span {
  display: block;
  padding: 8px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s;
}

.chip-label input:checked + span {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

/* Result Container */
.result-container {
  margin-bottom: 40px;
}

.media-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  gap: 24px;
  animation: fadeIn 0.3s ease;
}

.media-cover {
  width: 160px;
  height: 160px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.media-info {
  flex: 1;
}

.media-info h3 {
  font-size: 24px;
  margin-bottom: 8px;
}

.media-meta {
  display: flex;
  gap: 16px;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

/* History Grid */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.history-header h3 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.file-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: 0.2s;
}

.file-card:hover {
  background: rgba(255,255,255,0.05);
  border-color: var(--primary);
}

.file-icon {
  width: 48px;
  height: 48px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.file-details {
  flex: 1;
  min-width: 0;
}

.file-details p {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-details span {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

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

/* Modern PDF UI */
.pdf-workflow {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.pdf-config-card {
  padding: 24px !important;
}

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.modern-input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modern-input-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-icon {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0 16px;
  transition: border-color 0.2s;
}

.input-with-icon:focus-within {
  border-color: var(--primary);
}

.input-with-icon input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 12px 0;
  font-size: 15px;
  outline: none;
}

.extension-tag {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  opacity: 0.5;
}

.toggle-selector {
  display: flex;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.toggle-option {
  flex: 1;
  cursor: pointer;
}

.toggle-option input {
  display: none;
}

.option-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.toggle-option input:checked + .option-content {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* Upload Zone */
.upload-zone {
  background: rgba(99, 102, 241, 0.03);
  border: 2px dashed rgba(99, 102, 241, 0.3);
  border-radius: 24px;
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-zone:hover {
  background: rgba(99, 102, 241, 0.06);
  border-color: var(--primary);
  transform: translateY(-2px);
}

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

.upload-icon-stack {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
}

.main-icon {
  font-size: 48px;
  color: var(--primary);
}

.sub-icon {
  position: absolute;
  bottom: 0;
  right: -5px;
  font-size: 24px;
  color: var(--accent-gold);
  background: var(--bg-dark);
  border-radius: 50%;
  padding: 4px;
}

.upload-text h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.upload-text p {
  color: var(--text-muted);
  font-size: 14px;
}

/* PDF Actions Area */
.pdf-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 16px;
  animation: fadeIn 0.3s ease;
}

.selection-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: var(--primary);
}

.btn-large {
  padding: 14px 32px !important;
  font-size: 15px !important;
}

.nameinput {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 16px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s;
}

/* Modern Image Grid */
.image-grid-modern {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.image-card-pro {
  position: relative;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: #1e293b;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: grab;
}

.image-card-pro:hover {
  transform: scale(1.03) translateY(-4px);
  z-index: 10;
  box-shadow: 0 12px 24px rgba(0,0,0,0.3);
}

.image-card-pro.dragging {
  opacity: 0.4;
  transform: scale(0.95);
  border: 2px solid var(--primary);
  cursor: grabbing;
}

.image-card-pro.drag-over-card {
  border: 2px solid var(--primary);
  background: rgba(99, 102, 241, 0.1);
  transform: scale(0.8);
  transition: all 0.2s ease;
}

.image-card-pro img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  pointer-events: none; /* Prevents image from interfering with drag */
}

.card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.image-card-pro:hover .card-overlay {
  opacity: 1;
}

.card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  pointer-events: auto;
}

.btn-blur {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
}

.btn-blur:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-blur.delete:hover {
  background: var(--error);
  border-color: var(--error);
}

.image-index {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #0f172a;
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 500px;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.modal-header i {
  font-size: 24px;
  color: var(--primary);
}

.close-modal {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

/* Progress Toast */
.progress-toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 320px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  display: none;
  z-index: 1000;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.progress-track {
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.3s ease;
}

/* Global Drop Overlay */
.global-drop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(99, 102, 241, 0.9);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.overlay-content {
  text-align: center;
}

.icon-circle {
  width: 120px;
  height: 120px;
  background: white;
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin: 0 auto 24px;
}

/* Animations */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Responsive */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 80px;
  }
  .sidebar-header h1, .nav-btn span, .sidebar-footer {
    display: none;
  }
  .status-bar {
    left: 80px;
  }
  .nav-btn {
    justify-content: center;
    padding: 16px;
  }
}

/* Added app-specific utilities */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}

.empty-state,
.loading-shimmer,
.error-card,
.success-message,
.error-message,
.loading-text,
.transcript-result {
  border-radius: 16px;
  padding: 16px;
}

.empty-state,
.loading-shimmer,
.loading-text {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
  text-align: center;
}

.error-card,
.error-message {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.24);
  color: #fecaca;
}

.success-message {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.24);
  color: #bbf7d0;
}

.loading-shimmer {
  animation: fadeIn 0.2s ease;
}

.btn-outline {
  margin-top: 16px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: 0.2s;
  text-decoration: none;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.status-indicator.online {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.2);
}

.status-indicator.offline {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.2);
}

.setup-steps {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
}

.step-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
}

.modal-footer {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
}

.modal-footer .btn-outline {
  margin-top: 0;
}

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.03);
  border: 2px dashed rgba(99, 102, 241, 0.2);
  text-align: center;
  transition: 0.2s ease;
}

.drop-zone i {
  font-size: 32px;
  color: var(--primary);
}

.drop-zone.has-files {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.upload-zone.drag-over,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
}

.text-output-area {
  min-height: 140px;
  margin-top: 20px;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.45);
  white-space: pre-wrap;
}

.transcriber-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.transcript-result {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
}

.file-card a.btn-icon {
  text-decoration: none;
}

.media-card .btn-primary {
  width: fit-content;
}

.result-container,
.image-grid-modern,
.files-grid {
  min-height: 1px;
}
