@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Playfair+Display:wght@600&display=swap');

:root {
  --bg: #f5f1ea;
  --ink: #2a2520;
  --accent: #1f6f54;
  --accent-2: #d45b38;
  --card: #ffffff;
  --border: #e3d8c7;
  --shadow: 0 18px 40px rgba(38, 32, 26, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #fff8ef, #f5f1ea 40%, #efe6d6 80%);
  min-height: 100vh;
}

header {
  padding: 24px 28px 0;
  max-width: 1100px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand img {
  width: 40px;
  height: 40px;
}

.brand h1 {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  letter-spacing: 0.04em;
}

main {
  padding: 28px;
  max-width: 1100px;
  margin: 0 auto;
}

.hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

/* remove decorative spot */

.hero h2 {
  margin-top: 0;
  font-size: 30px;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid.layout {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 20px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 160px;
}

.card h3 {
  margin: 0;
  font-size: 20px;
}

.card p {
  margin: 0;
  color: #5b4f42;
}

button, .button {
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 999px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

button:hover, .button:hover {
  transform: translateY(-1px);
  background: #235f48;
}

.button.secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.form-grid {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.form-grid input, .form-grid select {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 16px;
  width: 100%;
}

.preview-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: 20px 0;
}

.preview {
  background: #f9f4ed;
  border-radius: 16px;
  border: 1px dashed #e0d2be;
  min-height: 140px;
  aspect-ratio: 3 / 2;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 12px;
}

.preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.notice {
  padding: 12px 16px;
  background: #fff3e7;
  border: 1px solid #f1d2b7;
  border-radius: 12px;
  color: #7a3b1e;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.admin-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 16px;
  border: 1px solid var(--border);
}

.tab-bar {
  display: flex;
  gap: 10px;
  margin: 18px 0;
  flex-wrap: wrap;
}

.tab-button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

.tab-button.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.admin-card h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th, .table td {
  padding: 8px 6px;
  text-align: left;
  border-bottom: 1px solid #eee3d4;
}

.thumb {
  width: 56px;
  height: 38px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e6d7c3;
}

.thumb-button {
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 24, 19, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  width: min(640px, 92vw);
  height: min(70vh, 760px);
  box-shadow: 0 18px 40px rgba(38, 32, 26, 0.2);
  position: relative;
  overflow: hidden;
}

.modal-actions {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 10px;
}

.modal-image {
  width: 100%;
  height: calc(100% - 44px);
  object-fit: contain;
  display: block;
}


.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: #f3ede4;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #f0f6f2;
  color: #1f6f54;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions form {
  margin: 0;
}

.small {
  font-size: 12px;
  color: #6f6151;
}

.radio-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fffaf4;
}

.radio-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  background: #fff;
  box-shadow: 0 6px 16px rgba(38, 32, 26, 0.08);
}

.radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-card .radio-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #e6d7c3;
  display: grid;
  place-items: center;
  background: #f8f2e9;
}

.radio-card .icon-rect {
  display: block;
  background: #d45b38;
  border-radius: 6px;
}

.radio-card .icon-rect.landscape {
  width: 26px;
  height: 16px;
}

.radio-card .icon-rect.portrait {
  width: 16px;
  height: 26px;
}

.radio-card input[type="radio"]:checked ~ .radio-text {
  color: var(--accent);
}

.radio-card input[type="radio"]:checked ~ .radio-icon {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(31, 111, 84, 0.15);
}

.preview-grid.orientation-portrait .preview {
  aspect-ratio: 2 / 3;
}

.print-mock {
  background: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: inset 0 0 0 1px #efe6d6;
  padding: 16px;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px;
  flex-direction: column;
  border-radius: 0;
}

.preview.print-mock {
  border: 2px solid #e6d7c3;
  box-shadow: 0 10px 24px rgba(38, 32, 26, 0.12), inset 0 0 0 1px #efe6d6;
  padding: 0;
}

.page-upload .preview.print-mock {
  padding: 10px;
}

.preview.preview-debug {
  position: relative;
}

.preview.preview-debug .debug-overlay {
  position: absolute;
  inset: 0;
  border: 2px dashed rgba(31, 111, 84, 0.6);
  pointer-events: none;
}

.preview.preview-debug .debug-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: transparent;
}

.print-mock-photo {
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  background: #f9f4ed;
  border-radius: 12px;
  border: 1px dashed #e0d2be;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-align: center;
  color: #6f6151;
  font-weight: 500;
  cursor: pointer;
  position: relative;
}

.print-mock-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.print-mock-photo.has-cropper img {
  width: auto;
  height: auto;
  object-fit: unset;
}

.photo-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: rgba(42, 37, 32, 0.75);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.print-mock-photo.has-image .photo-remove {
  display: inline-flex;
}

.print-mock-photo.dragover {
  border-color: #1f6f54;
  box-shadow: inset 0 0 0 2px rgba(31, 111, 84, 0.25);
}

.print-mock-logo {
  width: 120px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.print-mock-footer {
  height: 64px;
  border-top: 1px solid #efe6d6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 0 0 14px 14px;
}

.preview-grid.orientation-portrait .print-mock-footer {
  height: 72px;
}

.preview-grid.orientation-portrait .print-mock {
  padding: 18px;
}

.preview-grid.orientation-portrait .print-mock-logo {
  width: 120px;
  height: 32px;
}

.crop-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.crop-controls .button.secondary {
  padding: 8px 14px;
  font-size: 14px;
}

.print-mock-photo .cropper-container {
  width: 100% !important;
  height: 100% !important;
}

.preview-grid.orientation-landscape .print-mock .print-mock-photo {
  aspect-ratio: 1630 / 945;
}

.preview-grid.orientation-portrait .print-mock .print-mock-photo {
  aspect-ratio: 1063 / 1512;
}

.preview-grid[data-layout="2"] .print-mock-photo {
  aspect-ratio: 756 / 945;
}

.preview-grid.orientation-landscape .preview.print-mock {
  aspect-ratio: 1748 / 1181;
}

.preview-grid.orientation-portrait .preview.print-mock {
  aspect-ratio: 1181 / 1748;
}

.layout-two {
  display: grid;
  gap: 20px;
}

.layout-two .preview-grid {
  grid-template-columns: 1fr;
}

.layout-two .preview.print-mock {
  aspect-ratio: 2 / 3;
}


.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.print-mock-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 720px) {
  main {
    padding: 18px;
  }

  .hero {
    padding: 20px;
  }

  header {
    padding: 18px;
  }

  .grid.layout {
    grid-template-columns: 1fr;
  }

  .radio-group {
    flex-direction: column;
    align-items: flex-start;
  }
}
