/* ── The Right Ring — Portal Styles ─────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Metal&family=Raleway:wght@400;500;600;700&display=swap');

:root {
  --brand:       #A6D1E6;
  --brand-dark:  #7FB3C9;
  --brand-light: #DDF0F7;
  --text:        #232429;
  --muted:       #6b7280;
  --bg:          #F7F7F7;
  --white:       #ffffff;
  --border:      #e5e7eb;
  --radius:      10px;
  --shadow:      0 2px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Raleway', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: 'Metal', cursive;
  letter-spacing: 0.05em;
}

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

/* ── Layout ─────────────────────────────────────────────────────────────── */

.portal-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.portal-header .logo {
  height: 108px;
}

.portal-header .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.portal-header .user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
}

.portal-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 16px 80px;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 18px;
  font-family: 'Metal', cursive;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 16px;
}

/* ── Status Badge ───────────────────────────────────────────────────────── */

.status-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.status-Design-Review      { background: #FEF3C7; color: #92400E; }
.status-In-Production      { background: #DBEAFE; color: #1E40AF; }
.status-Setting-Stones     { background: #EDE9FE; color: #5B21B6; }
.status-Quality-Check      { background: #FEE2E2; color: #991B1B; }
.status-Ready-for-Pickup   { background: #D1FAE5; color: #065F46; }
.status-Complete           { background: #D1FAE5; color: #065F46; }

/* ── Timeline ───────────────────────────────────────────────────────────── */

.timeline-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 12px;
}

.timeline-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.timeline-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 2px;
}

.timeline-value {
  font-weight: 600;
  font-size: 15px;
}

.project-update {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--brand-light);
  border-left: 3px solid var(--brand-dark);
  border-radius: 6px;
  font-size: 14px;
  white-space: pre-wrap;
}

/* ── Ring Choices ───────────────────────────────────────────────────────── */

.choices-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.choice-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.choice-img-placeholder {
  width: 132px;
  height: 132px;
  border-radius: 8px;
  background: var(--brand-light);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.choice-icon-svg {
  color: var(--brand-dark);
}

.choice-icon-svg svg {
  width: 64px;
  height: 64px;
}

.choice-img-wrap {
  width: 132px;
  height: 132px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--brand-light);
}

/* When image fails to load, hide broken img and show gem via pseudo-element */
.choice-img-wrap.img-error {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-dark);
}

.choice-img-wrap.img-error .choice-img {
  display: none;
}

.choice-img-wrap.img-error::after {
  content: '';
  display: block;
  width: 64px;
  height: 64px;
  background-color: var(--brand-dark);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolygon points='12,2 20,8 17,18 7,18 4,8' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpolygon points='12,2 20,8 12,6 4,8' fill='currentColor' opacity='0.5'/%3E%3Cpolygon points='12,6 20,8 17,18 7,18 4,8' fill='currentColor' opacity='0.3'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolygon points='12,2 20,8 17,18 7,18 4,8' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpolygon points='12,2 20,8 12,6 4,8' fill='currentColor' opacity='0.5'/%3E%3Cpolygon points='12,6 20,8 17,18 7,18 4,8' fill='currentColor' opacity='0.3'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.choice-question {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 2px;
}

.choice-answer {
  font-weight: 600;
  font-size: 14px;
}

.choice-detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Payment Card ───────────────────────────────────────────────────────── */

.payment-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.payment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.payment-row.paid {
  background: #F0FDF4;
  border-color: #86EFAC;
}

.payment-row.due {
  background: var(--brand-light);
  border-color: var(--brand);
}

.payment-row.disabled {
  background: var(--bg);
  opacity: 0.6;
}

.payment-label {
  font-weight: 600;
  font-size: 14px;
}

.payment-amount {
  font-size: 18px;
  font-weight: 700;
}

.payment-status {
  font-size: 12px;
  color: var(--muted);
}

.payment-check {
  color: #22C55E;
  font-size: 20px;
}

.total-estimate {
  text-align: right;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.total-estimate strong {
  font-size: 17px;
  color: var(--text);
}

/* ── Media Gallery ──────────────────────────────────────────────────────── */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.media-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
}

.media-item img,
.media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-item .media-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.media-item .media-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  font-size: 36px;
  color: white;
}

.media-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 2px dashed var(--brand-dark);
  border-radius: 8px;
  cursor: pointer;
  font-size: 28px;
  color: var(--brand-dark);
  background: var(--brand-light);
  transition: background 0.15s;
}

.media-upload-btn:hover { background: var(--brand); color: var(--white); }

.media-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 20px 0;
  text-align: center;
}

