/* Tutor EMI Plugin — Frontend Styles (Responsive v10 — Brand #ff6600)
   Mobile-first approach: base styles = mobile, then scale up */

/* ══════════════════════════════════════════════════════
   BOX WRAPPER
══════════════════════════════════════════════════════ */
.tutor-emi-box {
    margin-top: 12px;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.tutor-emi-box--overdue {
    border-color: #ffaa80;
    background: #fff7f2;
}

.tutor-emi-box--completed {
    border-color: #68d391;
    background: #f0fff4;
}

/* ══════════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════════ */
.tutor-emi-box__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.tutor-emi-box__icon {
    font-size: 18px;
    flex-shrink: 0;
}

.tutor-emi-box__title {
    font-size: 15px;
    font-weight: 700;
    color: #1a202c;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.tutor-emi-box__subtitle {
    color: #4a5568;
    margin: 0 0 14px;
    font-size: 13px;
    word-break: break-word;
}

/* ══════════════════════════════════════════════════════
   META ROWS  — Mobile: stacked layout
══════════════════════════════════════════════════════ */
.tutor-emi-meta-row {
    display: flex;
    flex-direction: column;        /* mobile: label ↑ value ↓ */
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    color: #4a5568;
    gap: 2px;
}

.tutor-emi-meta-row:last-child {
    border-bottom: none;
}

/* Label */
.tutor-emi-meta-row > span:first-child {
    flex: none;
    min-width: unset;
    width: 100%;
    font-size: 12px;
    color: #718096;
    padding-top: 0;
    line-height: 1.4;
}

/* Value */
.tutor-emi-meta-row > strong {
    flex: none;
    width: 100%;
    text-align: left;
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    line-height: 1.4;
    font-size: 14px;
}

.tutor-emi-meta-row--highlight strong {
    color: #ff6600;
}

.tutor-emi-box__meta {
    margin-bottom: 14px;
}

/* ══════════════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════════════ */
.tutor-emi-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 0;
    white-space: nowrap;
}

