/* ============================================
   Social Frame Generator — Styles
   ============================================ */

:root {
  --gdi-green: #0DA37B;
  --gdi-neon: #00FF6D;
  --gdi-black: #000000;
  --gdi-white: #FFFFFF;
  --gdi-off: #F5F5F5;
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Helvetica, Arial, sans-serif;
  background: var(--gdi-white);
  color: var(--gdi-black);
  min-height: 100vh;
  min-height: 100svh;
}

/* --- Navbar --- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 20px;
  border-bottom: 1px solid #eee;
  background: white;
}

.nav-logo-img {
  height: 28px;
  width: auto;
  display: block;
}

/* --- Hero --- */
.hero {
  padding: 40px 20px 28px;
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.hero h1 {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 10px;
}

.hero p {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.45);
  line-height: 1.5;
  max-width: 480px;
  margin: 0 auto;
}

/* --- Main --- */
.main {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 20px 48px;
}

/* --- Card --- */
.card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* --- Preview Frame --- */
.preview-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  background: #f1f5f9;
}

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

.preview-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* --- Controls --- */
.controls {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#fileInput {
  display: none;
}

/* Upload button */
.btn-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
  background: #f1f5f9;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-upload:hover {
  background: #e2e8f0;
}

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

/* Editor controls (shown after upload) */
.editor-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.editor-controls.hidden {
  display: none;
}

/* Drag hint */
.drag-hint {
  text-align: center;
  font-size: 11px;
  color: rgba(0, 0, 0, 0.3);
}

/* Zoom bar */
.zoom-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zoom-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.zoom-slider-wrap {
  flex: 1;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: #E0E0E0;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gdi-green);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gdi-green);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Buttons */
.btn-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn {
  flex: 1;
  padding: 14px 20px;
  font-family: 'Roboto', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

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

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

.btn-primary:hover {
  background: #0b8a68;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(13, 163, 123, 0.3);
}

.btn-share {
  background: var(--gdi-black);
  color: white;
}

.btn-share:hover {
  background: #333;
}

.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 32px 20px;
  border-top: 1px solid #eee;
  margin-top: 32px;
}

.footer-text {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.25);
  letter-spacing: 0.5px;
}

.footer-text a {
  color: var(--gdi-green);
  text-decoration: none;
}

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

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  z-index: 1000;
  padding: 0.75rem 1.25rem;
  background: var(--gdi-black);
  color: var(--gdi-white);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
  max-width: calc(100vw - 2rem);
  text-align: center;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* --- Responsive --- */
@media (min-width: 520px) {
  .navbar {
    padding: 24px 32px;
  }

  .nav-logo-img {
    height: 34px;
  }

  .hero {
    padding: 48px 32px 32px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero p {
    font-size: 15px;
  }

  .btn-row {
    flex-direction: row;
  }
}

/* --- Safe area --- */
@supports (padding: env(safe-area-inset-bottom)) {
  .footer {
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
  }

  .toast {
    bottom: calc(1.5rem + env(safe-area-inset-bottom));
  }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
