/* r8tr Payments — admin & vendor styles */
:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #e1e4e8;
    --text: #1f2328;
    --muted: #6b7280;
    --primary: #1f6feb;
    --primary-hover: #1858c4;
    --ok: #1a7f37;
    --error: #cf222e;
    --warning: #9a6700;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.muted { color: var(--muted); }

/* ---- Auth (login) page ---- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    width: 100%;
    max-width: 380px;
}
.auth-card h1 { margin-bottom: 4px; }
.auth-card .muted { margin-top: 0; margin-bottom: 24px; }

/* ---- Forms ---- */
label {
    display: block;
    margin-bottom: 14px;
    font-weight: 500;
    font-size: 14px;
}
label input, label textarea, label select {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 9px 11px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}
label input:focus, label textarea:focus, label select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15);
}

.btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: #fff;
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Layout (dashboard) ---- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar nav a { margin-left: 16px; color: var(--primary); text-decoration: none; }
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

/* ---- Flash messages ---- */
.flash {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}
.flash-error { background: #ffebe9; color: var(--error); border: 1px solid #ffcecb; }
.flash-success { background: #dafbe1; color: var(--ok); border: 1px solid #aceebb; }
.flash-info { background: #ddf4ff; color: var(--primary); border: 1px solid #b6e3ff; }

code { background: #eef0f2; padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* ---- Layout helpers ---- */
.container.narrow { max-width: 760px; }
.row-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.row-between h1 { margin: 0; }
.card.no-pad { padding: 0; overflow: hidden; }
.card.empty { text-align: center; color: var(--muted); padding: 32px; }
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ---- Tables ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table th { font-weight: 600; color: var(--muted); background: #fafbfc; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table a { color: var(--primary); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }

/* ---- Status pills ---- */
.status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.status-pending { background: #fff8c5; color: #7d5c00; }
.status-viewed { background: #ddf4ff; color: var(--primary); }
.status-paid { background: #dafbe1; color: var(--ok); }
.status-expired { background: #f0f1f3; color: var(--muted); }
.status-cancelled { background: #ffebe9; color: var(--error); }

/* ---- Forms ---- */
.form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}
textarea { resize: vertical; min-height: 60px; }

/* ---- Summary description list ---- */
.summary { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
.summary dt { color: var(--muted); font-size: 14px; }
.summary dd { margin: 0; font-size: 14px; }

/* ---- Copy URL row ---- */
.copy-row {
    display: flex;
    gap: 8px;
    margin: 12px 0 4px;
}
.copy-row input {
    flex: 1;
    padding: 9px 11px;
    font-family: monospace;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
}

/* ---- Vendor payment page ---- */
.pay-page { background: var(--bg); }
.pay-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 0; }
.pay-header-inner {
    max-width: 580px; margin: 0 auto; padding: 0 20px;
    display: flex; align-items: center; justify-content: space-between;
}
.secure-badge { font-size: 13px; }
.pay-container { max-width: 580px; margin: 0 auto; padding: 24px 20px; }
.pay-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}
.pay-card h1 { font-size: 22px; margin: 0 0 16px; }
.pay-card h2 { font-size: 16px; margin: 0 0 4px; }
.amount-label { font-weight: 600 !important; color: var(--text) !important; padding-top: 8px; }
.amount-value { font-weight: 600; font-size: 18px; padding-top: 8px; }
.btn-large {
    width: 100%; padding: 14px;
    font-size: 16px;
    margin-top: 16px;
}
.security-note { font-size: 12px; margin-top: 16px; line-height: 1.5; }

/* Braintree Drop-in container — give it a little space */
#dropin-container { margin: 16px 0 0; min-height: 100px; }

/* ---- Success page ---- */
.success-card { text-align: center; }
.success-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px;
    background: var(--ok); color: white;
    border-radius: 50%;
    font-size: 28px; font-weight: bold;
    margin-bottom: 12px;
}
.success-card .summary { text-align: left; max-width: 360px; margin: 16px auto; }

/* ---- Environment banner ---- */
.env-banner {
    text-align: center;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.env-sandbox { background: #ddf4ff; color: #0550ae; border-bottom: 2px solid #0550ae; }
.env-prod { background: #ffebe9; color: #cf222e; border-bottom: 2px solid #cf222e; }

/* Danger button (cancel) */
.btn-danger {
    background: #cf222e;
    color: white;
    border: 1px solid transparent;
}
.btn-danger:hover {
    background: #a40e26;
}

/* ---- Method tabs ---- */
.method-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    gap: 0;
}
.method-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 15px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    text-align: center;
    margin-bottom: -1px;
}
.method-tab:hover { color: var(--text); }
.method-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ---- Field groups ---- */
.field-group { margin-bottom: 14px; }
.field-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text);
}
.field-group input[type="text"],
.field-group input[type="email"],
.field-group select {
    width: 100%;
    padding: 9px 11px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}
.field-group input:focus, .field-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15);
}
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}
.field-row .field-group { margin-bottom: 0; }
@media (max-width: 480px) {
    .field-row { grid-template-columns: 1fr; }
    .field-row .field-group { margin-bottom: 12px; }
}

/* ---- Hosted Fields (Braintree iframes) ---- */
.hosted-field {
    height: 40px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}
.hosted-field.braintree-hosted-fields-focused {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15);
}

/* ---- Mandate / auth box ---- */
.mandate-box {
    background: #f6f8fa;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin: 16px 0;
}
.mandate-checkbox {
    display: flex;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}
.mandate-checkbox input { margin-top: 3px; flex-shrink: 0; }

/* ---- Mandate fix: constrain checkbox size ---- */
.mandate-box input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin: 3px 0 0 0;
    cursor: pointer;
}
.mandate-checkbox span {
    flex: 1;
    line-height: 1.5;
}
