/*
 * Distrix Checkout — standalone stylesheet
 * No dependency on storefront.css or any theme file.
 * Uses --co-* variables only. --co-primary is injected inline per org.
 */

:root {
    --co-primary:     #2563eb;
    --co-primary-h:   #1d4ed8;
    --co-bg:          #f3f4f6;
    --co-surface:     #ffffff;
    --co-border:      #e5e7eb;
    --co-border-focus:#2563eb;
    --co-text:        #111827;
    --co-muted:       #6b7280;
    --co-radius:      0.5rem;
    --co-radius-sm:   0.375rem;
    --co-shadow-sm:   0 1px 2px rgba(0,0,0,0.06);
    --co-shadow:      0 1px 4px rgba(0,0,0,0.08);
}

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

body.co-body {
    margin: 0;
    font-family: system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    color: var(--co-text);
    background: var(--co-bg);
    -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.co-header {
    background: var(--co-surface);
    border-bottom: 1px solid var(--co-border);
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.co-header-left { display: flex; align-items: center; gap: 0.75rem; }
.co-logo { height: 36px; width: auto; display: block; }
.co-org-name { font-weight: 700; font-size: 1rem; color: var(--co-text); text-decoration: none; }
.co-breadcrumb {
    font-size: 0.8rem;
    color: var(--co-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.co-breadcrumb a { color: var(--co-primary); text-decoration: none; }
.co-breadcrumb a:hover { text-decoration: underline; }
.co-secure {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--co-muted);
}
.co-secure svg { color: #16a34a; }

/* ── Main layout ── */
.co-main { max-width: 1080px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.co-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 2rem;
    align-items: start;
}

/* ── Left column — form ── */
.co-form-col { min-width: 0; }

.co-section {
    background: var(--co-surface);
    border: 1px solid var(--co-border);
    border-radius: var(--co-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--co-shadow-sm);
}
.co-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--co-text);
    margin: 0 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--co-border);
}

.co-field { margin-bottom: 0.875rem; }
.co-field:last-child { margin-bottom: 0; }
.co-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--co-text);
    margin-bottom: 0.375rem;
}
.co-label-opt { font-weight: 400; color: var(--co-muted); }
.co-input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    color: var(--co-text);
    background: var(--co-surface);
    border: 1.5px solid var(--co-border);
    border-radius: var(--co-radius-sm);
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
}
.co-input:focus { border-color: var(--co-border-focus); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.co-input::placeholder { color: #9ca3af; }
textarea.co-input { resize: vertical; min-height: 72px; }

.co-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* ── Payment info block ── */
.co-payment-info {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--co-radius-sm);
    font-size: 0.875rem;
    color: #15803d;
    margin-top: 0.25rem;
}
.co-payment-info svg { flex-shrink: 0; margin-top: 1px; }
.co-payment-info p { margin: 0; line-height: 1.5; }
.co-payment-info strong { display: block; margin-bottom: 0.2rem; color: #166534; }

/* ── Submit button ── */
.co-submit {
    display: block;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--co-primary);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    border: none;
    border-radius: var(--co-radius);
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    margin-top: 1.25rem;
    font-family: inherit;
}
.co-submit:hover { background: var(--co-primary-h); }
.co-submit:disabled { opacity: 0.65; cursor: not-allowed; }
.co-submit-sub {
    text-align: center;
    font-size: 0.78rem;
    color: var(--co-muted);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

/* ── Right column — summary ── */
.co-summary-col { position: sticky; top: 1.5rem; }

.co-summary {
    background: var(--co-surface);
    border: 1px solid var(--co-border);
    border-radius: var(--co-radius);
    overflow: hidden;
    box-shadow: var(--co-shadow-sm);
}

/* Mobile summary toggle */
.co-summary-toggle {
    display: none;
    width: 100%;
    background: #f8fafc;
    border: none;
    border-bottom: 1px solid var(--co-border);
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--co-primary);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    align-items: center;
    justify-content: space-between;
}

.co-summary-body { padding: 1.25rem; }
.co-summary-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--co-muted);
    margin-bottom: 1rem;
}

.co-item {
    display: flex;
    gap: 0.875rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}
.co-item:last-of-type { margin-bottom: 0; }
.co-item-img {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: var(--co-radius-sm);
    border: 1px solid var(--co-border);
    overflow: hidden;
    background: #f9fafb;
    position: relative;
}
.co-item-img img { width: 100%; height: 100%; object-fit: cover; }
.co-item-qty {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--co-muted);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.co-item-info { flex: 1; min-width: 0; }
.co-item-name {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.co-item-variant { font-size: 0.78rem; color: var(--co-muted); margin-top: 0.15rem; }
.co-item-price { font-size: 0.875rem; font-weight: 700; white-space: nowrap; }

.co-divider { border: none; border-top: 1px solid var(--co-border); margin: 1rem 0; }

.co-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}
.co-line:last-child { margin-bottom: 0; }
.co-line-label { color: var(--co-muted); }
.co-line-value { font-weight: 600; }
.co-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 1rem;
    font-weight: 700;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 2px solid var(--co-text);
}

.co-badges {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--co-border);
    background: #f9fafb;
    flex-wrap: wrap;
}
.co-badge {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    color: var(--co-muted);
    font-weight: 500;
}

/* ── Footer ── */
.co-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.78rem;
    color: var(--co-muted);
    border-top: 1px solid var(--co-border);
    background: var(--co-surface);
}
.co-footer a { color: var(--co-muted); text-decoration: underline; }

/* ── Confirmation page ── */
.co-confirm-wrap {
    max-width: 560px;
    margin: 3rem auto;
    text-align: center;
    padding: 0 1rem;
}
.co-confirm-icon { font-size: 3.5rem; color: #16a34a; margin-bottom: 1rem; }
.co-confirm-icon.pending { color: #d97706; }
.co-confirm-h { font-size: 1.75rem; font-weight: 800; margin-bottom: 0.5rem; }
.co-confirm-ref { color: var(--co-muted); font-size: 0.9rem; margin-bottom: 0.25rem; }
.co-confirm-meta { color: var(--co-muted); font-size: 0.875rem; margin-bottom: 2rem; }

.co-order-summary {
    text-align: left;
    background: var(--co-surface);
    border: 1px solid var(--co-border);
    border-radius: var(--co-radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--co-shadow-sm);
}
.co-order-summary-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--co-muted);
    margin-bottom: 0.875rem;
}
.co-order-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--co-border);
    font-size: 0.875rem;
}
.co-order-item:last-of-type { border-bottom: none; }
.co-order-item-name { flex: 1; margin-right: 1rem; }
.co-order-item-price { font-weight: 600; white-space: nowrap; }
.co-order-total {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    padding-top: 0.75rem;
    border-top: 2px solid var(--co-text);
    margin-top: 0.25rem;
}

.co-btn-primary {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: var(--co-primary);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    border-radius: var(--co-radius);
    transition: background 0.15s;
    font-family: inherit;
    border: none;
    cursor: pointer;
}
.co-btn-primary:hover { background: var(--co-primary-h); }

/* ── Error / alert ── */
.co-alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--co-radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
.co-alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }

/* ── Mobile ── */
@media (max-width: 767px) {
    .co-layout {
        grid-template-columns: 1fr;
    }
    .co-summary-col {
        position: static;
        order: -1;  /* summary above form on mobile */
    }
    .co-summary-toggle {
        display: flex;
    }
    .co-summary-body.collapsed {
        display: none;
    }
    .co-main { padding: 1rem 1rem 3rem; }
    .co-header { padding: 0 1rem; }
    .co-row-2 { grid-template-columns: 1fr; }
}
