/* Shipa Content Tool - Mobile-first CSS */

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

:root {
  --shipa-blue: #0000FF;
  --shipa-blue-light: #e8e8ff;
  --white: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-400: #a3a3a3;
  --gray-600: #525252;
  --gray-800: #262626;
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
  font-family: var(--font);
  font-size: 16px;
  color: var(--gray-800);
  background: var(--gray-50);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--shipa-blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---- Header ---- */

.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 600px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  color: var(--gray-800);
}

.brand-shipa {
  color: var(--shipa-blue);
}

.brand-content {
  color: var(--gray-600);
  font-weight: 400;
}

.header-nav a {
  font-size: 14px;
  color: var(--gray-600);
}

.header-nav a:hover {
  color: var(--shipa-blue);
}

/* ---- Main content ---- */

.main-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  width: 100%;
  flex: 1;
}

/* ---- Alerts ---- */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-success {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid #bbf7d0;
}

.alert-error {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid #fecaca;
}

/* ---- Status badges ---- */

.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-draft {
  background: var(--gray-200);
  color: var(--gray-600);
}

.status-published {
  background: var(--green-light);
  color: var(--green);
}

.status-archived {
  background: var(--gray-100);
  color: var(--gray-400);
}

/* ---- Batch list ---- */

.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
}

.batch-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.batch-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.batch-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--shipa-blue);
  text-decoration: none;
}

.batch-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.batch-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
  flex: 1;
}

.batch-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--gray-400);
}

/* ---- Batch header ---- */

.batch-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  margin: -16px -16px 20px;
  padding: 16px;
}

.batch-header-inner {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.batch-title-large {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.batch-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--gray-600);
}

.batch-item-count {
  color: var(--gray-400);
}

.batch-nav-select {
  font-size: 13px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  background: var(--white);
  color: var(--gray-800);
  cursor: pointer;
}

/* ---- Item cards ---- */

.items-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.item-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.item-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.item-topic {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
}

.item-date {
  font-size: 12px;
  color: var(--gray-400);
}

.item-slug {
  font-size: 11px;
  color: var(--gray-400);
  font-family: monospace;
}

.version-badge {
  font-size: 11px;
  background: var(--shipa-blue-light);
  color: var(--shipa-blue);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---- Image grid ---- */

.image-grid {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
}

.image-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
}

.item-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: block;
  transition: opacity 0.15s ease;
}

.item-image:hover {
  opacity: 0.9;
}

.image-label {
  display: block;
  text-align: center;
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 4px;
}

/* ---- Text overlay ---- */

.text-overlay-block {
  padding: 10px 14px;
  border-top: 1px solid var(--gray-100);
}

.text-overlay-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
  display: block;
  margin-bottom: 4px;
}

.text-overlay-content {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
}

/* ---- Caption tabs ---- */

.caption-block {
  padding: 0 14px 12px;
  border-top: 1px solid var(--gray-100);
  padding-top: 12px;
}

.caption-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.caption-tab {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s ease;
}

.caption-tab:hover {
  border-color: var(--shipa-blue);
  color: var(--shipa-blue);
}

.caption-tab.active {
  background: var(--shipa-blue);
  border-color: var(--shipa-blue);
  color: var(--white);
}

.caption-content {
  display: none;
  font-size: 14px;
  line-height: 1.6;
  color: var(--gray-800);
}

.caption-content.active {
  display: block;
}

/* ---- Hashtags ---- */

.hashtags-block {
  padding: 0 14px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.hashtag {
  font-size: 12px;
  color: var(--shipa-blue);
  background: var(--shipa-blue-light);
  padding: 2px 8px;
  border-radius: 999px;
}

.hashtag-raw {
  font-size: 12px;
  color: var(--gray-600);
}

/* ---- Selection block ---- */

.selection-block {
  padding: 10px 14px;
  border-top: 1px solid var(--gray-100);
  font-size: 13px;
}

.selection-approved {
  background: #f0fdf4;
}

.selection-pending {
  background: #fffbeb;
}

.selection-label {
  display: block;
  margin-bottom: 4px;
  color: var(--gray-800);
}

.selection-detail {
  font-size: 13px;
  color: var(--gray-600);
  margin-top: 4px;
}

.selection-note {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
  font-style: italic;
}

/* ---- Selection form ---- */

.selection-form-block {
  border-top: 1px solid var(--gray-100);
}

.selection-details {
  width: 100%;
}

.selection-summary {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--shipa-blue);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.selection-summary::-webkit-details-marker {
  display: none;
}

.selection-summary::before {
  content: "+ ";
  font-weight: 700;
}

details[open] .selection-summary::before {
  content: "- ";
}

.selection-form {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.form-group label:first-child {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-600);
}

.image-choice-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.image-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 12px;
  color: var(--gray-600);
}

.image-choice input[type="radio"] {
  display: none;
}

.choice-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: border-color 0.15s ease;
}

.image-choice input[type="radio"]:checked + .choice-thumb {
  border-color: var(--shipa-blue);
}

.radio-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

textarea {
  width: 100%;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font);
  resize: vertical;
  color: var(--gray-800);
  transition: border-color 0.15s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--shipa-blue);
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn:hover {
  opacity: 0.88;
}

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

/* ---- Empty state ---- */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-400);
  font-size: 15px;
}

/* ---- Lightbox ---- */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.lightbox.open {
  display: flex;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.lightbox-inner {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius);
}

.lightbox-label {
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  text-align: center;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: var(--white);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}

/* ---- Responsive - larger screens ---- */

@media (min-width: 640px) {
  .main-content {
    padding: 24px 20px;
  }

  .batch-header {
    margin: -24px -20px 24px;
    padding: 20px;
  }

  .item-image {
    height: 260px;
  }
}
