/* ============================================
   PDPL Profile Poster Generator - Styles
   Mobile-first, WhatsApp-friendly layout
   ============================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-text: #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-border: #334155;
  --color-success: #22c55e;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body {
  margin: 0;
  padding: 20px;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* Form & Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

/* Upload Zone - drag and drop */
.upload-zone {
  position: relative;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  min-height: 140px;
  overflow: hidden;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--color-primary);
  background: rgba(59, 130, 246, 0.08);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-content {
  pointer-events: none;
}

.upload-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.upload-content p {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

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

.upload-preview {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.upload-zone.has-image .upload-content {
  display: none;
}

.upload-zone.has-image .upload-preview {
  display: flex;
}

.upload-preview img {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
  border-radius: 8px;
}

/* Input Group */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-size: 0.9rem;
  font-weight: 600;
}

.input-group input[type="text"] {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
}

.input-group input::placeholder {
  color: var(--color-text-muted);
}

.input-group input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Buttons - large for mobile */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  position: relative;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 2px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-border);
}

.btn-whatsapp {
  background: #25d366;
  color: white;
}

.btn-whatsapp:hover:not(:disabled) {
  background: #1da851;
}

/* Step layout */
.step {
  margin-bottom: 1.5rem;
}

.step-2 .step2-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Floating action buttons - centered, above safe area (mobile-friendly) */
.fab-group {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 20px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 9999;
  pointer-events: none;
  gap: 16px;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.7) 70%, transparent 100%);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.fab-group:not([hidden]) {
  display: flex !important;
}

.fab-group[hidden] {
  display: none !important;
}

.fab-group > * {
  pointer-events: auto;
}

.fab-icon-btn {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  padding: 0;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

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

.fab-create {
  background: var(--color-surface);
  color: var(--color-text);
  border: 2px solid var(--color-border);
}

.fab-create:hover {
  background: var(--color-border);
}

.fab-download {
  background: var(--color-primary);
  color: white;
}

.fab-download:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.fab-icon-btn .fab-icon {
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 1;
  display: block;
}

/* Share bottom sheet */
.share-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.share-sheet[hidden] {
  display: none !important;
}

.share-sheet[hidden] .share-sheet-backdrop,
.share-sheet[hidden] .share-sheet-content {
  pointer-events: none;
}

.share-sheet:not([hidden]) {
  pointer-events: auto;
}

.share-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.share-sheet-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  background: var(--color-surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.share-sheet-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.share-sheet-hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.share-sheet-btn {
  margin-top: 0.25rem;
}

/* Loading state */
.btn.loading .btn-text {
  visibility: hidden;
}

.btn.loading .btn-loader {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Preview Area */
.preview-wrapper {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.preview-inner {
  position: relative;
  width: 100%;
  max-width: 100%;
  /* 1080:2160 = 1:2 aspect ratio (matches frame 11" × 22") */
  aspect-ratio: 1 / 2;
  overflow: hidden;
  border-radius: 8px;
  background: #0a0f1a;
  cursor: grab;
  touch-action: none;
}

.preview-inner:active {
  cursor: grabbing;
}

.preview-inner canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  display: block;
}

.preview-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0.75rem 0 0;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  body {
    padding: 12px;
  }

  .title {
    font-size: 1.1rem;
  }

  .btn {
    padding: 1.1rem 1.25rem;
    font-size: 1.05rem;
  }
}
