/* Reset & Variáveis */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

:root {
  --bg-dark: #080b11;
  --bg-card: rgba(13, 17, 28, 0.7);
  --bg-input: rgba(255, 255, 255, 0.03);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --accent-primary: #6366f1;
  --accent-secondary: #a855f7;
  --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.15) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-x: hidden;
}

/* Layout Principal */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 40px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 10px;
}

.logo-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-gradient);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px -6px rgba(99, 102, 241, 0.5);
}

.logo-icon svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

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

/* Painel Principal */
.dashboard {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 30px;
  align-items: start;
}

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

/* Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-premium);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  border-color: var(--border-hover);
}

/* Alternador de Tipo de Card */
.card-type-container {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
}

.btn-type {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-type.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 15px -4px rgba(99, 102, 241, 0.4);
}

/* Formulários e Inputs */
.form-group {
  margin-bottom: 24px;
  position: relative;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.input-icon {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color 0.3s ease;
}

.input-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

input[type="text"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 16px 16px 48px;
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

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

input[type="text"]:focus + .input-icon {
  color: var(--accent-primary);
}

/* Custom Dropdown (Theme Selector) */
.custom-select-container {
  position: relative;
  user-select: none;
}

.custom-select-container select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  background: #0d121f;
  color: #fff;
  font-size: 1rem;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.custom-select-container:hover .custom-select-trigger {
  border-color: var(--border-hover);
}

.custom-select-container:focus-within .custom-select-trigger {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.custom-select-trigger-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chevron-icon {
  width: 18px;
  height: 18px;
  fill: var(--text-muted);
  transition: transform 0.3s ease;
}

.theme-preview-dots {
  display: flex;
  gap: 6px;
}

.theme-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Preview Section */
.preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  position: relative;
  width: 100%;
  max-width: 510px; /* 450px card + 60px padding */
  margin: 0 auto;
}

.preview-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  align-self: flex-start;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-title::before {
  content: '';
  display: block;
  width: 4px;
  height: 18px;
  background: var(--accent-gradient);
  border-radius: 2px;
}

.preview-wrapper {
  position: relative;
  width: 100%;
  max-width: 450px;
  margin: 0 auto;
  aspect-ratio: 2 / 1;
  background: rgba(255, 255, 255, 0.01);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.3s ease;
}

.preview-wrapper.loading {
  border-color: var(--accent-primary);
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  border-radius: var(--radius-md);
  animation: fadeIn 0.4s ease forwards;
}

/* Placeholder do preview */
.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  animation: fadeIn 0.4s ease forwards;
}

.placeholder-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
  animation: bounce 2s infinite ease-in-out;
}

.placeholder-text {
  font-size: 0.95rem;
  font-weight: 500;
}

/* Loader */
.loader {
  display: none;
  position: absolute;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 102, 241, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s infinite linear;
  z-index: 2;
}

/* Copy Output Boxes */
.output-section {
  width: 100%;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.output-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.3s ease;
}

.output-box:focus-within {
  border-color: rgba(99, 102, 241, 0.4);
}

.output-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  flex: 1;
}

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

.output-code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: all;
}

/* Botão de Copiar */
.btn-copy {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  min-width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-muted);
  position: relative;
}

.btn-copy:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: var(--border-hover);
}

.btn-copy:active {
  transform: scale(0.95);
}

.btn-copy svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.btn-copy.copied {
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
  color: #10b981;
  animation: pop 0.3s ease;
}

/* Notificação flutuante de cópia */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #10b981;
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 100;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Footer */
footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border-color);
  margin-top: 40px;
}

footer a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
  transition: text-decoration 0.2s;
}

footer a:hover {
  text-decoration: underline;
}

/* Animações */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

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

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Toggle Switch Group */
.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  margin-bottom: 0;
}

.toggle-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
  border: 1px solid var(--border-color);
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

input:checked + .slider {
  background: var(--accent-gradient);
  border-color: transparent;
}

input:checked + .slider:before {
  transform: translateX(22px);
  background-color: #fff;
}

/* Custom Colors Section Styling */
.custom-colors-section {
  display: none;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.custom-colors-section.visible {
  display: block;
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.custom-colors-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  width: 100%;
}

.custom-colors-header .section-title {
  margin-bottom: 0;
}

.btn-clear-colors {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-clear-colors:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn-clear-colors:active {
  transform: scale(0.95);
}

.btn-clear-colors svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 14px;
  background: var(--accent-gradient);
  border-radius: 1.5px;
}

.color-inputs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 480px) {
  .color-inputs-grid {
    grid-template-columns: 1fr;
  }
}

.color-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.color-input-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.color-input-container {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  gap: 10px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.color-input-container:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.color-input-container input[type="color"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: none;
  padding: 0;
}

.color-input-container input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input-container input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.color-input-container input[type="text"] {
  flex: 1;
  background: none;
  border: none;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  outline: none;
  padding: 6px 0;
  width: 100%;
}
