/**
 * Silenthought — Certificate Calculator (CT-001)
 *
 * Uses CSS variables from style.css:
 *   --st-red, --st-black, --st-gray-50/100/200/300/600/900
 *   --shadow-sm, --shadow-md
 *
 * @package Silenthought
 */

/* ── Wrapper ─────────────────────────────────────────────────────────── */
.st-cert-calculator,
.st-bc-calculator {
    margin: 0;
    font-family: 'Poppins', sans-serif;
}

/* ── Header ──────────────────────────────────────────────────────────── */
.st-calc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--st-black);
    font-family: 'Poppins', sans-serif;
}

.st-calc-badge {
    margin-left: auto;
    background: var(--st-red);
    color: #fff;
    font-size: 10px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.4px;
    font-family: 'DM Sans', sans-serif;
}

/* ── Field groups ─────────────────────────────────────────────────────── */
.st-calc-field-group {
    margin-bottom: 20px;
}

.st-calc-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--st-black);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Radio card group ─────────────────────────────────────────────────── */
.st-radio-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.st-radio-option {
    cursor: pointer;
    flex: 1;
    min-width: 70px;
}

.st-radio-option input[type="radio"] {
    display: none;
}

.st-radio-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 8px;
    border: 2px solid var(--st-gray-200);
    border-radius: 10px;
    background: #fff;
    text-align: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    user-select: none;
}

.st-radio-option:hover .st-radio-card {
    border-color: var(--st-black);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.st-radio-option input[type="radio"]:checked + .st-radio-card {
    background: var(--st-red);
    border-color: var(--st-red);
    color: #fff;
    box-shadow: 0 6px 20px rgba(235, 31, 58, 0.4);
    transform: translateY(-2px);
}

.st-radio-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1.2;
}

.st-radio-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.65rem;
    opacity: 0.7;
    line-height: 1.3;
}

.st-radio-option input[type="radio"]:checked + .st-radio-card .st-radio-sub {
    opacity: 0.88;
}

/* ── Quantity +/− control ─────────────────────────────────────────────── */
.st-qty-wrap {
    display: flex;
    align-items: center;
    width: fit-content;
    border: 1.5px solid var(--st-gray-200);
    border-radius: 8px;
    overflow: hidden;
}

.st-qty-dec,
.st-qty-inc {
    background: var(--st-gray-50);
    border: none;
    padding: 10px 16px;
    font-size: 18px;
    cursor: pointer;
    color: var(--st-black);
    transition: background 0.15s;
    line-height: 1;
    font-family: 'DM Sans', sans-serif;
}

.st-qty-dec:hover,
.st-qty-inc:hover { background: var(--st-gray-100); }

.st-qty-wrap input[type="number"] {
    width: 90px;
    border: none;
    border-left: 1.5px solid var(--st-gray-200);
    border-right: 1.5px solid var(--st-gray-200);
    padding: 10px 8px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--st-black);
    font-family: 'DM Sans', sans-serif;
    background: #fff;
    -moz-appearance: textfield;
}

.st-qty-wrap input[type="number"]::-webkit-outer-spin-button,
.st-qty-wrap input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

.st-qty-wrap input[type="number"]:focus { outline: none; }

/* ── Price Breakdown ──────────────────────────────────────────────────── */
.st-calc-breakdown {
    background: var(--st-gray-50);
    border: 1.5px solid var(--st-gray-200);
    border-radius: 10px;
    padding: 16px;
    margin: 16px 0;
    font-family: 'DM Sans', sans-serif;
}

.st-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--st-gray-100);
    font-size: 13px;
    color: var(--st-gray-600);
}

.st-breakdown-row:last-of-type { border-bottom: none; }

.st-breakdown-row strong {
    color: var(--st-black);
    font-weight: 600;
}

.st-breakdown-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid var(--st-gray-200);
    font-size: 15px;
    font-weight: 700;
    color: var(--st-black);
    font-family: 'Poppins', sans-serif;
}

.st-breakdown-total strong {
    font-size: 20px;
    color: var(--st-red);
}

/* ── Error / Loading ──────────────────────────────────────────────────── */
.st-calc-error {
    background: #fef2f2;
    border: 1.5px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    padding: 10px 14px;
    font-size: 13px;
    margin: 10px 0;
    font-family: 'DM Sans', sans-serif;
}

.st-calc-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--st-gray-600);
    font-size: 13px;
    padding: 8px 0;
    font-family: 'DM Sans', sans-serif;
}

.st-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--st-gray-200);
    border-top-color: var(--st-red);
    border-radius: 50%;
    animation: st-cert-spin 0.6s linear infinite;
    flex-shrink: 0;
}

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

/* ── Pricing reference table ──────────────────────────────────────────── */
.st-price-reference {
    margin-top: 16px;
    border: 1.5px solid var(--st-gray-200);
    border-radius: 8px;
    overflow: hidden;
}

.st-price-reference summary {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--st-gray-600);
    background: var(--st-gray-50);
    user-select: none;
    font-family: 'DM Sans', sans-serif;
}

.st-price-reference summary:hover { background: var(--st-gray-100); }

.st-price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-family: 'DM Sans', sans-serif;
}

.st-price-table th,
.st-price-table td {
    border: 1px solid var(--st-gray-100);
    padding: 7px 10px;
    text-align: center;
}

.st-price-table thead th {
    background: var(--st-gray-50);
    font-weight: 600;
    color: var(--st-black);
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
}

.st-price-table tbody tr:nth-child(even) { background: #fafafa; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .st-radio-group { gap: 6px; }
    .st-calc-header { font-size: 14px; }
}
