/* ============================================================
   Katha Decimal Converter – kdc-style.css
   All selectors scoped to .kdc-wrap to avoid theme conflicts
   ============================================================ */

.kdc-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #ffffff;
    border: 2.5px solid #e53e3e;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10), 0 1.5px 6px rgba(0,0,0,0.06);
    max-width: 540px;
    margin: 32px auto;
    padding: 28px 28px 24px;
    color: #1f2937;
    line-height: 1.6;
    box-sizing: border-box;
}

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

/* ── Region row ──────────────────────────────────────────── */
.kdc-region-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.kdc-region-btn {
    flex: 1;
    padding: 10px 8px;
    border-radius: 10px;
    border: 1.5px solid #e5e7eb;
    background: #f9fafb;
    font-size: 0.92rem;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: center;
    outline: none;
}

.kdc-region-btn:hover {
    border-color: #e74c3c;
    color: #c0392b;
    background: #fff5f5;
}

.kdc-region-btn.kdc-active {
    background: #c0392b;
    color: #ffffff;
    border-color: #c0392b;
    box-shadow: 0 2px 8px rgba(192,57,43,0.25);
}

.kdc-badge {
    display: inline-block;
    background: rgba(255,255,255,0.25);
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 4px;
    padding: 1px 5px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-left: 4px;
    vertical-align: middle;
}

.kdc-region-btn:not(.kdc-active) .kdc-badge {
    background: #fee2e2;
    color: #c0392b;
}

/* ── Custom rate box ─────────────────────────────────────── */
.kdc-custom-box {
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 18px;
}

.kdc-custom-box label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.kdc-custom-box input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    color: #1f2937;
    background: #ffffff;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.kdc-custom-box input:focus {
    border-color: #e53e3e;
    box-shadow: 0 0 0 3px rgba(192,57,43,0.15);
}

/* ── Info chip ───────────────────────────────────────────── */
.kdc-chip {
    display: inline-flex;
    align-items: center;
    background: #fff5f5;
    border: 1px solid #fca5a5;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 0.79rem;
    color: #c0392b;
    font-weight: 500;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 2px;
}

/* ── Section labels ──────────────────────────────────────── */
.kdc-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 10px;
}

.kdc-section-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* ── Input rows ──────────────────────────────────────────── */
.kdc-input-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.kdc-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}

.kdc-decimal-field {
    margin-bottom: 12px;
}

.kdc-field label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #4b5563;
    margin: 0;
    padding: 0;
}

.kdc-field input,
.kdc-decimal-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    color: #1f2937;
    background: #ffffff;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    -moz-appearance: textfield;
}

.kdc-field input::-webkit-inner-spin-button,
.kdc-field input::-webkit-outer-spin-button {
    opacity: 0.5;
}

.kdc-field input:hover { border-color: #cbd5e1; }

.kdc-field input:focus {
    border-color: #e53e3e;
    box-shadow: 0 0 0 3px rgba(192,57,43,0.15);
    background: #fff5f5;
}

/* ── Result boxes ────────────────────────────────────────── */
.kdc-result {
    border-radius: 10px;
    border: 1.5px solid #e5e7eb;
    background: #f9fafb;
    padding: 14px 16px;
    min-height: 68px;
    margin-bottom: 4px;
    transition: all 0.18s ease;
}

.kdc-result.kdc-has-result {
    border-color: #86efac;
    background: #f0fdf4;
}

.kdc-result-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #9ca3af;
    margin-bottom: 5px;
}

.kdc-result.kdc-has-result .kdc-result-label { color: #15803d; }

.kdc-result-val {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.4;
}

.kdc-result.kdc-has-result .kdc-result-val { color: #166534; }

.kdc-result-sub {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-top: 3px;
}

.kdc-result.kdc-has-result .kdc-result-sub { color: #4ade80; }

/* ── Divider ─────────────────────────────────────────────── */
.kdc-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
    color: #9ca3af;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.kdc-divider::before,
.kdc-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* ── Clear button ────────────────────────────────────────── */
.kdc-clear {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 11px;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    background: #ffffff;
    font-size: 0.92rem;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.18s ease;
    letter-spacing: 0.01em;
}

.kdc-clear:hover {
    background: #fff5f5;
    border-color: #e74c3c;
    color: #c0392b;
}

.kdc-clear:active { transform: scale(0.98); }

/* ── Reference table ─────────────────────────────────────── */
.kdc-ref-table {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 18px;
    font-size: 0.83rem;
    color: #4b5563;
}

.kdc-ref-table p {
    margin: 0 0 4px 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kdc-ref-table p:last-child { margin-bottom: 0; }

.kdc-arrow {
    color: #e74c3c;
    font-size: 0.7rem;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
    .kdc-wrap { padding: 18px 14px 16px; }
}

@media (max-width: 360px) {
    .kdc-input-row { grid-template-columns: 1fr; }
    .kdc-chip { font-size: 0.72rem; }
}
