/* ==========================================================================
   Lumina GIF Studio Stylesheet
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-gradient: linear-gradient(135deg, #090b11 0%, #110f24 50%, #0c101d 100%);
  --panel-bg: rgba(17, 24, 39, 0.65);
  --panel-border: rgba(255, 255, 255, 0.06);
  --panel-glow: rgba(99, 102, 241, 0.05);
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.4);
  
  --accent: #a855f7;
  --accent-hover: #9333ea;
  
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #4b5563;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.25);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  
  --border-radius-lg: 16px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
}

/* Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3, h4, .btn {
  font-family: 'Outfit', sans-serif;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.w-full {
  width: 100%;
}

.mt-4 {
  margin-top: 1rem;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* App Container */
.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

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

.logo-area {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  margin-bottom: 0.5rem;
}

.logo-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--primary);
  filter: drop-shadow(0 0 10px var(--primary-glow));
}

.logo-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  height: 120%;
  background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, rgba(0,0,0,0) 70%);
  z-index: -1;
  pointer-events: none;
}

.app-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
}

.app-header h1 span {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 300;
}

/* Upload Zone */
.upload-zone {
  position: relative;
  background: var(--panel-bg);
  border: 2px dashed rgba(99, 102, 241, 0.3);
  border-radius: var(--border-radius-lg);
  padding: 4rem 2rem;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  backdrop-filter: blur(12px);
  border-color: rgba(255, 255, 255, 0.1);
  transition: var(--transition-smooth);
}

.upload-zone:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 32px 0 var(--panel-glow), 0 0 20px rgba(99, 102, 241, 0.1);
  transform: translateY(-2px);
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-icon-wrapper {
  width: 4.5rem;
  height: 4.5rem;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  transition: var(--transition-smooth);
}

.upload-zone:hover .upload-icon-wrapper {
  background: rgba(99, 102, 241, 0.2);
  transform: scale(1.1);
}

.upload-icon {
  width: 2.25rem;
  height: 2.25rem;
  color: var(--primary);
}

.upload-content h3 {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
}

.upload-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Workspace Dashboard */
.dashboard-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
}

/* Sidebar & Cards */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.settings-card, .preview-card, .timeline-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.75rem;
}

.card-icon {
  color: var(--primary);
  width: 1.25rem;
  height: 1.25rem;
}

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

/* Inputs & Form Controls */
.control-group {
  margin-bottom: 1.25rem;
}

.control-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input[type="number"], select, input[type="text"] {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-sm);
  padding: 0.65rem 0.85rem;
  color: var(--text);
  font-size: 0.9rem;
  transition: var(--transition-fast);
  outline: none;
}

input[type="number"]:focus, select:focus, input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-unit input {
  padding-right: 3rem;
}

.input-with-unit .unit {
  position: absolute;
  right: 0.85rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text);
}

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

.btn-lg {
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
}

/* Custom Dimensions Row */
.custom-dimensions-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.dimension-input label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.aspect-lock-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  margin-bottom: 1px;
  color: var(--text-muted);
}

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

.aspect-lock-btn i.locked {
  color: var(--primary);
}

/* Main workspace area */
.workspace-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Preview Card */
.preview-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success-glow);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 12px var(--success-glow); }
  100% { transform: scale(0.95); opacity: 0.5; }
}

.frame-count-badge {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
}

.preview-screen-wrapper {
  background: #000;
  border-radius: var(--border-radius-md);
  aspect-ratio: 16/9;
  max-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.player-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.player-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary);
}

.timeline-slider-wrapper {
  flex-grow: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: 0.5rem;
}

.time-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 80px;
  text-align: right;
}

.timeline-slider {
  flex-grow: 1;
  accent-color: var(--primary);
  background: rgba(255, 255, 255, 0.1);
  height: 6px;
  border-radius: 3px;
  cursor: pointer;
}

/* Timeline Card */
.timeline-card {
  padding: 1.5rem;
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.timeline-title-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timeline-title-wrapper h2 {
  font-size: 1.15rem;
}

.timeline-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timeline-frames-wrapper {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 0.5rem 0.25rem 1rem;
  min-height: 220px;
  align-items: stretch;
}

/* Timeline Frame Card */
.frame-card {
  flex: 0 0 180px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  transition: var(--transition-smooth);
}

.frame-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.frame-card.active-frame {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.frame-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.frame-index {
  font-weight: 600;
  color: var(--primary);
}

.frame-card-actions {
  display: flex;
  gap: 0.25rem;
}

.frame-icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

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

.frame-icon-btn.btn-delete:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.frame-thumb-wrapper {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--border-radius-sm);
  background: rgba(0,0,0,0.5);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.frame-thumb {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.frame-caption-overlay {
  position: absolute;
  bottom: 4px;
  left: 4px;
  right: 4px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 9px;
  padding: 2px 4px;
  border-radius: 3px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.frame-delay-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.frame-delay-row label {
  color: var(--text-muted);
}

.frame-delay-row input {
  padding: 0.25rem 0.4rem;
  font-size: 0.75rem;
  text-align: center;
}

.frame-caption-input {
  padding: 0.25rem 0.4rem;
  font-size: 0.75rem;
}

.frame-reorder-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
}

.frame-reorder-row button {
  padding: 0.25rem 0;
  font-size: 0.75rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.frame-reorder-row button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.frame-reorder-row button:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* Modal Overlay & Card */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease-out;
}

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

.modal-card {
  background: linear-gradient(135deg, #13122b 0%, #0d0f1a 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--border-radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 600px;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 40px rgba(99, 102, 241, 0.15);
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.modal-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Spinner */
.progress-spinner-container {
  width: 6rem;
  height: 6rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}

.spinner-outer {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 4px solid rgba(99, 102, 241, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}

.spinner-inner {
  position: absolute;
  width: 75%;
  height: 75%;
  border: 4px solid rgba(168, 85, 247, 0.1);
  border-bottom-color: var(--accent);
  border-radius: 50%;
  animation: spinCounter 1.8s linear infinite;
}

.spinner-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--primary);
  animation: pulse 1.5s ease-in-out infinite;
}

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

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

/* Progress Bar */
.progress-bar-wrapper {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  margin-top: 1.5rem;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 3px;
  transition: width 0.1s ease;
}

/* Success State */
.success-icon-wrapper {
  width: 4rem;
  height: 4rem;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.success-icon {
  width: 2.25rem;
  height: 2.25rem;
  color: var(--success);
}

.modal-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.result-preview-container {
  background: #000;
  border-radius: var(--border-radius-md);
  padding: 0.5rem;
  width: 100%;
  aspect-ratio: 4/3;
  max-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1.5rem;
}

.result-preview-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--border-radius-sm);
}

.meta-row {
  display: flex;
  gap: 1rem;
  width: 100%;
  margin-bottom: 2rem;
}

.meta-badge {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-md);
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

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

.meta-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.modal-actions .btn {
  flex: 1;
  padding: 0.75rem;
}
