:root {
  --primary-color: #6366f1;
  --secondary-color: #a855f7;
  --text-color: #1e293b;
  --text-light: #64748b;
  --bg-gradient-1: #4158d0;
  --bg-gradient-2: #c850c0;
  --bg-gradient-3: #ffcc70;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --input-bg: rgba(255, 255, 255, 0.8);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  background-color: #f3f4f6;
}

/* Animated Background */
.background-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: linear-gradient(45deg, var(--bg-gradient-1), var(--bg-gradient-2), var(--bg-gradient-3));
  background-size: 200% 200%;
  animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* Glass Container */
.glass-container {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 90%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin: auto;
}

header {
  text-align: center;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

/* Layout */
.app-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

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

  header h1 {
    font-size: 2rem;
  }
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-color);
}

input[type="url"],
select {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: var(--input-bg);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.3s ease;
  outline: none;
}

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

.color-group {
  display: flex;
  gap: 20px;
}

.color-group .form-group {
  flex: 1;
}

.color-input-wrapper {
  height: 48px;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: var(--input-bg);
  padding: 4px;
}

input[type="color"] {
  width: 100%;
  height: 100%;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 8px;
}

button[type="submit"] {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

button[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

button[type="submit"]:active {
  transform: translateY(0);
}

/* Result Section */
.result-section {
  background: rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  padding: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 350px;
  border: 1px dashed rgba(0, 0, 0, 0.1);
}

#generated {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

#qrcode {
  padding: 16px;
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: none;
  /* Hidden primarily, JS shows it */
}

#qrcode img {
  display: block;
}

#qrcode:empty {
  display: none;
}

/* Ensure QRCodeJS library actually puts content here correctly or we style the container when active */
#qrcode>* {
  display: block;
  /* The canvas or img */
}

/* Save Button (Dynamic) */
#save-link {
  display: inline-block;
  padding: 10px 24px;
  background-color: var(--text-color);
  color: white;
  text-decoration: none;
  border-radius: 50px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background 0.3s;
}

#save-link:hover {
  background-color: black;
}

/* Spinner */
#spinner {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loader {
  width: 48px;
  height: 48px;
  border: 5px solid #FFF;
  border-bottom-color: var(--primary-color);
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
}

@keyframes rotation {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}