/* IPP Frontend v5.0 — bilingual, Card D + Drawer + Bottom Sheet */

.ipp-root {
    --ipp-accent:      #16a34a;
    --ipp-accent-text: #ffffff;
    --ipp-ch-bg:       #f0fdf4;
    --ipp-ch-border:   #bbf7d0;
    --ipp-ch-title:    #14532d;
    --ipp-ch-sub:      #16a34a;
    --ipp-drw-bg:      #ffffff;
    --ipp-overlay:     rgba(0,0,0,.4);
    --ipp-text:        #111827;
    --ipp-muted:       #6b7280;
    --ipp-border:      #e5e7eb;
    --ipp-badge-bg:    #111827;
    --ipp-badge-text:  #ffffff;
    --ipp-tab-active:  #2563eb;
    --ipp-w:           460px;
    --ipp-logo:        56px;
    --ipp-card:        130px;
    --ipp-r:           12px;
    position: relative;
    font-family: inherit;
    color: var(--ipp-text);
}

/* ════════════════════════════════════════
   PRODUCT CARD
════════════════════════════════════════ */
.ipp-card {
    border: 1px solid var(--ipp-border);
    border-radius: var(--ipp-r);
    overflow: hidden;
    background: #fff;
}

.ipp-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--ipp-ch-bg);
    border-bottom: 1px solid var(--ipp-ch-border);
    gap: 10px;
}

.ipp-card-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ipp-card-icon {
    width: 30px;
    height: 30px;
    background: var(--ipp-accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ipp-accent-text);
    flex-shrink: 0;
}

.ipp-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ipp-ch-title);
    line-height: 1.3;
}

.ipp-card-sub {
    font-size: 11px;
    color: var(--ipp-ch-sub);
    margin-top: 2px;
}

.ipp-co-count {
    background: var(--ipp-accent);
    color: var(--ipp-accent-text);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Steps */
.ipp-steps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 14px 16px;
}

.ipp-step {
    border: 1px solid var(--ipp-border);
    border-radius: calc(var(--ipp-r) - 2px);
    padding: 10px 6px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    position: relative;
    user-select: none;
}

.ipp-step:hover { border-color: var(--ipp-accent); }

.ipp-step.is-active {
    border-color: var(--ipp-accent);
    background: var(--ipp-ch-bg);
}

.ipp-step-check {
    position: absolute;
    top: 4px;
    width: 15px;
    height: 15px;
    background: var(--ipp-accent);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

[dir="ltr"] .ipp-step-check { right: 4px; }
[dir="rtl"] .ipp-step-check { left: 4px; }
.ipp-step.is-active .ipp-step-check { display: flex; }
.ipp-step-check svg { color: #fff; }

.ipp-step-mo {
    font-size: 16px;
    font-weight: 700;
    color: var(--ipp-text);
    line-height: 1;
}
.ipp-step.is-active .ipp-step-mo { color: var(--ipp-accent); }

.ipp-step-lbl {
    font-size: 10px;
    color: var(--ipp-muted);
    margin-top: 2px;
}
.ipp-step.is-active .ipp-step-lbl { color: var(--ipp-accent); }

.ipp-step-amt {
    font-size: 11px;
    font-weight: 600;
    color: var(--ipp-text);
    margin-top: 6px;
    line-height: 1.3;
}
.ipp-step.is-active .ipp-step-amt { color: var(--ipp-ch-title); }

/* Footer */
.ipp-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--ipp-border);
    gap: 10px;
    flex-wrap: wrap;
}

.ipp-footer-logos {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.ipp-via-text {
    font-size: 11px;
    color: var(--ipp-muted);
    flex-shrink: 0;
}

/* Logo pills — show actual logos */
.ipp-logo-pills {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.ipp-logo-pill {
    width: 36px;
    height: 24px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
    border: 1px solid var(--ipp-border);
    background: #fff;
    padding: 2px;
}

.ipp-logo-pill img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ipp-logo-pill-text {
    font-size: 7px;
    font-weight: 700;
    color: var(--ipp-muted);
    white-space: nowrap;
}

.ipp-logo-pill-more {
    font-size: 11px;
    color: var(--ipp-muted);
    font-weight: 600;
    padding: 0 3px;
}

.ipp-open-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--ipp-badge-bg);
    color: var(--ipp-badge-text);
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity .15s;
    flex-shrink: 0;
    font-family: inherit;
}
.ipp-open-btn:hover { opacity: .88; }
[dir="rtl"] .ipp-chevron { transform: scaleX(-1); }

/* ════════════════════════════════════════
   OVERLAY
════════════════════════════════════════ */
.ipp-overlay {
    position: fixed;
    inset: 0;
    background: var(--ipp-overlay);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
    backdrop-filter: blur(2px);
}
.ipp-overlay.is-open { opacity: 1; visibility: visible; }

