/* =========================================================
   DARN — Checkout
   Storefront language (sharp corners, black actions) with a calmer
   form: numbered sections, a sticky order summary on desktop and a
   collapsible one on phones.
   ========================================================= */

.co-page {
  padding-top: 32px;
  padding-bottom: 72px;
}

.co-muted {
  color: var(--mid-gray);
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 0;
}

.co-link {
  font-size: 0.85rem;
  color: var(--black);
  text-decoration: underline;
  text-underline-offset: 3px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* ---------- Steps ---------- */

.co-steps {
  display: flex;
  list-style: none;
  margin: 0 auto 40px;
  padding: 0;
  max-width: 560px;
}

.co-step {
  flex: 1;
  position: relative;
  color: var(--mid-gray);
}

.co-step::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 50%;
  width: 100%;
  height: 1px;
  background: #d8d8d4;
}

.co-step:first-child::before { display: none; }
.co-step.is-done::before,
.co-step.is-current::before { background: var(--black); }

.co-step-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.co-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #d8d8d4;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
}

.co-step-dot svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

.co-step-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.co-step.is-done,
.co-step.is-current { color: var(--black); }
.co-step.is-done .co-step-dot { border-color: var(--black); }
.co-step.is-current .co-step-dot { background: var(--black); border-color: var(--black); color: var(--white); }
.co-step a.co-step-inner:hover .co-step-label { text-decoration: underline; }

/* ---------- Layout ---------- */

.co-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 56px;
  align-items: start;
}

.co-section {
  padding: 28px 0;
  border-top: 1px solid #e6e6e3;
}

.co-section:first-child {
  border-top: none;
  padding-top: 0;
}

.co-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.co-section-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.co-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.co-signed-in { margin: -8px 0 16px; }

/* ---------- Fields ---------- */

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

.co-span-2 { grid-column: 1 / -1; }

.co-field > label:not(.co-check) {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.co-field input:not([type="checkbox"]),
.co-field select,
.co-field textarea,
.co-notes textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #bdbdb8;
  border-radius: 0;
  background: var(--white);
  color: var(--black);
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.co-field textarea,
.co-notes textarea {
  resize: vertical;
  line-height: 1.5;
}

.co-field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a0a0a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
}

.co-field input:not([type="checkbox"]):focus,
.co-field select:focus,
.co-field textarea:focus,
.co-notes textarea:focus {
  border-color: var(--black);
  box-shadow: inset 0 0 0 1px var(--black);
}

.co-field input::placeholder,
.co-field textarea::placeholder,
.co-notes textarea::placeholder { color: #9a9a96; }

.co-field.has-error input:not([type="checkbox"]),
.co-field.has-error select,
.co-field.has-error textarea {
  border-color: #b3261e;
  box-shadow: inset 0 0 0 1px #b3261e;
}

.co-field-error {
  margin: 6px 0 0;
  color: #a1281c;
  font-size: 0.78rem;
  line-height: 1.4;
}

.co-field-error:empty { display: none; }

.co-notes {
  margin-top: 16px;
}

.co-notes summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  width: fit-content;
  list-style: none;
}

.co-notes summary::-webkit-details-marker { display: none; }
.co-notes summary::before { content: "+ "; font-weight: 600; }
.co-notes[open] summary::before { content: "− "; }
.co-notes textarea { margin-top: 10px; }

/* ---------- Payment method ---------- */

.co-methods {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.co-method {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid #d8d8d4;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.co-method:hover { border-color: var(--mid-gray); }

.co-method:has(input:checked) {
  border-color: var(--black);
  box-shadow: inset 0 0 0 1px var(--black);
}

.co-method input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--black);
  flex-shrink: 0;
}

.co-method-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.co-method-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.co-method-desc {
  font-size: 0.8rem;
  color: var(--mid-gray);
}

.co-method-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--black);
  stroke-width: 1.4;
  display: block;
}

/* ---------- Confirmation & submit ---------- */

.co-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  cursor: pointer;
}

.co-check input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--black);
  flex-shrink: 0;
  cursor: pointer;
}

.co-check a,
.co-kvkk a,
.co-alert a {
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}

.co-field-check.has-error .co-check { color: #a1281c; }
.co-field-check .co-field-error { margin-left: 32px; }

.co-kvkk {
  margin: 12px 0 0 32px;
  font-size: 0.8rem;
}

.co-alert {
  margin: 20px 0 0;
  padding: 12px 14px;
  background: #fdeceb;
  color: #a1281c;
  border-left: 3px solid currentColor;
  font-size: 0.86rem;
  line-height: 1.5;
}

.co-submit {
  margin-top: 22px;
  padding: 18px 24px;
  font-size: 0.85rem;
}

.co-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 12px 0 0;
  font-size: 0.78rem;
  color: var(--mid-gray);
}

.co-secure svg,
.co-trust svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  flex-shrink: 0;
}

/* ---------- Order summary ---------- */

