/* COD Order Form v2.1 – 2 bước, card ảnh + số lượng */
.cof-form {
    background: #fff;
    border: 3px solid #f0c040;
    border-radius: 16px;
    padding: 20px 16px;
    max-width: 520px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    box-sizing: border-box;
    position: relative;
}

/* ── Bước ── */
.cof-step { display: none; }
.cof-step.is-active { display: block; animation: cofFade .25s ease; }
@keyframes cofFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Header bước 1 ── */
.cof-header { text-align: center; margin-bottom: 14px; }
.cof-title  { font-size: 20px; font-weight: 800; color: #0066cc; margin: 0 0 4px; line-height: 1.3; }
.cof-subtitle { font-size: 13px; color: #444; margin: 0 0 10px; }

/* ── Đồng hồ ── */
.cof-clock { display: flex; justify-content: center; gap: 8px; margin-bottom: 4px; }
.cof-clock-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cof-clock-box {
    background: #111; border-radius: 6px; width: 52px; height: 48px;
    display: flex; align-items: center; justify-content: center;
}
.cof-clock-num   { font-size: 22px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.cof-clock-label { font-size: 11px; font-weight: 600; color: #333; }

/* ── Thanh tiến trình ── */
.cof-progress { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 0; }
.cof-progress-item { display: flex; align-items: center; gap: 7px; }
.cof-progress-num {
    width: 26px; height: 26px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #ccc; border-radius: 50%;
    font-size: 13px; font-weight: 800; color: #999; background: #fff; transition: all .25s;
}
.cof-progress-label { font-size: 12.5px; font-weight: 600; color: #999; transition: color .25s; }
.cof-progress-item.is-active .cof-progress-num   { background: #f0a500; border-color: #f0a500; color: #fff; }
.cof-progress-item.is-active .cof-progress-label { color: #f0a500; }
.cof-progress-line { flex: 1; max-width: 40px; height: 2px; background: #ddd; }

/* ── Hộp ghi chú giá ── */
.cof-promo {
    border: 1.5px solid #f0c040; border-radius: 10px; background: #fffdf5;
    padding: 10px 12px; font-size: 13.5px; line-height: 1.5; color: #333;
    margin-bottom: 14px;
}
.cof-step-heading { font-size: 15px; font-weight: 800; color: #222; margin-bottom: 10px; }

/* ══ THẺ GÓI ══════════════════════════════════════════ */
.cof-packages { margin-bottom: 16px; }
.cof-packages--grid { display: grid; gap: 10px; }
.cof-cols-2 { grid-template-columns: repeat(2, 1fr); }
.cof-cols-3 { grid-template-columns: repeat(3, 1fr); }
.cof-cols-4 { grid-template-columns: repeat(4, 1fr); }
.cof-packages--list { display: flex; flex-direction: column; gap: 10px; }

.cof-pkg {
    position: relative; border: 2px solid #e2e2e2; border-radius: 10px;
    background: #fff; overflow: visible; transition: border-color .2s, box-shadow .2s;
    display: flex; flex-direction: column;
}
.cof-pkg:hover { border-color: #f0a500; }
.cof-pkg--checked { border-color: #f0a500; box-shadow: 0 2px 10px rgba(240,165,0,.18); }
.cof-pkg input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }

.cof-pkg-tap { display: block; cursor: pointer; margin: 0; position: relative; }
.cof-packages--list .cof-pkg-tap {
    display: flex; align-items: center; gap: 12px; padding: 8px 40px 8px 8px;
}

/* Ảnh */
.cof-pkg-media { display: block; background: #f6f6f6; overflow: hidden; }
.cof-packages--grid .cof-pkg-media { width: 100%; aspect-ratio: 1 / 1; border-radius: 8px 8px 0 0; }
.cof-packages--list .cof-pkg-media { width: 84px; height: 84px; flex-shrink: 0; border-radius: 8px; }
.cof-pkg-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Thông tin */
.cof-pkg-info { display: flex; flex-direction: column; min-width: 0; }
.cof-packages--grid .cof-pkg-info { text-align: center; }
.cof-packages--list .cof-pkg-info { flex: 1; gap: 3px; }

.cof-pkg-name {
    display: block; font-size: 13.5px; font-weight: 800; color: #333;
    background: #f2f2f2; padding: 5px 4px; line-height: 1.3; transition: all .2s;
}
.cof-packages--list .cof-pkg-name { background: none; padding: 0; font-size: 14.5px; text-align: left; }
.cof-pkg--checked .cof-pkg-name { background: #f0a500; color: #fff; }
.cof-packages--list .cof-pkg--checked .cof-pkg-name { background: none; color: #333; }

.cof-pkg-desc { font-size: 11.5px; color: #666; line-height: 1.35; padding: 3px 4px 0; }
.cof-pkg-prices { display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 4px 4px 0; }
.cof-packages--list .cof-pkg-prices { justify-content: flex-start; padding: 2px 0 0; }
.cof-pkg-price   { font-size: 15px; font-weight: 900; color: #ee4d2d; }
.cof-packages--list .cof-pkg-price { font-size: 18px; }
.cof-pkg-compare { font-size: 12px; color: #999; text-decoration: line-through; }
.cof-pkg-ship { font-size: 11.5px; color: #666; font-weight: 600; padding: 2px 4px 0; }

.cof-pkg-badge {
    position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
    background: #ee4d2d; color: #fff; font-size: 10px; font-weight: 800;
    padding: 2px 8px; border-radius: 10px; white-space: nowrap; z-index: 2;
}
.cof-packages--list .cof-pkg-badge { left: 12px; transform: none; }

.cof-pkg-check {
    position: absolute; top: 6px; right: 6px;
    width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.9);
    border-radius: 50%; background: rgba(0,0,0,.18); transition: all .2s; z-index: 2;
}
.cof-packages--list .cof-pkg-check {
    top: 50%; right: 12px; transform: translateY(-50%);
    border-color: #ccc; background: #fff;
}
.cof-pkg--checked .cof-pkg-check { background: #f0a500; border-color: #f0a500; }
.cof-pkg--checked .cof-pkg-check::after {
    content: ''; position: absolute; left: 5px; top: 1px;
    width: 5px; height: 9px; border: solid #fff; border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

/* ── Nút tăng/giảm số lượng ── */
.cof-qty {
    display: flex; align-items: stretch; justify-content: center;
    border-top: 1px solid #eee; margin-top: auto;
}
.cof-packages--list .cof-qty { border-top: none; border-left: 1px solid #eee; margin: 8px; }
.cof-qty-btn {
    flex: 0 0 32px; background: #f7f7f7; border: none; color: #333;
    font-size: 18px; font-weight: 700; line-height: 1; cursor: pointer;
    padding: 7px 0; font-family: inherit; transition: background .15s;
}
.cof-qty-btn:hover { background: #ececec; }
.cof-qty-btn:first-child { border-radius: 0 0 0 8px; }
.cof-qty-btn:last-child  { border-radius: 0 0 8px 0; }
.cof-qty-input {
    flex: 1; min-width: 0; width: 100%; text-align: center; border: none;
    border-left: 1px solid #eee; border-right: 1px solid #eee;
    font-size: 14px; font-weight: 800; color: #ee4d2d; padding: 7px 2px;
    font-family: inherit; outline: none; background: #fff; -moz-appearance: textfield;
}

/* ══ BƯỚC 2 ══════════════════════════════════════════ */
.cof-step2-head {
    display: flex; align-items: center; gap: 8px;
    border-bottom: 1px solid #eee; padding-bottom: 12px; margin-bottom: 14px;
}
.cof-back {
    background: none; border: none; cursor: pointer; color: #333;
    padding: 4px; display: flex; align-items: center; font-family: inherit;
}
.cof-back:hover { color: #f0a500; }
.cof-step2-title { flex: 1; text-align: center; font-size: 17px; font-weight: 800; color: #1a1a1a; }
.cof-step2-spacer { width: 30px; flex-shrink: 0; }

.cof-summary {
    display: flex; align-items: center; gap: 10px;
    background: #f7f9fc; border: 1px solid #e3e9f2; border-radius: 10px;
    padding: 8px 10px; margin-bottom: 14px;
}
.cof-summary-img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.cof-summary-info { flex: 1; min-width: 0; }
.cof-summary-name  { font-size: 13.5px; font-weight: 700; color: #1a1a1a; line-height: 1.3; }
.cof-summary-price { font-size: 14px; font-weight: 800; color: #ee4d2d; margin-top: 2px; }
.cof-summary-price span { font-size: 12px; font-weight: 600; color: #16a34a; }
.cof-change-pkg {
    background: none; border: 1px solid #f0a500; color: #b57900;
    font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 6px;
    cursor: pointer; flex-shrink: 0; font-family: inherit;
}
.cof-change-pkg:hover { background: #f0a500; color: #fff; }

/* ── Fields ── */
.cof-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.cof-input {
    width: 100%; padding: 13px 14px; border: 1px solid #ddd; border-radius: 10px;
    font-size: 14px; outline: none; box-sizing: border-box; transition: border-color .2s;
    font-family: inherit; background: #fff;
}
.cof-input:focus { border-color: #f0a500; }
.cof-textarea { min-height: 76px; resize: vertical; }

.cof-notice {
    display: flex; align-items: flex-start; gap: 7px;
    font-size: 13px; font-weight: 700; color: #d92d20; line-height: 1.4;
    margin: 2px 0 -2px;
}
.cof-notice-icon {
    flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%;
    background: #d92d20; color: #fff; font-size: 12px; font-weight: 900;
    display: flex; align-items: center; justify-content: center; margin-top: 1px;
}

.cof-location { display: flex; gap: 6px; }
.cof-location--stack { flex-direction: column; gap: 10px; }
.cof-select {
    flex: 1; padding: 13px 34px 13px 14px; border: 1px solid #ddd; border-radius: 10px;
    font-size: 14px; outline: none; cursor: pointer; background: #fff;
    box-sizing: border-box; font-family: inherit; color: #333;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.cof-select:focus { border-color: #f0a500; }

/* ── Tổng tiền ── */
.cof-total-line {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 14px; font-weight: 600; color: #333;
    border-top: 1px dashed #ddd; padding-top: 10px; margin-bottom: 12px;
}
.cof-total-value { font-size: 20px; font-weight: 900; color: #ee4d2d; }

/* ── Nút ── */
.cof-btn, .cof-next {
    width: 100%; padding: 14px; background: #8b1a1a; color: #fff;
    border: none; border-radius: 30px; font-size: 17px; font-weight: 800;
    cursor: pointer; letter-spacing: .5px; transition: filter .2s;
    font-family: inherit; display: block;
}
.cof-btn:hover, .cof-next:hover { filter: brightness(1.12); }
.cof-btn:disabled { filter: brightness(.7); cursor: not-allowed; }

/* Nút dính đáy (tùy chọn) */
.cof-form--sticky .cof-btn,
.cof-form--sticky .cof-next {
    position: sticky; bottom: 10px; z-index: 5;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
}

/* ── Messages ── */
.cof-error {
    background: #fff0f0; color: #c0392b; border: 1px solid #f5c6c6;
    border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-top: 10px;
}
.cof-success-box {
    background: #f0fdf4; border: 2px solid #86efac; border-radius: 10px;
    padding: 20px; text-align: center;
}
.cof-success-icon { font-size: 40px; margin-bottom: 8px; }
.cof-success-box h3 { color: #16a34a; margin: 0 0 10px; font-size: 18px; }
.cof-success-box p  { margin: 4px 0; font-size: 14px; color: #333; }
.cof-total          { color: #ee4d2d; font-size: 16px; }
.cof-cod-note       { color: #555; font-size: 12px; margin-top: 10px !important; }

/* ── Responsive ── */
@media(max-width:767px){
    .cof-mcols-1 { grid-template-columns: 1fr; }
    .cof-mcols-2 { grid-template-columns: repeat(2, 1fr); }
    .cof-mcols-3 { grid-template-columns: repeat(3, 1fr); }
}
@media(max-width:480px){
    .cof-form       { padding: 16px 12px; }
    .cof-clock-box  { width: 44px; height: 42px; }
    .cof-clock-num  { font-size: 19px; }
    .cof-title      { font-size: 17px; }
    .cof-step2-title{ font-size: 15.5px; }
    .cof-btn, .cof-next { font-size: 15.5px; padding: 13px; }
    .cof-packages--grid { gap: 7px; }
    .cof-pkg-name   { font-size: 12px; padding: 4px 2px; }
    .cof-pkg-price  { font-size: 13px; }
    .cof-pkg-compare{ font-size: 10.5px; }
    .cof-qty-btn    { flex: 0 0 26px; font-size: 16px; padding: 5px 0; }
    .cof-qty-input  { font-size: 13px; padding: 5px 0; }
    .cof-progress-label { font-size: 11.5px; }
    .cof-progress-line  { max-width: 22px; }
}
