/* ══════════════════════════════════════════════
   Moments Made Clear — Portal Stylesheet
   ══════════════════════════════════════════════ */

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

/* ── Variables ── */
:root {
  --cream:       #F5F0EA;
  --cream-dark:  #EDE5DA;
  --terracotta:  #C47B5C;
  --terra-dark:  #A5623E;
  --brown:       #3D3530;
  --mid-brown:   #7A6E68;
  --light-brown: #B0A59D;
  --border:      #E2D8CC;
  --white:       #FFFFFF;
  --success:     #5A8A6A;
  --warning:     #C9924A;
  --error:       #B05050;
  --error-bg:    #FDF0F0;

  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans:  'Lato', 'Helvetica Neue', Arial, sans-serif;

  --radius: 6px;
  --shadow: 0 2px 12px rgba(61,53,48,0.08);
  --shadow-md: 0 4px 24px rgba(61,53,48,0.12);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--brown);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--terracotta);
  line-height: 1.3;
}

h1 { font-size: 1.9rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.4rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
h4 { font-size: 0.95rem; color: var(--mid-brown); font-family: var(--font-sans); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

p { margin-bottom: 0.75rem; color: var(--brown); }
p:last-child { margin-bottom: 0; }

a { color: var(--terracotta); text-decoration: none; }
a:hover { text-decoration: underline; }

small { font-size: 0.8rem; color: var(--mid-brown); }

/* ── Layout ── */
.page-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.page-wrap--wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Header / Nav ── */
.site-header {
  background: var(--brown);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .logo {
  height: 36px;
  width: auto;
}

.site-header .header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-header .header-user {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
}

.site-header .header-link {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
}

.site-header .header-link:hover { color: #fff; }

/* ── Card ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.card--tight { padding: 1.25rem 1.5rem; }

/* ── Section divider ── */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ── Forms ── */
.field-group {
  margin-bottom: 1.25rem;
}

.field-group:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--brown);
  margin-bottom: 0.4rem;
}

label .required-star {
  color: var(--terracotta);
  margin-left: 2px;
}

label .optional-note {
  font-weight: 400;
  color: var(--mid-brown);
  font-size: 0.8rem;
  margin-left: 4px;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.925rem;
  color: var(--brown);
  background: var(--white);
  transition: border-color 0.15s;
  appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(196,123,92,0.12);
}

textarea { resize: vertical; min-height: 90px; }

.field-hint {
  font-size: 0.8rem;
  color: var(--mid-brown);
  margin-top: 0.3rem;
  font-style: italic;
}

/* Checkboxes and radios */
.check-group, .radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.check-item, .radio-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
}

.check-item input[type="checkbox"],
.radio-item input[type="radio"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin-top: 3px;
  accent-color: var(--terracotta);
  cursor: pointer;
}

.check-item label, .radio-item label {
  font-weight: 400;
  font-size: 0.9rem;
  margin-bottom: 0;
  cursor: pointer;
}

.check-item label strong, .radio-item label strong {
  display: block;
  font-weight: 700;
}

.check-item label span, .radio-item label span {
  font-size: 0.82rem;
  color: var(--mid-brown);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--terracotta);
  color: var(--white);
}
.btn-primary:hover { background: var(--terra-dark); }

.btn-secondary {
  background: transparent;
  color: var(--terracotta);
  border: 1.5px solid var(--terracotta);
}
.btn-secondary:hover { background: rgba(196,123,92,0.08); }

.btn-ghost {
  background: transparent;
  color: var(--mid-brown);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--cream-dark); }

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

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

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1rem;
}

.btn-full { width: 100%; }

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

/* Button row */
.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.btn-row--right { justify-content: flex-end; }
.btn-row--center { justify-content: center; }
.btn-row--apart { justify-content: space-between; }

/* ── Alerts / Messages ── */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.alert-success {
  background: #EAF3EC;
  color: #2D6B3B;
  border: 1px solid #B5D9BC;
}

.alert-warning {
  background: #FDF4E7;
  color: #7A5520;
  border: 1px solid #F0D5A0;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid #F0C0C0;
}

.alert-info {
  background: #EBF2F9;
  color: #2B5F8A;
  border: 1px solid #BAD4EC;
}

/* ── Progress Steps ── */
.progress-steps {
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
}

.step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--light-brown);
}

.step.active { color: var(--terracotta); font-weight: 700; }
.step.done { color: var(--success); }

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--cream-dark);
  color: var(--light-brown);
  flex-shrink: 0;
}

.step.active .step-num {
  background: var(--terracotta);
  color: var(--white);
}

