/* ============================================
   TubeQR — Scoped styles (prefixed to avoid conflicts)
   ============================================ */

.tubeqr-app {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  min-height: 100vh;
  cursor: default;
}

.tubeqr-app.tubeqr-embedded {
  min-height: auto;
  padding: 1rem 0 0;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
.tubeqr-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.tubeqr-back {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--accent, #6c63ff);
  opacity: 0.8;
  text-decoration: none;
  transition: opacity 0.2s;
}

.tubeqr-back:hover { opacity: 1; }

.tubeqr-logo {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent, #6c63ff), var(--accent2, #00d4aa));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.tubeqr-logo-icon {
  -webkit-text-fill-color: var(--accent, #6c63ff);
  font-size: 2rem;
}

.tubeqr-subtitle {
  color: var(--muted, #555);
  margin-top: 0.5rem;
  font-weight: 300;
  font-size: 1.1rem;
}

/* ─── Tabs ─────────────────────────────────────────────────────────────── */
.tubeqr-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  background: var(--card-bg, rgba(15, 15, 25, 0.8));
  backdrop-filter: blur(20px);
  border: 1px solid var(--border, rgba(108, 99, 255, 0.15));
  border-radius: 16px;
  padding: 0.4rem;
}

.tubeqr-tab {
  flex: 1;
  padding: 0.9rem 1.5rem;
  border: none;
  background: transparent;
  color: var(--muted, #555);
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.tubeqr-tab:hover {
  color: var(--text, #e8e6e3);
  background: rgba(255, 255, 255, 0.05);
}

.tubeqr-tab.active {
  background: linear-gradient(135deg, var(--accent, #6c63ff), #8b5cf6);
  color: white;
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.4);
}

/* ─── Panels ─────────────────────────────────────────────────────────────── */
.tubeqr-panel {
  display: none;
  animation: tubeqr-fadeIn 0.4s ease;
}

.tubeqr-panel.active { display: block; }

@keyframes tubeqr-fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.tubeqr-card {
  background: var(--card-bg, rgba(15, 15, 25, 0.8));
  backdrop-filter: blur(20px);
  border: 1px solid var(--border, rgba(108, 99, 255, 0.15));
  border-radius: 16px;
  padding: 2rem;
  transition: border-color 0.3s;
}

.tubeqr-card:hover {
  border-color: rgba(108, 99, 255, 0.3);
}

/* ─── Inputs ─────────────────────────────────────────────────────────────── */
.tubeqr-input-group {
  display: flex;
  gap: 0.75rem;
}

.tubeqr-input-group.vertical {
  flex-direction: column;
  gap: 0.5rem;
}

.tubeqr-input-group.vertical label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted, #555);
}

.tubeqr-app input[type="url"],
.tubeqr-app textarea,
.tubeqr-app select {
  flex: 1;
  padding: 0.85rem 1.2rem;
  border: 1px solid var(--border, rgba(108, 99, 255, 0.15));
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: rgba(10, 10, 30, 0.6);
  color: var(--text, #e8e6e3);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.tubeqr-app input[type="url"]:focus,
.tubeqr-app textarea:focus,
.tubeqr-app select:focus {
  border-color: var(--accent, #6c63ff);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.3);
}

.tubeqr-app input::placeholder,
.tubeqr-app textarea::placeholder {
  color: var(--muted, #555);
  opacity: 0.6;
}

.tubeqr-app textarea { resize: vertical; min-height: 80px; }

.tubeqr-app select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a0a0c0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2.5rem;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.tubeqr-btn-primary {
  padding: 0.85rem 2rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent, #6c63ff), #8b5cf6);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.tubeqr-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(108, 99, 255, 0.4);
}

.tubeqr-btn-primary.loading .tubeqr-btn-text { opacity: 0; }
.tubeqr-btn-primary.loading .tubeqr-btn-loader { opacity: 1; }

.tubeqr-btn-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.tubeqr-btn-loader::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: tubeqr-spin 0.6s linear infinite;
}

@keyframes tubeqr-spin { to { transform: rotate(360deg); } }

.tubeqr-btn-download {
  width: 100%;
  margin-top: 1.5rem;
  padding: 1rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #00b894, var(--accent2, #00d4aa));
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: transform 0.2s, box-shadow 0.3s;
}

/* ─── Download Progress Bar ─────────────────────────────────────────────── */
#download-progress {
  display: none;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.5rem 0;
}

#download-progress .progress-track {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

#download-progress .progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, #00b894, var(--accent2, #00d4aa));
  transition: width 0.3s ease;
}

#download-progress .progress-text {
  font-size: 0.85rem;
  color: var(--accent, #6c63ff);
  min-width: 5ch;
  text-align: right;
  font-weight: 600;
}

.tubeqr-btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 206, 201, 0.3);
}

/* ─── Video Info ─────────────────────────────────────────────────────────── */
.tubeqr-video-info {
  margin-top: 2rem;
  animation: tubeqr-fadeIn 0.4s ease;
}

.tubeqr-video-preview {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  margin-bottom: 1.5rem;
}

.tubeqr-video-preview img {
  width: 200px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.tubeqr-video-meta h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.tubeqr-video-meta p {
  color: var(--muted, #555);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.tubeqr-download-options { padding-top: 1rem; }

.tubeqr-download-options h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted, #555);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.tubeqr-option-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tubeqr-option-row label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted, #555);
  min-width: 120px;
}

.tubeqr-option-row span {
  font-size: 0.85rem;
  color: var(--muted, #555);
  min-width: 45px;
  text-align: right;
}

.tubeqr-format-toggle {
  display: flex;
  gap: 0.5rem;
  flex: 1;
}

.tubeqr-format-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border, rgba(108, 99, 255, 0.15));
  border-radius: 10px;
  background: transparent;
  color: var(--muted, #555);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s;
}

.tubeqr-format-btn.active {
  background: rgba(108, 99, 255, 0.2);
  border-color: var(--accent, #6c63ff);
  color: var(--text, #e8e6e3);
}

/* ─── QR Code ─────────────────────────────────────────────────────────────── */
.tubeqr-qr-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.tubeqr-qr-options { margin-top: 1.5rem; }

.tubeqr-qr-options h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted, #555);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.tubeqr-color-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.tubeqr-color-pick {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tubeqr-color-pick label {
  font-size: 0.85rem;
  color: var(--muted, #555);
}

.tubeqr-app input[type="color"] {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border, rgba(108, 99, 255, 0.15));
  border-radius: 8px;
  cursor: pointer;
  background: none;
  padding: 2px;
}

.tubeqr-app input[type="range"] {
  flex: 1;
  accent-color: var(--accent, #6c63ff);
  cursor: pointer;
}

.tubeqr-qr-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tubeqr-qr-result {
  width: 100%;
  aspect-ratio: 1;
  max-width: 350px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border, rgba(108, 99, 255, 0.15));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.tubeqr-qr-result img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1rem;
}

.tubeqr-qr-placeholder {
  text-align: center;
  color: var(--muted, #555);
}

.tubeqr-qr-placeholder p {
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* ─── Error Message ─────────────────────────────────────────────────────── */
.tubeqr-error-msg {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 10px;
  color: #ff6b6b;
  font-size: 0.9rem;
  animation: tubeqr-fadeIn 0.3s ease;
}

/* ─── Utilities ─────────────────────────────────────────────────────────── */
.tubeqr-app .hidden { display: none !important; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .tubeqr-app { padding: 1.5rem 1rem; }
  .tubeqr-logo { font-size: 1.8rem; }
  .tubeqr-input-group { flex-direction: column; }
  .tubeqr-video-preview {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .tubeqr-video-preview img { width: 100%; max-width: 300px; }
  .tubeqr-qr-layout { grid-template-columns: 1fr; }
  .tubeqr-tabs { flex-direction: column; }
}
