/* IT STORE EMI Calculator v1.2.0 — black / red / white, responsive */
.itstore-emi-modal,
.itstore-emi-modal * { box-sizing: border-box; }

.itstore-emi-modal {
    --emi-red: #d71920;
    --emi-red-dark: #b5121b;
    --emi-red-soft: #fff1f1;
    --emi-ink: #171717;
    --emi-text: #333;
    --emi-muted: #667085;
    --emi-line: #e9eaee;
    --emi-bg: #f5f5f6;
    --emi-ease: cubic-bezier(.22, .8, .24, 1);
}

/* ---------- Trigger button ---------- */
.itstore-emi-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    margin-top: 12px;
    padding: 11px 22px;
    border: 1px solid #d71920;
    border-radius: 10px;
    background: #d71920;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, transform .15s ease, box-shadow .2s ease;
}
.itstore-emi-open:hover,
.itstore-emi-open:focus { background: #b5121b; border-color: #b5121b; color: #fff; box-shadow: 0 6px 16px rgba(215, 25, 32, .28); }
.itstore-emi-open:active { transform: scale(.98); }
.itstore-emi-no-scroll { overflow: hidden !important; }

/* ---------- Modal shell ---------- */
.itstore-emi-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    visibility: hidden;
    pointer-events: none;
    font-family: inherit;
    color: var(--emi-ink);
    -webkit-font-smoothing: antialiased;
    transition: visibility 0s linear .28s;
}
.itstore-emi-modal.is-open { visibility: visible; pointer-events: auto; transition-delay: 0s; }

.itstore-emi-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 10, .62);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity .28s ease;
}
.itstore-emi-modal.is-open .itstore-emi-overlay { opacity: 1; }

.itstore-emi-dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(1000px, 100%);
    height: min(700px, 100%);
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .28);
    overscroll-behavior: contain;
    opacity: 0;
    transform: translateY(18px) scale(.98);
    transition: opacity .28s ease, transform .34s var(--emi-ease);
}
.itstore-emi-modal.is-open .itstore-emi-dialog { opacity: 1; transform: none; }

.itstore-emi-grabber { display: none; }

.itstore-emi-close {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 5;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--emi-bg);
    color: #222;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}
.itstore-emi-close:hover { background: var(--emi-red-soft); color: var(--emi-red); transform: rotate(90deg); }

.itstore-emi-header {
    flex: 0 0 auto;
    padding: 20px 76px 16px 40px;
    border-bottom: 1px solid var(--emi-line);
}
.itstore-emi-header h2 { margin: 0 0 3px; color: #111; font-size: 26px; font-weight: 500; line-height: 1.2; letter-spacing: -.01em; }
.itstore-emi-header p { margin: 0; color: var(--emi-muted); font-size: 13px; line-height: 1.5; }

/* ---------- Layout ---------- */
.itstore-emi-layout {
    position: relative;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 0;
    padding: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* ---------- Bank panel ---------- */
.itstore-emi-bank-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    padding: 20px 6px 20px 30px;
    border-right: 0;
    background: #fff;
}
.itstore-emi-bank-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 6px 12px 0; }
.itstore-emi-bank-heading h3 { margin: 0; margin-right: auto; color: var(--emi-ink); font-size: 15px; font-weight: 700; }
.itstore-emi-bank-count { flex: 0 0 auto; padding: 3px 9px; border-radius: 99px; background: var(--emi-bg); color: var(--emi-muted); font-size: 12px; font-weight: 600; }
.itstore-emi-back { display: none; }

