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

:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary-color: #8b5cf6;
  --accent-color: #ec4899;
  --success-color: #10b981;
  --error-color: #ef4444;
  --text-dark: #1f2937;
  --text-light: #6b7280;
  --bg-light: #f9fafb;
  --bg-body: #f5f5f7;
  --bg-card: #ffffff;
  --border-color: #e5e7eb;
  --slider-thumb: #ffffff;
  --preview-gradient-start: #f8f9fa;
  --preview-gradient-end: #e9ecef;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --primary-color: #818cf8;
  --primary-dark: #6366f1;
  --primary-light: #a5b4fc;
  --secondary-color: #a78bfa;
  --accent-color: #f472b6;
  --success-color: #34d399;
  --error-color: #f87171;
  --text-dark: #f9fafb;
  --text-light: #9ca3af;
  --bg-light: #1f2937;
  --bg-body: #111827;
  --bg-card: #1f2937;
  --border-color: #374151;
  --slider-thumb: #1f2937;
  --preview-gradient-start: #1f2937;
  --preview-gradient-end: #111827;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
}

body {
  font-family: Roboto, sans-serif;
  background: var(--bg-body);
  min-height: 100vh;
  padding: 40px 20px;
  color: var(--text-dark);
  line-height: 1.6;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

header {
  text-align: center;
  color: var(--text-dark);
  margin-bottom: 50px;
  animation: fadeInDown 0.8s ease-out;
}

header h1 {
  font-size: 4rem;
  margin-bottom: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--primary-color);
}

header p {
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--text-light);
}

.content {
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: 40px;
  margin-top: 40px;
}

@media (max-width: 1100px) {
  .content {
    grid-template-columns: 1fr;
    max-width: 600px;
    margin: 40px auto 0;
  }
}

.form-section,
.preview-section {
  background: var(--bg-card);
  padding: 40px;
  border-radius: 20px;
  box-shadow: var(--shadow-xl);
  animation: fadeInUp 0.8s ease-out;
  backdrop-filter: blur(10px);
  transition: background 0.3s ease;
}

h2 {
  margin-bottom: 30px;
  color: var(--primary-color);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.form-group {
  margin-bottom: 28px;
}

label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text-dark);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

input[type="text"],
select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: var(--bg-card);
  color: var(--text-dark);
}

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

input[type="text"]:hover,
select:hover {
  border-color: var(--primary-light);
}

.range-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  cursor: pointer;
  background: transparent;
  --range-progress: 50%;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  border-radius: 10px;
  background: linear-gradient(
    to right,
    var(--primary-color) 0%,
    var(--primary-color) var(--range-progress),
    var(--border-color) var(--range-progress),
    var(--border-color) 100%
  );
  border: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--slider-thumb);
  border: 3px solid var(--primary-color);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: var(--shadow-lg);
}

input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.05);
}

/* Firefox */
input[type="range"]::-moz-range-track {
  width: 100%;
  height: 8px;
  border-radius: 10px;
  background: var(--border-color);
  border: none;
}

input[type="range"]::-moz-range-progress {
  height: 8px;
  border-radius: 10px 0 0 10px;
  background: var(--primary-color);
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--slider-thumb);
  border: 3px solid var(--primary-color);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: var(--shadow-lg);
}

input[type="range"]::-moz-range-thumb:active {
  transform: scale(1.05);
}

.value-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  height: 40px;
  padding: 0 12px;
  font-weight: 700;
  color: var(--primary-color);
  background: var(--bg-light);
  border-radius: 10px;
  font-size: 1.1rem;
  border: 1px solid var(--border-color);
}

.btn-primary,
.btn-secondary {
  padding: 16px 32px;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.02em;
}

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

.btn-primary:hover {
  transform: scale(1.02);
  background: var(--primary-dark);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--text-dark);
  border: 2px solid var(--border-color);
  padding: 14px 24px;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: scale(1.02);
}

.btn-secondary:active {
  transform: scale(0.98);
}

.preview-container {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    135deg,
    var(--preview-gradient-start) 0%,
    var(--preview-gradient-end) 100%
  );
  border-radius: 16px;
  padding: 40px;
  margin-bottom: 25px;
  border: 2px dashed var(--border-color);
  transition: all 0.3s ease;
}

.preview-container:has(img) {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
}

.preview-container img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  animation: fadeIn 0.5s ease-out;
}

.placeholder {
  color: var(--text-light);
  font-style: italic;
  text-align: center;
  font-size: 1.05rem;
}

.url-section {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 2px solid var(--border-color);
  animation: fadeIn 0.5s ease-out;
}

.url-section h3 {
  margin-bottom: 15px;
  color: var(--text-dark);
  font-size: 1.15rem;
  font-weight: 600;
}

.url-container {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.url-container input {
  flex: 1;
  font-size: 0.9rem;
  font-family: "Monaco", "Menlo", "Courier New", monospace;
}

.hidden {
  display: none;
}

.markdown-hint {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--bg-light);
  border-radius: 10px;
  border-left: 3px solid var(--primary-color);
}

.markdown-hint code {
  background: var(--bg-card);
  padding: 6px 10px;
  border-radius: 6px;
  font-family: "Monaco", "Menlo", "Courier New", monospace;
  font-size: 0.85rem;
  word-break: break-all;
  display: block;
  margin-top: 8px;
  border: 1px solid var(--border-color);
  color: var(--text-dark);
}

.error {
  color: var(--error-color);
  font-size: 0.95rem;
  margin-top: 8px;
  font-weight: 500;
}

/* Animations */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

footer {
  width: 100%;
  margin-top: auto;
  text-align: center;
  padding: 32px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
}

.logo {
  perspective: 600px;
  cursor: pointer;
}

.logo span {
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out;
  will-change: transform;
}

a.logo {
  color: var(--primary-color);
  text-decoration: none;
  transition: all 0.2s ease-in-out;
}

a.logo:hover {
  color: var(--primary-light);
  transform: scale(1.2);
}

.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

.notification {
  background: var(--bg-card);
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: var(--shadow-xl);
  min-width: 300px;
  max-width: 500px;
  opacity: 0;
  transform: translateX(400px);
  transition:
    opacity 0.3s ease-out,
    transform 0.3s ease-out;
  border-left: 4px solid var(--primary-color);
  pointer-events: all;
}

.notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification-error {
  border-left-color: var(--error-color);
}

[data-theme="light"] .notification-error {
  background: #fef2f2;
}

[data-theme="dark"] .notification-error {
  background: rgba(239, 68, 68, 0.1);
}

.notification-success {
  border-left-color: var(--success-color);
}

[data-theme="light"] .notification-success {
  background: #f0fdf4;
}

[data-theme="dark"] .notification-success {
  background: rgba(52, 211, 153, 0.1);
}

.notification-info {
  border-left-color: var(--primary-color);
}

[data-theme="light"] .notification-info {
  background: #eff6ff;
}

[data-theme="dark"] .notification-info {
  background: rgba(129, 140, 248, 0.1);
}

.notification ul {
  margin: 0;
  padding-left: 20px;
}

.notification li {
  margin: 4px 0;
  color: var(--text-dark);
}

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  z-index: 999;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  header h1 {
    font-size: 2.5rem;
  }

  header p {
    font-size: 1.1rem;
  }

  .form-section,
  .preview-section {
    padding: 30px 25px;
  }

  .url-container {
    flex-direction: column;
  }

  .btn-secondary {
    width: 100%;
  }

  .notification {
    right: 10px;
    left: 10px;
    min-width: auto;
  }
}