.co-summary {
  position: sticky;
  top: 24px;
  background: var(--off-white);
  border: 1px solid #e6e6e3;
}

.co-summary-toggle { display: none; }

.co-summary-body { padding: 24px; }

.co-summary-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}

.co-summary-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.co-items {
  list-style: none;
  margin: 0 0 18px;
  padding: 8px 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 360px;
  overflow-y: auto;
}

.co-item {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.co-item-thumb {
  position: relative;
  width: 60px;
  aspect-ratio: 4 / 5;
  background: var(--white);
  border: 1px solid #e0e0dc;
}

.co-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.co-item-qty {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--black);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.co-item-name {
  font-size: 0.88rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.co-item-meta {
  font-size: 0.78rem;
  color: var(--mid-gray);
  margin-top: 2px;
}

.co-item-price {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.co-totals {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid #dcdcd8;
}

.co-totals div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 0.88rem;
  color: var(--dark-gray);
}

.co-totals dt,
.co-totals dd { margin: 0; }

.co-discount dd { color: #1f6b35; }

.co-totals .co-total {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid #dcdcd8;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--black);
}

.co-free-note {
  margin: 14px 0 0;
  font-size: 0.8rem;
  color: var(--dark-gray);
}

.co-trust {
  list-style: none;
  margin: 18px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid #dcdcd8;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--mid-gray);
}

.co-trust li {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Card payment ---------- */

.co-pay .co-muted { margin-bottom: 18px; }

.co-iframe-wrap {
  position: relative;
  min-height: 460px;
  border: 1px solid #e6e6e3;
}

.co-iframe-wrap iframe {
  display: block;
  width: 100%;
  min-height: 460px;
  border: none;
}

.co-iframe-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  font-size: 0.88rem;
  color: var(--mid-gray);
  background: var(--white);
}

/* ---------- Result screens ---------- */

.co-done {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.co-done-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
}

.co-done-icon.is-error { background: #a1281c; }

.co-done-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: var(--white);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.co-done h2 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.co-done-no {
  margin: 0 0 8px;
  font-size: 1rem;
}

.co-done-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 28px 0;
  text-align: left;
}

.co-done-grid > div {
  padding: 18px;
  border: 1px solid #e6e6e3;
}

.co-done-grid h3 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.co-done-grid p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.co-done-hint { margin-bottom: 24px; }

.co-done-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.co-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: co-spin 0.8s linear infinite;
}

.co-spinner.is-dark {
  width: 18px;
  height: 18px;
  border-color: #d8d8d4;
  border-top-color: var(--black);
}

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

@media (prefers-reduced-motion: reduce) {
  .co-spinner { animation-duration: 2.4s; }
}

/* ---------- Legal document dialog ---------- */

body.co-modal-open { overflow: hidden; }

.co-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 10, 10, 0.55);
}

.co-modal {
  width: 100%;
  max-width: 720px;
  max-height: min(82vh, 780px);
  display: flex;
  flex-direction: column;
  background: var(--white);
}

.co-modal-head,
.co-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
}

.co-modal-head { border-bottom: 1px solid #e6e6e3; }
.co-modal-foot { border-top: 1px solid #e6e6e3; justify-content: flex-end; }

.co-modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.co-modal-close {
  width: 40px;
  height: 40px;
  font-size: 1.6rem;
  line-height: 1;
}

.co-modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--dark-gray);
}

.co-modal-body p { margin: 0 0 12px; }

/* ---------- Phones & tablets ---------- */

@media (max-width: 960px) {
  .co-page { padding-top: 20px; }

  .co-steps { margin-bottom: 24px; }
  .co-step-label { font-size: 0.7rem; }

  .co-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  /* The summary moves above the form and folds into a bar showing the total. */
  .co-summary {
    order: -1;
    position: static;
    margin: 0 -16px 28px;
    border-left: none;
    border-right: none;
  }

  .co-summary-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    font-size: 0.88rem;
    color: var(--black);
  }

  .co-summary-toggle strong { font-size: 1rem; font-weight: 600; }

  .co-summary-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .co-summary-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
  }

  .co-summary-toggle .co-chevron { width: 14px; height: 14px; transition: transform 0.2s ease; }
  .co-summary.is-open .co-chevron { transform: rotate(180deg); }

  .co-summary-body {
    display: none;
    padding: 4px 16px 20px;
  }

  .co-summary.is-open .co-summary-body { display: block; }
  .co-summary-head { display: none; }
  .co-items { max-height: none; }

  .co-iframe-wrap,
  .co-iframe-wrap iframe { min-height: 520px; }
}

@media (max-width: 560px) {
  .co-grid { grid-template-columns: minmax(0, 1fr); }
  /* City and district stay side by side; both are short. */
  .co-grid-address { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .co-section { padding: 24px 0; }

  .co-done-actions .btn { width: 100%; }

  .co-modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .co-modal { max-height: 92vh; }
}