.step.done .step-num {
  background: var(--success);
  color: var(--white);
}

.step-connector {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 0.5rem;
}

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--cream);
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--terracotta);
  background: rgba(196,123,92,0.04);
}

.upload-zone input[type="file"] { display: none; }

.upload-icon {
  font-size: 2rem;
  color: var(--light-brown);
  margin-bottom: 0.5rem;
}

.upload-zone p {
  font-size: 0.875rem;
  color: var(--mid-brown);
}

.upload-zone .upload-link {
  color: var(--terracotta);
  font-weight: 700;
  cursor: pointer;
}

.upload-zone small {
  display: block;
  margin-top: 0.25rem;
}

/* File preview list */
.file-list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.file-item-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--cream-dark);
}

.file-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--brown);
}

.file-item-size { color: var(--mid-brown); font-size: 0.8rem; white-space: nowrap; }

.file-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--light-brown);
  font-size: 1rem;
  padding: 0 0.25rem;
  transition: color 0.15s;
}

.file-item-remove:hover { color: var(--error); }

/* Upload progress bar */
.upload-progress {
  margin-top: 0.5rem;
}

.progress-bar-wrap {
  background: var(--cream-dark);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--terracotta);
  border-radius: 99px;
  transition: width 0.2s;
}

.progress-label {
  font-size: 0.78rem;
  color: var(--mid-brown);
  margin-top: 0.25rem;
}

/* ── Image card (for admin thumbnail view) ── */
.image-thumb-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}

.image-thumb-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

.thumb-preview {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--cream-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.thumb-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.image-thumb-card .thumb-info {
  padding: 0.6rem 0.75rem;
}

.image-thumb-card .thumb-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brown);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-thumb-card .thumb-status { font-size: 0.75rem; }

/* ── Status badges ── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-new      { background: #E8F4FD; color: #2B6CB0; }
.badge-quote    { background: #FDF4E7; color: #92400E; }
.badge-active   { background: #EAF3EC; color: #276749; }
.badge-proof    { background: #F3EEF9; color: #6B46C1; }
.badge-approved { background: #EAF3EC; color: #276749; }
.badge-delivered { background: #E8F5E9; color: #1B5E20; }
.badge-terminated { background: #FEF2F2; color: #9B1C1C; }
.badge-rc       { background: #E8F4FD; color: #2B6CB0; }
.badge-pm       { background: #F3EEF9; color: #6B46C1; }
.badge-mh       { background: #FDF4E7; color: #92400E; }

/* ── Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: 2px solid var(--border);
  color: var(--mid-brown);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--brown);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--cream); cursor: pointer; }

.data-table .td-link { color: var(--terracotta); font-weight: 700; }

/* ── Metric cards ── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mid-brown);
  margin-bottom: 0.35rem;
}

.metric-value {
  font-size: 1.75rem;
  font-family: var(--font-serif);
  color: var(--terracotta);
  line-height: 1;
}

.metric-sub {
  font-size: 0.78rem;
  color: var(--mid-brown);
  margin-top: 0.25rem;
}

/* ── Empty states ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--mid-brown);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.empty-state p { color: var(--mid-brown); font-size: 0.9rem; }

/* ── Loading spinner ── */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--terracotta);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  gap: 1rem;
  color: var(--mid-brown);
  font-size: 0.9rem;
}

/* ── Image count pill ── */
.image-count-pill {
  background: var(--cream-dark);
  border-radius: 99px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--mid-brown);
  margin-left: 0.4rem;
}

/* ── MMC landing page specific ── */
.landing-logo {
  display: block;
  margin: 0 auto 1.5rem;
  max-width: 200px;
  height: auto;
}

.landing-headline {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

.landing-sub {
  text-align: center;
  color: var(--mid-brown);
  margin-bottom: 2rem;
}

/* ── Segment selector ── */
.segment-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.segment-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  background: var(--white);
}

.segment-card:hover { border-color: var(--terracotta); }
.segment-card.selected { border-color: var(--terracotta); background: rgba(196,123,92,0.05); }

.segment-card input[type="radio"] { display: none; }

.segment-card .seg-icon { font-size: 1.5rem; margin-bottom: 0.4rem; }
.segment-card .seg-label { font-size: 0.85rem; font-weight: 700; color: var(--brown); }
.segment-card .seg-desc { font-size: 0.75rem; color: var(--mid-brown); margin-top: 0.2rem; }

/* ── Responsive ── */
@media (max-width: 600px) {
  h1 { font-size: 1.5rem; }
  .card { padding: 1.25rem; }
  .btn-row--apart { flex-direction: column; }
  .btn-row--apart .btn { width: 100%; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
}