/* ════════════════════════════════════════
   DRAWER — DESKTOP (side panel)
════════════════════════════════════════ */
.ipp-drawer {
    position: fixed;
    top: 0;
    width: min(var(--ipp-w), 100vw);
    height: 100dvh;
    background: var(--ipp-drw-bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(0,0,0,.15);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    will-change: transform;
}

[dir="rtl"] .ipp-drawer { left: 0;  transform: translateX(-100%); }
[dir="ltr"] .ipp-drawer { right: 0; transform: translateX(100%);  }
.ipp-drawer.is-open { transform: translateX(0); }

/* Drawer head */
.ipp-drw-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--ipp-border);
    flex-shrink: 0;
}

.ipp-drw-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 3px;
    color: var(--ipp-text);
}
.ipp-drw-sub {
    font-size: 12px;
    color: var(--ipp-muted);
    margin: 0;
}

.ipp-close-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--ipp-border);
    border-radius: 8px;
    background: transparent;
    color: var(--ipp-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .12s, color .12s;
}
.ipp-close-btn:hover { background: #f3f4f6; color: var(--ipp-text); }

/* Drawer body — SCROLLABLE */
.ipp-drw-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Drawer footer — Pay Now button */
.ipp-drw-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--ipp-border);
    flex-shrink: 0;
    background: var(--ipp-drw-bg);
}

.ipp-pay-btn {
    width: 100%;
    padding: 13px 20px;
    background: var(--ipp-accent);
    color: var(--ipp-accent-text);
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity .15s, transform .1s;
}
.ipp-pay-btn:hover   { opacity: .92; }
.ipp-pay-btn:active  { transform: scale(.98); }
.ipp-pay-btn svg     { flex-shrink: 0; }
.ipp-pay-btn.is-hidden { display: none; }

body.ipp-locked { overflow: hidden; }

/* ════════════════════════════════════════
   BOTTOM SHEET — MOBILE (≤ 640px)
════════════════════════════════════════ */
@media (max-width: 640px) {
    .ipp-drawer {
        top: auto;
        bottom: 0;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 92dvh;
        border-radius: 18px 18px 0 0;
        transform: translateY(100%) !important;
        box-shadow: 0 -4px 30px rgba(0,0,0,.18);
    }

    .ipp-drawer.is-open { transform: translateY(0) !important; }

    /* drag handle */
    .ipp-drw-head::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: #d1d5db;
        border-radius: 999px;
    }

    .ipp-drw-head { position: relative; padding-top: 22px; }
}

/* ════════════════════════════════════════
   TYPE TABS
════════════════════════════════════════ */
.ipp-type-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.ipp-type-tabs.is-hidden { display: none; }

.ipp-type-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    border: 1px solid var(--ipp-border);
    border-radius: 9px;
    background: transparent;
    color: var(--ipp-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.ipp-type-tab:hover { border-color: var(--ipp-tab-active); color: var(--ipp-tab-active); }
.ipp-type-tab.is-active {
    border-color: var(--ipp-tab-active);
    color: var(--ipp-tab-active);
    background: #eff6ff;
}

/* ════════════════════════════════════════
   CAROUSEL
════════════════════════════════════════ */
.ipp-carousel {
    display: grid;
    grid-template-columns: 32px 1fr 32px;
    gap: 8px;
    align-items: center;
}

.ipp-arr {
    width: 32px;
    height: 32px;
    border: 1px solid var(--ipp-border);
    border-radius: 50%;
    background: #fff;
    color: var(--ipp-text);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s;
    flex-shrink: 0;
}
.ipp-arr:hover { background: #f9fafb; }

.ipp-carousel-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}
.ipp-carousel-scroll::-webkit-scrollbar { display: none; }

.ipp-carousel-track {
    display: flex;
    gap: 10px;
    padding-bottom: 2px;
}

/* Company card */
.ipp-co-card {
    min-width: var(--ipp-card);
    width: var(--ipp-card);
    flex-shrink: 0;
    border: 1.5px solid var(--ipp-border);
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, transform .15s, box-shadow .15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    position: relative;
    background: #fff;
}
.ipp-co-card:hover {
    border-color: var(--ipp-tab-active);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.07);
}
.ipp-co-card.is-active {
    border-color: var(--ipp-tab-active);
    background: #eff6ff;
    box-shadow: inset 0 0 0 1px var(--ipp-tab-active);
}

.ipp-co-logo {
    width: var(--ipp-logo);
    height: var(--ipp-logo);
    object-fit: contain;
    border-radius: 8px;
    display: block;
}
.ipp-co-logo-placeholder {
    width: var(--ipp-logo);
    height: var(--ipp-logo);
    border-radius: 8px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--ipp-muted);
}
.ipp-co-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--ipp-text);
    line-height: 1.3;
}

