:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --secondary-color: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --border-color: #334155;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --border-radius: 12px;
  --border-radius-lg: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
  transition: all 0.3s ease;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.1rem 2rem 2rem 2rem;
}

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

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 0.2rem;
  margin-bottom: 0.2rem;
}

.logo i {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.75rem;
  border-radius: var(--border-radius);
  backdrop-filter: blur(10px);
}

.logo img {
  height: 7rem;
  max-width: 100%;
  display: block;
  border-radius: 50%;
}
.logo span {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.subtitle {
  font-size: 1.25rem;
  color: rgba(255,255,255,0.85);
  margin-top: 0.2rem;
  line-height: 1.5;
  margin-bottom: 0.2rem;
}
.header {
  margin-bottom: 1.2rem;
  margin-top: 1.2rem;
}
@media (max-width: 640px) {
  .logo {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
  }
  .logo img {
    height: 3.5rem;
  }
  .logo span {
    font-size: 2rem;
  }
  .subtitle {
    font-size: 1.05rem;
  }
  .header {
    margin-bottom: 0.8rem;
    margin-top: 0.8rem;
  }
}

/* Main Content */
.main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 768px) {
  .main-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* Upload Section */
.upload-section, .preview-section {
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--border-radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 500px;
  height: 98%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}

.section-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-bottom {
  margin-top: 2rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 2rem;
}

.upload-area:hover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.05);
}

.upload-area.dragover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
  transform: scale(1.02);
}

.upload-icon {
  font-size: 3rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.upload-text {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.upload-hint {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.file-input {
  display: none;
}

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-label {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: '⌄';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
}

select {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--secondary-color);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  transition: all 0.3s ease;
}

input[type="password"] {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--secondary-color);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

input[type="password"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-2px);
}

/* Progress */
.progress-container {
  background: var(--secondary-color);
  border-radius: var(--border-radius);
  padding: 0.25rem;
  margin: 1.5rem 0;
  display: none;
  box-shadow: var(--shadow-sm);
}

.progress-bar {
  height: 0.5rem;
  background: linear-gradient(90deg, var(--primary-color), #8b5cf6);
  border-radius: var(--border-radius);
  transition: width 0.4s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Spinner */
.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 1rem auto;
  display: none;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Preview Section */
.preview-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 0%;
  text-align: center;
  height: 100%;
  min-height: 0;
}

.preview-placeholder {
  color: var(--text-secondary);
  font-size: 1.125rem;
}

.preview-placeholder i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.preview-card {
  display: inline-block;
  box-shadow: var(--shadow-xl);
  background: rgba(30, 41, 59, 0.95);
  border-radius: var(--border-radius-lg);
  padding: 0;
  margin: 0 auto;
  /* No fixed width or min-height */
}
.preview-image {
  display: block;
  max-width: 100%;
  max-height: 400px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--border-radius);
  margin: 0;
  box-shadow: none; /* Remove shadow from image itself */
}

.preview-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Error/Success Messages */
.message {
  padding: 1rem;
  border-radius: var(--border-radius);
  margin: 1rem 0;
  font-weight: 500;
}

.message.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error-color);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.message.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Responsive Design */
@media (max-width: 640px) {
  .container {
    padding: 1rem;
  }
  
  .upload-section,
  .preview-section {
    padding: 1.5rem;
  }
  
  .logo {
    font-size: 1.5rem;
  }
  
  .theme-switcher {
    top: 1rem;
    right: 1rem;
  }
}

/* Animations */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scale-in {
  animation: scaleIn 0.3s ease-out;
}

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

/* Toggle Switch Styles */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  vertical-align: middle;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #334155;
  transition: background 0.3s;
  border-radius: 34px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  transition: transform 0.3s;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.toggle-switch input:checked + .slider {
  background: var(--primary-color);
}
.toggle-switch input:checked + .slider:before {
  transform: translateX(20px);
  background: #fff;
}
.toggle-switch .slider {
  box-sizing: border-box;
  border: 2px solid #222b3a;
}
/* Color Picker Styles */
#colorPickerGroup {
  transition: opacity 0.2s;
}
#bgColorPicker {
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  border-radius: 8px;
  border: 2px solid #334155;
  background: #1e293b;
  outline: none;
  transition: border 0.2s;
}
#bgColorPicker:focus {
  border: 2px solid var(--primary-color);
} 