.tutor-emi-badge--green  { background: #c6f6d5; color: #276749; }
.tutor-emi-badge--orange { background: #ffe4d4; color: #cc5200; }
.tutor-emi-badge--blue   { background: #bee3f8; color: #2b6cb0; }
.tutor-emi-badge--red    { background: #ffe4d4; color: #cc5200; }

/* ══════════════════════════════════════════════════════
   PLAN CARDS  — Mobile: 2 cards per row (grid)
══════════════════════════════════════════════════════ */
.tutor-emi-plans {
    display: grid;
    grid-template-columns: repeat(2, 1fr);   /* 2 per row on small screens */
    gap: 8px;
    margin-bottom: 14px;
}

/* Single plan — center it */
.tutor-emi-plans--single {
    grid-template-columns: 1fr !important;
    display: grid !important;
    max-width: 160px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    justify-items: center;
}

.tutor-emi-plan-card {
    cursor: pointer;
    min-width: 0;                            /* prevent overflow in grid */
}

.tutor-emi-plan-card input[type="radio"] {
    display: none;
}

.tutor-emi-plan-card__inner {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    user-select: none;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.tutor-emi-plan-card:hover .tutor-emi-plan-card__inner {
    border-color: #ffb380;
    background: #fff8f4;
}

.tutor-emi-plan-card.selected .tutor-emi-plan-card__inner,
.tutor-emi-plan-card input:checked ~ .tutor-emi-plan-card__inner {
    border-color: #ff6600;
    background: #fff4ee;
    box-shadow: 0 0 0 3px rgba(255,96,0,.15);
}

.tutor-emi-plan-card__months {
    font-size: 16px;
    font-weight: 800;
    color: #1a202c;
    line-height: 1.2;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 3px;
}

.tutor-emi-plan-card__down {
    font-size: 11px;
    color: #718096;
    margin-top: 5px;
    word-break: break-word;
}

.tutor-emi-plan-card__down strong {
    color: #ff6600;
    font-size: 17px;
}

.tutor-emi-plan-card__monthly {
    font-size: 10px;
    color: #718096;
    margin-top: 3px;
}

/* ══════════════════════════════════════════════════════
   SUMMARY
══════════════════════════════════════════════════════ */
.tutor-emi-summary {
    background: #fff8f4;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 14px;
    animation: emiSlideFade .25s ease;
    word-break: break-word;
}

@keyframes emiSlideFade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════
   BUTTONS  — Full width on all screens (already block)
══════════════════════════════════════════════════════ */
.tutor-emi-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s, opacity 0.2s;
    box-sizing: border-box;
    margin-top: 0;
    -webkit-tap-highlight-color: transparent;  /* remove tap flash on iOS */
    touch-action: manipulation;                /* faster tap response */
}

.tutor-emi-btn--locked,
.tutor-emi-btn[disabled] {
    background: #cbd5e0 !important;
    color: #718096 !important;
    cursor: not-allowed !important;
    opacity: 0.7;
    transform: none !important;
    pointer-events: auto;
}

.tutor-emi-btn--primary {
    background: #ff6600;
    color: #ffffff !important;
}

.tutor-emi-btn--primary:not([disabled]):hover {
    background: #e55a00;
    transform: translateY(-1px);
}

.tutor-emi-btn--secondary {
    background: #fff4ee;
    color: #cc5200 !important;
    border: 2px solid #ffb380;
}

.tutor-emi-btn--secondary:hover {
    background: #ffe4d4;
}

/* ══════════════════════════════════════════════════════
   FINE PRINT & NOTICE
══════════════════════════════════════════════════════ */
.tutor-emi-box__fine-print {
    font-size: 11px;
    color: #a0aec0;
    margin-top: 10px;
    text-align: center;
    word-break: break-word;
}

.tutor-emi-box__notice {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
    word-break: break-word;
}

.tutor-emi-box__notice--error {
    background: #fff4ee;
    color: #cc5200;
    border: 1px solid #ffb380;
}

/* ══════════════════════════════════════════════════════
   CHECKOUT EMI PLAN
══════════════════════════════════════════════════════ */
.tutor-emi-checkout-plan {
    background: #fff8f4;
    border: 1px solid #ffcbaa;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    font-size: 14px;
    word-break: break-word;
}

.tutor-emi-checkout-plan p {
    margin: 0 0 8px;
}

.tutor-emi-checkout-plan ul li {
    padding: 3px 0;
    color: #4a5568;
}


/* ══════════════════════════════════════════════════════
   ── TABLET  (481px – 767px) ──
══════════════════════════════════════════════════════ */
@media screen and (min-width: 481px) and (max-width: 767px) {

    .tutor-emi-box {
        padding: 18px 20px;
    }

    .tutor-emi-box__title {
        font-size: 15px;
    }

    /* Meta rows: still stacked but label gets a bit more breathing room */
    .tutor-emi-meta-row > span:first-child {
        font-size: 12px;
    }

    /* Plan cards: 3 per row on wider tablets if enough cards */
    .tutor-emi-plans {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    /* Single plan — center on tablet */
    .tutor-emi-plans--single {
        grid-template-columns: 1fr !important;
        display: grid !important;
        max-width: 160px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .tutor-emi-plan-card__months { font-size: 17px; }
    .tutor-emi-plan-card__down   { font-size: 12px; }
    .tutor-emi-plan-card__monthly { font-size: 11px; }

    .tutor-emi-btn {
        font-size: 15px;
        padding: 13px 18px;
    }
}


/* ══════════════════════════════════════════════════════
   ── DESKTOP / LAPTOP  (768px+) ──
══════════════════════════════════════════════════════ */
@media screen and (min-width: 768px) {

    .tutor-emi-box {
        padding: 20px 22px;
    }

    .tutor-emi-box__icon { font-size: 20px; }

    .tutor-emi-box__title { font-size: 16px; }

    /* Meta rows: side-by-side (label left, value right) */
    .tutor-emi-meta-row {
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;
    }

    .tutor-emi-meta-row > span:first-child {
        flex: 0 0 auto;
        min-width: 130px;
        width: auto;
        font-size: 14px;
        color: #4a5568;
        padding-top: 2px;
    }

    .tutor-emi-meta-row > strong {
        flex: 1 1 auto;
        width: auto;
        text-align: right;
        flex-direction: column;
        align-items: flex-end;
        font-size: 14px;
    }

    /* Plan cards: flexible row (original desktop behaviour) */
    .tutor-emi-plans {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        grid-template-columns: unset;
    }

    .tutor-emi-plan-card {
        flex: 1 1 80px;
        min-width: 80px;
    }

    /* Single plan — center on desktop */
    .tutor-emi-plans--single {
        display: flex !important;
        justify-content: center !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .tutor-emi-plans--single .tutor-emi-plan-card {
        flex: 0 0 160px !important;
        max-width: 160px !important;
    }

    .tutor-emi-plan-card__inner {
        padding: 12px 10px;
    }

    .tutor-emi-plan-card__months  { font-size: 18px; }
    .tutor-emi-plan-card__down    { font-size: 12px; }
    .tutor-emi-plan-card__monthly { font-size: 11px; }

    .tutor-emi-btn {
        font-size: 15px;
        padding: 13px 20px;
    }

    .tutor-emi-box__meta     { margin-bottom: 16px; }
    .tutor-emi-summary       { padding: 12px 14px; margin-bottom: 16px; }
    .tutor-emi-box__notice   { padding: 10px 14px; margin-bottom: 14px; }
    .tutor-emi-checkout-plan { padding: 12px 14px; }
}


/* ══════════════════════════════════════════════════════
   ── LARGE DESKTOP  (1200px+) ──
══════════════════════════════════════════════════════ */
@media screen and (min-width: 1200px) {

    .tutor-emi-box {
        padding: 22px 26px;
    }

    .tutor-emi-box__title { font-size: 17px; }

    .tutor-emi-plan-card__months { font-size: 20px; }
    .tutor-emi-plan-card__down   { font-size: 13px; }
}

/* ══════════════════════════════════════════════════════
   COMPACT STRIP
══════════════════════════════════════════════════════ */

.tutor-emi-compact-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 14px 16px;
    margin: -16px -16px 0;          /* bleed to box edges */
    border-radius: 10px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
    position: relative;
    overflow: hidden;
    transition: background .2s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Subtle shimmer line on top */
.tutor-emi-compact-strip::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, #ff6600, #ff8533, #ff6600);
    background-size: 200% 100%;
    animation: emiShimmer 2.5s linear infinite;
}

@keyframes emiShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.tutor-emi-compact-strip:hover {
    background: linear-gradient(135deg, #111 0%, #1a1a2e 60%, #16213e 100%);
}

/* ── No Cost EMI badge ── */
.tutor-emi-strip-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #ffffff;
    color: #cc5200;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: .3px;
    text-transform: uppercase;
}

/* ── Main text block ── */
.tutor-emi-strip-main {
    flex: 1;
    min-width: 0;
}

.tutor-emi-strip-headline {
    font-size: 14px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
    margin-bottom: 3px;
    letter-spacing: -.1px;
}

.tutor-emi-strip-tagline {
    font-size: 11px;
    color: rgba(255,255,255,.6);
    line-height: 1.4;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Plan pills */
.tutor-emi-strip-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tutor-emi-pill {
    font-size: 11px;
    color: rgba(255,255,255,.9);
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.15);
    padding: 2px 9px;
    border-radius: 20px;
    white-space: nowrap;
}

.tutor-emi-pill strong {
    color: #ff8533;
}

/* ── CTA arrow block ── */
.tutor-emi-strip-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.tutor-emi-strip-cta-text {
    font-size: 11px;
    font-weight: 700;
    color: #ff8533;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

.tutor-emi-strip-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    color: #fff;
    transition: transform .25s ease, background .2s;
}

.tutor-emi-compact-strip:hover .tutor-emi-strip-chevron {
    background: #ff6600;
}

/* Rotated when open */
.tutor-emi-strip--open .tutor-emi-strip-chevron {
    transform: rotate(180deg);
    background: #ff6600;
}

/* Strip open — rounded bottom */
.tutor-emi-compact-strip:not(.tutor-emi-strip--open) {
    border-radius: 10px;
    margin-bottom: 0;
}

.tutor-emi-strip--open {
    border-radius: 10px;
    margin-bottom: 0;
}

/* ══════════════════════════════════════════════════════
   EXPAND BODY
══════════════════════════════════════════════════════ */

.tutor-emi-expand-body {
    display: none;
    overflow: hidden;
}

.tutor-emi-expand-body.tutor-emi-expanded {
    display: block;
    animation: emiSlideDown .22s ease;
}

@keyframes emiSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tutor-emi-expand-inner {
    padding-top: 16px;
}

/* Trust bar */
.tutor-emi-trust-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-bottom: 12px;
}

.tutor-emi-trust-bar span {
    font-size: 11px;
    color: #4a5568;
    font-weight: 500;
}

.tutor-emi-expand-subtitle {
    font-size: 13px;
    color: #4a5568;
    margin: 0 0 14px;
    line-height: 1.5;
}

/* ── Box outer: remove default padding bleed fix ── */
.tutor-emi-box--new {
    padding-top: 0 !important;
    overflow: hidden;
}

/* Mobile: tagline wraps, pills stack */
@media screen and (max-width: 480px) {
    .tutor-emi-compact-strip {
        flex-wrap: wrap;
        gap: 8px;
    }
    .tutor-emi-strip-tagline {
        white-space: normal;
        font-size: 10px;
    }
    .tutor-emi-strip-cta { flex-direction: row; }
    .tutor-emi-strip-badge { font-size: 10px; }
    .tutor-emi-strip-headline { font-size: 13px; }
}