/* ── Render Portal Button ───────────────────────────────────────────────── */

.render-portal-card {
  background: linear-gradient(135deg, #232429 0%, #3a3c45 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.render-portal-card .card-title {
  color: rgba(255,255,255,0.6);
}

.render-portal-card p {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
}

.render-portal-password {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 14px;
}

.render-portal-password span {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
  word-break: break-all;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: 'Raleway', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand);
  color: var(--text);
}

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

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

.btn-dark:hover { background: #3a3c45; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--brand);
  color: var(--brand-dark);
}

.btn-outline:hover { background: var(--brand-light); }

.btn-danger {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.btn-danger:hover { background: #FECACA; }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ──────────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Raleway', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-dark);
}

select.form-control { cursor: pointer; }

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

.form-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Login Page ─────────────────────────────────────────────────────────── */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.login-box {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-box .logo { height: 88px; margin-bottom: 24px; }
.login-box h2 { font-size: 20px; margin-bottom: 6px; }
.login-box .subtitle { color: var(--muted); font-size: 14px; margin-bottom: 28px; }

.login-tabs {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 24px;
}

.login-tab {
  flex: 1;
  padding: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: var(--white);
  font-family: 'Raleway', sans-serif;
  color: var(--muted);
  transition: all 0.15s;
}

.login-tab.active {
  background: var(--brand);
  color: var(--text);
}

.error-msg {
  background: #FEE2E2;
  color: #991B1B;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: left;
}

.success-msg {
  background: #D1FAE5;
  color: #065F46;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: left;
}

/* ── Admin Styles ───────────────────────────────────────────────────────── */

.admin-header {
  background: var(--text);
  color: var(--white);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header .logo { height: 32px; filter: brightness(10); }
.admin-header h1 { font-size: 16px; color: var(--white); margin-left: 16px; }

.admin-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 16px 80px;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.orders-table th {
  background: var(--bg);
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.orders-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}

.orders-table tr:last-child td { border-bottom: none; }
.orders-table tr:hover td { background: #FAFAFA; }

/* ── Admin Order Editor ─────────────────────────────────────────────────── */

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .editor-grid { grid-template-columns: 1fr; }
}

.editor-full { grid-column: 1 / -1; }

.payment-formula {
  background: var(--brand-light);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  margin-top: 6px;
}

/* ── Lightbox ───────────────────────────────────────────────────────────── */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox.open { display: flex; }

.lightbox-inner {
  max-width: 900px;
  width: 100%;
  position: relative;
}

.lightbox-inner img,
.lightbox-inner iframe,
.lightbox-inner video {
  width: 100%;
  max-height: 80vh;
  border-radius: 10px;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: -16px;
  right: -16px;
  background: var(--white);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.lightbox-caption {
  text-align: center;
  color: rgba(255,255,255,0.8);
  margin-top: 12px;
  font-size: 14px;
}

/* ── Upload Modal ───────────────────────────────────────────────────────── */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}

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

.modal-box {
  background: var(--white);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  margin: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.modal-box h3 { font-size: 17px; margin-bottom: 16px; }

.drop-zone {
  border: 2px dashed var(--brand-dark);
  border-radius: 10px;
  padding: 36px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--brand-light);
  transition: background 0.15s;
}

.drop-zone.dragging { background: var(--brand); }
.drop-zone p { font-size: 14px; color: var(--muted); margin-top: 8px; }
.drop-zone .drop-icon { font-size: 36px; }

/* ── Spinner ────────────────────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

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

/* ── Responsive ─────────────────────────────────────────────────────────── */

/* ── Version List (customer portal) ─────────────────────────────────────── */

.version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.version-label {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  flex: 1;
}

.btn-approve {
  white-space: nowrap;
  background: var(--brand-dark);
  color: #fff;
}

.btn-approve:hover {
  background: #5E9BB5;
}

.btn-approved {
  white-space: nowrap;
  background: #4caf50;
  color: #fff;
  cursor: default;
}
.btn-approved:hover {
  background: #4caf50;
}

/* ── Version Editor (admin) ──────────────────────────────────────────────── */

.version-editor-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

@media (max-width: 600px) {
  .portal-main, .admin-main { padding: 16px 12px 80px; }
  .card { padding: 18px 16px; }
  .login-box { padding: 28px 20px; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .payment-row { flex-direction: column; align-items: flex-start; }
}