/* Active indicator dot (replaces "أفضل" text badge) */
.ipp-co-active-dot {
    position: absolute;
    top: 5px;
    width: 8px;
    height: 8px;
    background: var(--ipp-accent);
    border-radius: 50%;
    border: 1.5px solid #fff;
}
[dir="ltr"] .ipp-co-active-dot { right: 5px; }
[dir="rtl"] .ipp-co-active-dot { left: 5px; }

/* ════════════════════════════════════════
   NOTES CARD
════════════════════════════════════════ */
.ipp-notes-card {
    border: 1px solid var(--ipp-border);
    border-radius: 10px;
    padding: 12px 14px;
    background: #f9fafb;
}
.ipp-notes-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ipp-text);
    margin: 0 0 9px;
}
.ipp-notes-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.ipp-notes-list li {
    font-size: 13px;
    color: var(--ipp-text);
    display: flex;
    align-items: flex-start;
    gap: 7px;
}
.ipp-notes-list li::before {
    content: "✓";
    color: var(--ipp-accent);
    font-weight: 700;
    flex-shrink: 0;
}

/* ════════════════════════════════════════
   PLANS TABLE
════════════════════════════════════════ */
.ipp-plans-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ipp-muted);
    margin: 0;
}

.ipp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ipp-table thead tr { background: #f3f4f6; }
.ipp-table th {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ipp-muted);
    border-bottom: 1px solid var(--ipp-border);
    white-space: nowrap;
    text-align: start;
}
.ipp-th-end { text-align: end; }

.ipp-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--ipp-border);
    vertical-align: middle;
}
.ipp-table tbody tr { cursor: pointer; transition: background .1s; }
.ipp-table tbody tr:hover { background: #f9fafb; }
.ipp-table tbody tr.is-active { background: #eff6ff; }
.ipp-table tbody tr:last-child td { border-bottom: none; }

.ipp-td-months { display: flex; flex-direction: column; gap: 2px; }
.ipp-td-mo-n   { font-weight: 700; font-size: 15px; color: var(--ipp-text); }
.ipp-td-mo-lbl { font-size: 11px; color: var(--ipp-accent); font-weight: 500; }

.ipp-td-interest { display: flex; flex-direction: column; gap: 2px; }
.ipp-td-int-v    { font-size: 13px; color: var(--ipp-text); }
.ipp-td-fee-v    { font-size: 11px; color: var(--ipp-muted); }

.ipp-td-inst   { text-align: end; }
.ipp-td-inst-v { display: block; font-weight: 700; font-size: 14px; color: var(--ipp-text); }
.ipp-td-inst-n { display: block; font-size: 11px; color: var(--ipp-tab-active); margin-top: 2px; }

/* ════════════════════════════════════════
   SUMMARY
════════════════════════════════════════ */
.ipp-summary {
    border: 1px solid var(--ipp-border);
    border-radius: 10px;
    overflow: hidden;
}
.ipp-summary-main {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 13px 15px;
    background: #f9fafb;
    flex-wrap: wrap;
}
.ipp-sum-label { font-size: 13px; color: var(--ipp-muted); }
.ipp-sum-price {
    font-size: 26px;
    font-weight: 800;
    color: var(--ipp-tab-active);
    line-height: 1;
    transition: opacity .18s;
}
.ipp-sum-price.is-updating { opacity: .3; }
.ipp-sum-unit { font-size: 12px; color: var(--ipp-muted); }

.ipp-summary-rows { padding: 0 15px; }
.ipp-summary-rows:empty { display: none; }
.ipp-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-top: 1px solid var(--ipp-border);
    font-size: 13px;
}
.ipp-detail-row span   { color: var(--ipp-muted); }
.ipp-detail-row strong { color: var(--ipp-text); font-weight: 600; }

/* ════════════════════════════════════════
   EMPTY
════════════════════════════════════════ */
.ipp-empty {
    text-align: center;
    padding: 24px;
    color: var(--ipp-muted);
    font-size: 14px;
    border: 1px dashed var(--ipp-border);
    border-radius: var(--ipp-r);
}

/* ════════════════════════════════════════
   MOBILE CARD ADJUSTMENTS
════════════════════════════════════════ */
@media (max-width: 480px) {
    .ipp-steps-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 12px; }
    .ipp-card-footer { flex-direction: column; align-items: stretch; gap: 10px; }
    .ipp-open-btn { justify-content: center; }
    .ipp-drw-body { padding: 14px 16px; }
    .ipp-drw-footer { padding: 10px 16px; }
    .ipp-table th, .ipp-table td { padding: 9px 8px; font-size: 12px; }
}