.itstore-emi-search { position: relative; margin: 0 6px 12px 0; }
.itstore-emi-search svg { position: absolute; top: 50%; left: 13px; transform: translateY(-50%); color: #98a2b3; pointer-events: none; }
.itstore-emi-modal input.itstore-emi-bank-search {
    display: block;
    width: 100%;
    height: 46px;
    margin: 0;
    padding: 0 14px 0 38px;
    border: 1px solid #dfe1e6;
    border-radius: 12px;
    outline: none;
    background: #fff;
    color: var(--emi-ink);
    font-size: 14px;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.itstore-emi-modal input.itstore-emi-bank-search:focus { border-color: var(--emi-red); box-shadow: 0 0 0 4px rgba(215, 25, 32, .1); }

.itstore-emi-bank-list {
    display: flex;
    align-content: flex-start;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 auto;
    min-height: 0;
    padding: 2px 8px 6px 2px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #d0d3d9 transparent;
    scroll-behavior: smooth;
}
.itstore-emi-bank-list::-webkit-scrollbar,
.itstore-emi-content::-webkit-scrollbar { width: 6px; }
.itstore-emi-bank-list::-webkit-scrollbar-thumb,
.itstore-emi-content::-webkit-scrollbar-thumb { border-radius: 6px; background: #d0d3d9; }

.itstore-emi-modal button.itstore-emi-bank {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: auto;
    min-height: 58px;
    overflow: visible;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--emi-line);
    border-radius: 12px;
    background: #fff;
    color: var(--emi-text);
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .12s ease;
}
.itstore-emi-modal button.itstore-emi-bank:hover { border-color: #f0a3a6; background: #fffafa; }
.itstore-emi-modal button.itstore-emi-bank:active { transform: scale(.985); }
.itstore-emi-modal button.itstore-emi-bank.is-active {
    border-color: var(--emi-red);
    background: var(--emi-red-soft);
    color: #9d0f16;
    font-weight: 700;
    box-shadow: 0 0 0 1px var(--emi-red) inset;
}
.itstore-emi-modal button.itstore-emi-bank:focus-visible,
.itstore-emi-modal button:focus-visible { outline: 2px solid var(--emi-red); outline-offset: 2px; }
.itstore-emi-bank-name { flex: 1 1 auto; min-width: 0; color: inherit; font-weight: inherit; text-align: left; word-break: normal; overflow-wrap: break-word; hyphens: auto; }
.itstore-emi-no-banks { margin: 12px 4px; color: var(--emi-muted); font-size: 13px; }

.itstore-emi-avatar {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: var(--emi-red);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}
.itstore-emi-avatar-lg { width: 42px; height: 42px; font-size: 18px; }

/* ---------- Content panel ---------- */
.itstore-emi-content {
    min-width: 0;
    min-height: 0;
    margin: 20px 30px 22px 14px;
    padding: 20px 20px 22px;
    border-radius: 16px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #f4f4f4;
    scrollbar-width: thin;
    scrollbar-color: #d0d3d9 transparent;
}

.itstore-emi-field { margin-bottom: 14px; padding: 0; }
.itstore-emi-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.itstore-emi-content label { display: block; margin: 0; color: var(--emi-ink); font-size: 16px; font-weight: 500; }
.itstore-emi-modal button#itstore-emi-reset {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    margin: 0;
    padding: 5px 11px;
    border: 0;
    border-radius: 99px;
    background: var(--emi-red-soft);
    color: var(--emi-red);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}
.itstore-emi-modal button#itstore-emi-reset:hover { background: var(--emi-red); color: #fff; }
.itstore-emi-modal button#itstore-emi-reset svg { transition: transform .4s var(--emi-ease); }
.itstore-emi-modal button#itstore-emi-reset:hover svg { transform: rotate(-200deg); }

.itstore-emi-input { position: relative; }
.itstore-emi-input-prefix { position: absolute; top: 50%; left: 16px; transform: translateY(-50%); color: var(--emi-muted); font-size: 18px; font-weight: 700; pointer-events: none; }
.itstore-emi-modal .itstore-emi-input input {
    display: block;
    width: 100%;
    height: 54px;
    margin: 0;
    padding: 0 16px 0 38px;
    border: 1px solid #ececec;
    border-radius: 14px;
    outline: none;
    background: #fff;
    color: #111;
    font-size: 17px;
    font-weight: 500;
    box-shadow: none;
    -moz-appearance: textfield;
    appearance: textfield;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.itstore-emi-modal .itstore-emi-input input::-webkit-outer-spin-button,
.itstore-emi-modal .itstore-emi-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.itstore-emi-modal .itstore-emi-input input:focus { border-color: var(--emi-red); box-shadow: 0 0 0 4px rgba(215, 25, 32, .1); }
.itstore-emi-hint { margin: 9px 2px 0; color: var(--emi-muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }

/* Selected bank card */
.itstore-emi-modal button.itstore-emi-selected-bank {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid #f3c9cb;
    border-radius: 16px;
    background: #fff;
    color: var(--emi-ink);
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    cursor: default;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.itstore-emi-selected-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; gap: 2px; }
.itstore-emi-selected-text small { color: var(--emi-red); font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.itstore-emi-selected-text strong { color: var(--emi-ink); font-size: 16px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.itstore-emi-selected-text em { color: var(--emi-muted); font-size: 12px; font-style: normal; }
.itstore-emi-change { display: none; align-items: center; gap: 2px; color: var(--emi-red); font-size: 13px; font-weight: 700; }

.itstore-emi-results-heading { margin: 0 0 12px; }
.itstore-emi-results-heading h3 { margin: 0 0 3px; color: var(--emi-ink); font-size: 16px; font-weight: 700; }
.itstore-emi-results-heading p { margin: 0; color: var(--emi-muted); font-size: 13px; }

/* ---------- Plans table (desktop) ---------- */
.itstore-emi-table-wrap { width: 100%; min-width: 0; overflow: hidden; border: 1px solid #e6e6e6; border-radius: 12px; background: #fff; }
.itstore-emi-table { width: 100%; margin: 0; border: 0; border-collapse: collapse; background: transparent; }
.itstore-emi-table th,
.itstore-emi-table td { padding: 14px 16px; border: 0; border-bottom: 1px solid var(--emi-line); text-align: left; vertical-align: middle; font-size: 14px; line-height: 1.4; }
.itstore-emi-table th { background: #fafafa; color: var(--emi-ink); font-size: 13px; font-weight: 600; }
.itstore-emi-table td { background: transparent; color: var(--emi-text); transition: background .15s ease; }
.itstore-emi-table tbody tr:last-child td { border-bottom: 0; }
.itstore-emi-table tbody tr:hover td { background: #fff7f7; }
.itstore-emi-plan-pill { color: var(--emi-ink); font-weight: 600; }
.itstore-emi-c-emi { color: var(--emi-red); font-size: 15px; font-weight: 700; white-space: nowrap; }
.itstore-emi-c-charge { white-space: nowrap; }
.itstore-emi-rate { display: block; color: var(--emi-ink); font-weight: 600; }
.itstore-emi-c-charge small { color: var(--emi-muted); font-size: 12px; }
.itstore-emi-c-total { color: var(--emi-ink); font-weight: 700; white-space: nowrap; }
.itstore-emi-empty-row td { padding: 28px 16px; color: var(--emi-muted); text-align: center; }

.itstore-emi-table tbody tr.is-animated { animation: itstore-emi-row .38s var(--emi-ease) both; }
@keyframes itstore-emi-row { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.itstore-emi-disclaimer { margin: 14px 2px 0; color: var(--emi-muted); font-size: 12px; line-height: 1.5; }

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
    .itstore-emi-layout { grid-template-columns: 250px minmax(0, 1fr); }
    .itstore-emi-bank-panel { padding-left: 20px; }
    .itstore-emi-content { margin: 16px 20px 18px 10px; padding: 16px; }
    .itstore-emi-table th, .itstore-emi-table td { padding: 13px 10px; }
}

/* ---------- Mobile: same layout, scaled down ---------- */
@media (max-width: 700px) {
    .itstore-emi-modal { padding: 10px; }
    .itstore-emi-dialog { width: 100%; height: min(560px, 100%); border-radius: 18px; transform: translateY(14px) scale(.97); }
    .itstore-emi-modal.is-open .itstore-emi-dialog { transform: none; }

    .itstore-emi-close { top: 12px; right: 12px; width: 34px; height: 34px; }
    .itstore-emi-header { padding: 16px 56px 12px 16px; }
    .itstore-emi-header h2 { margin: 0; font-size: 21px; }
    .itstore-emi-header p { display: none; }

    .itstore-emi-layout { grid-template-columns: 92px minmax(0, 1fr); }

    /* Bank column */
    .itstore-emi-bank-panel { padding: 10px 0 10px 8px; }
    .itstore-emi-bank-heading { display: none; }
    .itstore-emi-back { display: none; }
    .itstore-emi-search { margin: 0 6px 8px 0; }
    .itstore-emi-search svg { display: none; }
    .itstore-emi-modal input.itstore-emi-bank-search { height: 36px; padding: 0 8px; border-radius: 9px; font-size: 16px; }
    .itstore-emi-bank-list { gap: 6px; padding: 1px 6px 6px 1px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
    .itstore-emi-bank-list::-webkit-scrollbar { height: 5px; }
    .itstore-emi-bank-list::-webkit-scrollbar-thumb { border-radius: 5px; background: #d0d3d9; }
    .itstore-emi-modal button.itstore-emi-bank { width: max-content; min-width: 100%; }
    .itstore-emi-bank-name { flex: 0 0 auto; white-space: nowrap; overflow-wrap: normal; word-break: normal; hyphens: none; }
    .itstore-emi-modal button.itstore-emi-bank { gap: 6px; min-height: 40px; padding: 6px; border-radius: 9px; font-size: 11px; line-height: 1.25; }
    .itstore-emi-avatar { width: 20px; height: 20px; min-width: 20px; font-size: 11px; }
    .itstore-emi-modal button.itstore-emi-bank { min-height: 42px; }

    /* Right panel */
    .itstore-emi-content { margin: 10px 10px 10px 4px; padding: 12px 10px 14px; border-radius: 14px; }
    .itstore-emi-content label { font-size: 14px; }
    .itstore-emi-field { margin-bottom: 10px; }
    .itstore-emi-section-heading { margin-bottom: 7px; }
    .itstore-emi-modal button#itstore-emi-reset { min-height: 28px; padding: 4px 9px; font-size: 11px; }
    .itstore-emi-modal .itstore-emi-input input { height: 46px; padding-left: 30px; font-size: 16px; border-radius: 12px; }
    .itstore-emi-input-prefix { left: 13px; font-size: 15px; }
    .itstore-emi-hint { margin-top: 6px; font-size: 10.5px; }

    .itstore-emi-modal button.itstore-emi-selected-bank { gap: 8px; margin-bottom: 12px; padding: 8px 10px; border-radius: 12px; }
    .itstore-emi-avatar-lg { width: 30px; height: 30px; font-size: 14px; }
    .itstore-emi-selected-text small { font-size: 9px; }
    .itstore-emi-selected-text strong { font-size: 13px; }
    .itstore-emi-selected-text em { font-size: 10.5px; }
    .itstore-emi-change { display: none; }

    .itstore-emi-results-heading { margin-bottom: 8px; }
    .itstore-emi-results-heading h3 { font-size: 14px; }
    .itstore-emi-results-heading p { display: none; }

    .itstore-emi-table-wrap { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
    .itstore-emi-table-wrap::-webkit-scrollbar { height: 5px; }
    .itstore-emi-table-wrap::-webkit-scrollbar-thumb { border-radius: 5px; background: #d0d3d9; }
    .itstore-emi-table { min-width: 400px; }
    .itstore-emi-table th, .itstore-emi-table td { padding: 12px 12px; font-size: 12.5px; line-height: 1.35; white-space: nowrap; }
    .itstore-emi-table th { font-size: 12px; }
    .itstore-emi-c-emi { font-size: 13px; white-space: nowrap; }
    .itstore-emi-c-total { white-space: nowrap; }
    .itstore-emi-c-charge small { display: block; font-size: 11px; }
    .itstore-emi-disclaimer { margin-top: 10px; font-size: 10.5px; }
}

@media (max-width: 380px) {
    .itstore-emi-layout { grid-template-columns: 84px minmax(0, 1fr); }
    .itstore-emi-content { padding: 10px 6px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .itstore-emi-modal *, .itstore-emi-modal { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
