/* Fonts are defined in app.css — SaudiWeb primary, Tajawal fallback */

.card-container {
  background: #f8fafc;
  min-height: 100vh;
  padding: 1.25rem 0.875rem;
  font-family: var(--gh-font-family);
}

.control-panel {
  background: #fff;
  border-radius: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
}

.color-option {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px #cbd5e1;
  transition: 0.3s;
  flex: 0 0 auto;
}

.color-option.active {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px #10b981;
}

.bg-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.bg-thumb {
  aspect-ratio: 9 / 16;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid #f1f5f9;
  background-size: cover;
  background-position: center;
  transition: 0.2s;
}

.bg-thumb.active {
  border-color: #10b981;
  transform: scale(0.95);
}

.preview-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.canvas-frame {
  width: min(100%, 420px);
  background: #fff;
  border-radius: 1.25rem;
  padding: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  margin-inline: auto;
}

#canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  border-radius: 1rem;
  cursor: move;
  touch-action: none;
  background: #fff;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
  flex: 0 0 auto;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: #fff;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #10b981;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.font-size-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  font-weight: bold;
  color: #334155;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.font-size-btn:hover {
  background: #e2e8f0;
}

.font-size-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 1023px) {
  .card-container {
    padding: 1rem 0.75rem 2rem;
  }

  .canvas-frame {
    width: min(100%, 360px);
    padding: 8px;
  }

  .control-panel {
    border-radius: 1.25rem;
  }
}

@media (max-width: 640px) {
  .bg-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .canvas-frame {
    width: min(100%, 320px);
  }

  .color-option {
    width: 36px;
    height: 36px;
  }
}
