/*
 * Proteria Price widget styles.
 * Scope is the iframe-only price area: agreement card + price card + Ordrelinjer.
 * Carrier / product / pickup / service selectors live in the parent Freight UI.
 */

:root {
    --panel-bg: #ffffff;
    --panel-border: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --check-green: #16a34a;
    --savings-green: #16a34a;
    --highlight-bg: #ecfdf5;
    --highlight-border: #d1fae5;
    --orderlines-border: #c7d2fe;
    --radius: 8px;
    --radius-sm: 6px;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background-color: transparent;
    -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

/* ---------------- Widget root ---------------- */

.price-widget {
    padding: 4px;
}

.loading-row,
.error-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.error-row {
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
}

.loading-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--text-secondary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

/* ---------------- Agreement + price card ---------------- */

.agreement-card {
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 14px;
    background: var(--panel-bg);
    margin-bottom: 12px;
}

.agreement-header {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.agreement-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
}

.agreement-name {
    color: var(--text-primary);
}

.agreement-check {
    color: var(--check-green);
    font-size: 18px;
}

/* Inner mint-tinted price section */

.price-card {
    background: var(--highlight-bg);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.price-label {
    font-size: 13px;
    color: var(--text-primary);
}

.price-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.price-savings {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.savings-amount,
.savings-percent {
    color: var(--savings-green);
    font-weight: 500;
}

.price-details {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 12px;
    color: #0f766e;
    text-decoration: none;
}

.price-details:hover {
    text-decoration: underline;
}

.price-details i {
    transition: transform 140ms ease;
}

.price-details i.chevron-open {
    transform: rotate(180deg);
}

.details-breakdown {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--highlight-border);
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 3px 0;
}

.breakdown-row.breakdown-total {
    color: var(--text-primary);
    font-weight: 600;
    border-top: 1px solid var(--highlight-border);
    margin-top: 4px;
    padding-top: 6px;
}

/* Guideline (list) price — the "before agreement" reference, struck through. */
.breakdown-row.breakdown-strikethrough {
    text-decoration: line-through;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* ---------------- Ordrelinjer (locked state) ---------------- */

.orderlines-card {
    border: 1px solid var(--orderlines-border);
    border-radius: var(--radius);
    padding: 14px;
    background: var(--panel-bg);
    margin-top: 12px;
}

.orderlines-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.info-icon {
    color: var(--text-muted);
    font-size: 12px;
}

.parcel-block {
    margin-bottom: 10px;
}

.parcel-header {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 6px;
}

.parcel-line {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    font-size: 13px;
    padding: 2px 0;
    color: var(--text-primary);
}

.line-code {
    color: var(--text-secondary);
}

.line-label {
    color: var(--text-primary);
}

.line-price {
    text-align: right;
}

.orderlines-totals {
    border-top: 1px solid var(--panel-border);
    margin-top: 8px;
    padding-top: 8px;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 2px 0;
    color: var(--text-primary);
}

.totals-row:last-child {
    font-weight: 600;
}
