/* ====================================================
   CHECKOUT PAGE — checkout.css  (Premium Redesign)
   ==================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; }
img, video, iframe { max-width: 100%; }

:root {
  --primary:       #c87533;
  --primary-light: #e8934a;
  --primary-dark:  #a85e22;
  --green:         #27ae60;
  --green-dark:    #1e8449;
  --red:           #e74c3c;
  --bg:            #f4f4f8;
  --card:          #ffffff;
  --border:        #e8e8ee;
  --text:          #1a1a2e;
  --text-2:        #5a5a72;
  --text-3:        #9898b0;
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.06);
  --shadow-md:     0 8px 32px rgba(0,0,0,0.10);
  --shadow-lg:     0 16px 48px rgba(0,0,0,0.14);
  --radius-sm:     8px;
  --radius-md:     14px;
  --radius-lg:     20px;
  --transition:    0.22s cubic-bezier(0.4,0,0.2,1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  padding-bottom: 100px;
  min-height: 100vh;
}

/* ===== HEADER ===== */
.co-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.co-back-btn {
  background: #f5f5f8;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: background var(--transition), color var(--transition);
}
.co-back-btn:hover { background: #ebe8ff; color: var(--primary); }
.co-header-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

/* ===== PROGRESS STEPS ===== */
.co-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 16px 20px 0;
}
.co-step {
  display: flex;
  align-items: center;
  gap: 6px;
}
.co-step-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  transition: all var(--transition);
}
.co-step-dot.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 4px 12px rgba(200,117,51,0.4);
}
.co-step-dot.done {
  background: var(--green);
  color: #fff;
}
.co-step-dot.inactive {
  background: #e8e8ee;
  color: var(--text-3);
}
.co-step-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
}
.co-step-label.active { color: var(--primary); }
.co-step-line {
  width: 40px;
  height: 2px;
  background: #e0e0ea;
  margin: 0 4px;
  border-radius: 2px;
}
.co-step-line.done { background: var(--green); }

/* ===== MAIN ===== */
.co-main {
  padding: 0 16px 20px;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== SECTION CARD ===== */
.co-section-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: 16px;
}
.co-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.co-section-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(200,117,51,0.12), rgba(200,117,51,0.06));
  color: var(--primary);
  flex-shrink: 0;
}
.co-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}
.co-section-sub {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  margin-top: 1px;
}

/* ===== FORM ===== */
.co-form {
  padding: 4px 20px 20px;
}

/* Two column grid */
.co-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

/* Floating label field */
.co-field {
  position: relative;
  margin-top: 20px;
}
.co-field.full { grid-column: 1 / -1; }

/* Floating label */
.co-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.co-required { color: var(--red); }

/* Input */
.co-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 15px;
  color: var(--text);
  background: #fafafa;
  outline: none;
  font-family: inherit;
  font-weight: 500;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}
.co-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(200,117,51,0.12);
}
.co-input::placeholder { color: var(--text-3); font-weight: 400; }
.co-input:disabled { color: #aaa; background: #f8f8f8; cursor: not-allowed; }
.co-input.error { border-color: var(--red); background: #fff5f5; }
.co-input.error:focus { box-shadow: 0 0 0 3px rgba(231,76,60,0.12); }
.co-input.valid { border-color: var(--green); }

/* Field error text */
.co-field-error {
  display: none;
  font-size: 11px;
  color: var(--red);
  font-weight: 600;
  margin-top: 5px;
  align-items: center;
  gap: 4px;
}
.co-field-error.visible { display: flex; }

/* Phone field special */
.co-phone-wrapper {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafafa;
  overflow: hidden;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.co-phone-wrapper:focus-within {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(200,117,51,0.12);
}
.co-phone-wrapper.error { border-color: var(--red); background: #fff5f5; }
.co-phone-wrapper.valid { border-color: var(--green); }
.co-phone-flag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 12px 11px 14px;
  border-right: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
  background: rgba(0,0,0,0.02);
}
.co-phone-flag span { font-size: 20px; }
.co-phone-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 11px 14px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  font-family: inherit;
  font-weight: 500;
  -webkit-appearance: none;
}
.co-phone-input::placeholder { color: var(--text-3); font-weight: 400; }
.co-phone-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 5px;
  font-weight: 500;
}

/* Phone character counter */
.co-phone-counter {
  font-size: 11px;
  font-weight: 700;
  padding: 0 12px;
  color: var(--text-3);
  white-space: nowrap;
}
.co-phone-counter.complete { color: var(--green); }
.co-phone-counter.error-c { color: var(--red); }

/* Select */
.co-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.co-select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 40px 11px 14px;
  font-size: 15px;
  color: var(--text);
  background: #fafafa;
  outline: none;
  font-family: inherit;
  font-weight: 500;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.co-select:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(200,117,51,0.12);
}
.co-select:disabled { color: #bbb; cursor: not-allowed; background: #f8f8f8; }
.co-select option { color: var(--text); font-size: 14px; }
.co-select-arrow {
  position: absolute;
  right: 14px;
  pointer-events: none;
  color: var(--text-3);
}

/* Textarea */
.co-textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  color: var(--text);
  background: #fafafa;
  outline: none;
  font-family: inherit;
  font-weight: 400;
  resize: vertical;
  min-height: 80px;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.co-textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(200,117,51,0.12);
}
.co-textarea::placeholder { color: var(--text-3); }

/* Address title quick picks */
.co-quick-picks {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.co-quick-pick {
  background: #f5f5f8;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.co-quick-pick:hover {
  background: rgba(200,117,51,0.08);
  border-color: var(--primary);
  color: var(--primary);
}
.co-quick-pick.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* KVKK */
.co-kvkk {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.7;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: #fafafa;
}
.co-kvkk-link {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 600;
}

/* Save button */
.co-save-btn {
  background: linear-gradient(135deg, var(--text) 0%, #2d2d40 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 20px;
  font-family: inherit;
  transition: all var(--transition);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.co-save-btn:hover {
  background: linear-gradient(135deg, #2d2d40 0%, #3d3d55 100%);
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
  transform: translateY(-1px);
}
.co-save-btn:active { transform: scale(0.98) translateY(0); }

/* ===== SAVED ADDRESSES ===== */
.co-saved-section {
  margin-top: 16px;
}

.co-addr-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  background: var(--card);
}
.co-addr-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(200,117,51,0.1);
}
.co-addr-card.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(200,117,51,0.04), rgba(200,117,51,0.01));
  box-shadow: 0 4px 16px rgba(200,117,51,0.12);
}

.co-addr-radio {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid #ddd;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.co-addr-card.selected .co-addr-radio {
  border-color: var(--primary);
  background: var(--primary);
}
.co-addr-card.selected .co-addr-radio::after {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #fff;
}

.co-addr-info { flex: 1; min-width: 0; }
.co-addr-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(200,117,51,0.1);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.co-addr-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.co-addr-detail {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.6;
}
.co-addr-phone {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  margin-top: 4px;
}

.co-addr-del {
  background: #f5f5f8;
  border: none;
  cursor: pointer;
  color: #ccc;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.co-addr-del:hover { color: var(--red); background: rgba(231,76,60,0.08); }

/* ===== BOTTOM BAR ===== */
.co-bottom-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.08);
}
.co-bottom-left { flex: 1; min-width: 0; }
.co-total-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.co-total-label { font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.co-total-price { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.2; letter-spacing: -0.5px; }
.co-savings {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; color: var(--green); margin-top: 2px;
}
.co-savings svg { transform: rotate(180deg); }
.co-continue-btn {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(39,174,96,0.3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.co-continue-btn:hover {
  box-shadow: 0 6px 24px rgba(39,174,96,0.4);
  transform: translateY(-1px);
}
.co-continue-btn:active { transform: scale(0.98) translateY(0); }

/* ===== SUMMARY PANEL ===== */
.co-summary-panel {
  position: fixed;
  bottom: 72px; left: 0; right: 0;
  z-index: 190;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.10);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  animation: coSlideUp 0.3s ease;
}
@keyframes coSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.co-summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; font-size: 14px; color: var(--text-2);
}
.co-summary-row.green { color: var(--green); }
.co-summary-row.bold { font-size: 17px; font-weight: 800; color: var(--text); }
.co-summary-row .green { color: var(--green); }
.co-summary-divider { border-top: 1px dashed var(--border); margin: 6px 0; }

/* ===== SUCCESS TOAST ===== */
.co-success-toast {
  position: fixed;
  bottom: 100px; left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(39,174,96,0.4);
  z-index: 9999;
  white-space: nowrap;
  animation: coPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  gap: 8px;
}
@keyframes coPopIn {
  from { transform: translateX(-50%) scale(0.8) translateY(10px); opacity: 0; }
  to { transform: translateX(-50%) scale(1) translateY(0); opacity: 1; }
}

/* ===== DESKTOP ===== */
@media (min-width: 680px) {
  body { max-width: 680px; margin: 0 auto; }
  .co-main { padding: 0 24px 24px; }
  .co-bottom-bar {
    max-width: 680px; left: 50%;
    transform: translateX(-50%);
    right: auto; width: 680px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .co-summary-panel {
    max-width: 680px; left: 50%;
    transform: translateX(-50%);
    right: auto; width: 680px;
  }
}

@media (max-width: 380px) {
  .co-header-title { font-size: 15px; }
  .co-continue-btn { font-size: 14px; padding: 12px 16px; }
  .co-total-price { font-size: 19px; }
  .co-grid-2 { grid-template-columns: 1fr; }
}
