/* =========================================================
   Taman Dahab – Gold Purchase Calculator v1.1.4
   بطاقة حاسبة بتصميم احترافي: لوحة إدخال + لوحة ملخص داكنة
========================================================= */

.tmd-gpc,
.tmd-gpc *,
.tmd-gpc *::before,
.tmd-gpc *::after{
    box-sizing:border-box;
}

.tmd-gpc{
    /* ألوان الهوية */
    --tmd-ink:#141a24;
    --tmd-text:#3b4453;
    --tmd-muted:#6b7483;
    --tmd-faint:#9aa1ad;
    --tmd-navy:#161d29;
    --tmd-navy-2:#222c3b;
    --tmd-gold:#c08622;
    --tmd-gold-deep:#93610f;
    --tmd-gold-light:#f1d27a;
    --tmd-gold-grad:linear-gradient(135deg,#a8711a 0%,#d6a23c 45%,#f3dc8e 100%);
    --tmd-paper:#ffffff;
    --tmd-cream:#fbf7ee;
    --tmd-line:#ece4d3;
    --tmd-line-strong:#dfd1b4;
    --tmd-green:#1f9d57;
    --tmd-red:#c2412d;
    --tmd-radius:22px;
    --tmd-radius-sm:14px;

    container-type:inline-size;
    position:relative;
    display:grid;
    grid-template-columns:minmax(0,1.32fr) minmax(0,1fr);
    width:100%;
    margin:28px 0;
    overflow:hidden;

    border:1px solid var(--tmd-line);
    border-radius:var(--tmd-radius);
    background:var(--tmd-paper);
    box-shadow:
        0 1px 2px rgba(20,26,36,.04),
        0 12px 32px -8px rgba(20,26,36,.10),
        0 32px 64px -32px rgba(147,97,15,.18);

    direction:rtl;
    color:var(--tmd-ink);
    font-family:Cairo,"Tajawal","IBM Plex Sans Arabic",-apple-system,BlinkMacSystemFont,"Segoe UI",Tahoma,sans-serif;
    text-align:right;
    -webkit-font-smoothing:antialiased;
}

/* الأرقام تُعرض دائماً من اليسار لليمين: 1 146,00 وليس 146,00 1 */
.tmd-gpc .tmd-gpc__num{
    display:inline-block;
    direction:ltr!important;
    unicode-bidi:isolate!important;
    white-space:nowrap;
}

/* حماية من وسوم يضيفها المحرر أو wpautop داخل الأداة */
.tmd-gpc br,
.tmd-gpc p:empty{
    display:none!important;
}

/* ---------- Main panel ---------- */

.tmd-gpc__main{
    display:flex;
    flex-direction:column;
    gap:20px;
    min-width:0;
    padding:30px 30px 28px;
    background:
        radial-gradient(120% 70% at 100% 0%,rgba(241,210,122,.16),transparent 60%),
        var(--tmd-paper);
}

.tmd-gpc__head{
    display:flex;
    flex-direction:column;
    gap:8px;
    min-width:0;
}

.tmd-gpc .tmd-gpc__title{
    margin:0!important;
    padding:0!important;
    border:0!important;
    color:var(--tmd-ink)!important;
    font-family:inherit!important;
    font-size:22px!important;
    font-weight:800!important;
    line-height:1.4!important;
    letter-spacing:0!important;
    text-transform:none!important;
}

.tmd-gpc .tmd-gpc__title::before,
.tmd-gpc .tmd-gpc__title::after{
    display:none!important;
}

.tmd-gpc .tmd-gpc__subtitle{
    max-width:52ch;
    margin:0!important;
    padding:0!important;
    color:var(--tmd-muted)!important;
    font-size:14px!important;
    font-weight:500!important;
    line-height:1.85!important;
}

/* ---------- Field ---------- */

.tmd-gpc__field{
    display:flex;
    flex-direction:column;
    gap:10px;
    min-width:0;
}

.tmd-gpc .tmd-gpc__label{
    display:block!important;
    margin:0!important;
    padding:0!important;
    color:var(--tmd-text)!important;
    font-size:13px!important;
    font-weight:700!important;
    line-height:1.5!important;
    cursor:pointer;
}

.tmd-gpc__control{
    display:flex;
    align-items:center;
    gap:6px;
    height:66px;
    padding:6px;
    border:1.5px solid var(--tmd-line-strong);
    border-radius:var(--tmd-radius-sm);
    background:var(--tmd-cream);
    transition:border-color .18s ease,box-shadow .18s ease,background-color .18s ease;
}

.tmd-gpc__control:hover{
    border-color:#d3bf96;
}

.tmd-gpc__control:focus-within{
    border-color:var(--tmd-gold);
    background:#fff;
    box-shadow:0 0 0 4px rgba(192,134,34,.14);
}

.tmd-gpc__input-host{
    display:block;
    flex:1 1 auto;
    min-width:0;
}

.tmd-gpc .tmd-gpc__input{
    display:block!important;
    width:100%!important;
    height:52px!important;
    min-height:0!important;
    margin:0!important;
    padding:0 8px!important;
    border:0!important;
    border-radius:0!important;
    outline:0!important;
    background:transparent!important;
    box-shadow:none!important;
    color:var(--tmd-ink)!important;
    font-family:inherit!important;
    font-size:26px!important;
    font-weight:800!important;
    line-height:1!important;
    text-align:center!important;
    font-variant-numeric:tabular-nums;
    opacity:1!important;
    visibility:visible!important;
    pointer-events:auto!important;
    -moz-appearance:textfield;
    appearance:textfield;
}

.tmd-gpc .tmd-gpc__input::-webkit-outer-spin-button,
.tmd-gpc .tmd-gpc__input::-webkit-inner-spin-button{
    margin:0;
    -webkit-appearance:none;
}

.tmd-gpc .tmd-gpc__input::placeholder{
    color:#c3c7ce!important;
    font-weight:700!important;
    opacity:1!important;
}

.tmd-gpc__unit{
    flex:0 0 auto;
    padding:0 4px 0 10px;
    color:var(--tmd-muted);
    font-size:13px;
    font-weight:700;
    line-height:1;
    white-space:nowrap;
}

.tmd-gpc__step-host{
    display:block;
    flex:0 0 auto;
}

.tmd-gpc .tmd-gpc__step{
    position:relative!important;
    display:block!important;
    width:52px!important;
    height:52px!important;
    min-width:0!important;
    min-height:0!important;
    margin:0!important;
    padding:0!important;
    border:1px solid var(--tmd-line)!important;
    border-radius:11px!important;
    background:#fff!important;
    box-shadow:0 1px 2px rgba(20,26,36,.06)!important;
    color:var(--tmd-ink)!important;
    font-size:0!important;
    line-height:0!important;
    text-indent:0!important;
    cursor:pointer;
    transition:background-color .15s ease,border-color .15s ease,transform .1s ease;
    -webkit-tap-highlight-color:transparent;
}

.tmd-gpc .tmd-gpc__step::before,
.tmd-gpc .tmd-gpc__step--plus::after{
    content:"";
    position:absolute;
    top:50%;
    left:50%;
    width:16px;
    height:2.5px;
    border-radius:2px;
    background:currentColor;
    transform:translate(-50%,-50%);
}

.tmd-gpc .tmd-gpc__step--plus::after{
    transform:translate(-50%,-50%) rotate(90deg);
}

.tmd-gpc .tmd-gpc__step:hover{
    border-color:var(--tmd-gold-light)!important;
    background:#fffaf0!important;
    color:var(--tmd-gold-deep)!important;
}

.tmd-gpc .tmd-gpc__step:active{
    transform:scale(.94);
}

.tmd-gpc .tmd-gpc__step:focus-visible,
.tmd-gpc .tmd-gpc__chip:focus-visible{
    outline:2px solid var(--tmd-gold)!important;
    outline-offset:2px!important;
}

/* ---------- Presets ---------- */

.tmd-gpc__presets{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}

.tmd-gpc .tmd-gpc__chip{
    display:inline-flex!important;
    align-items:center;
    justify-content:center;
    min-width:58px!important;
    height:36px!important;
    min-height:0!important;
    margin:0!important;
    padding:0 14px!important;
    border:1px solid var(--tmd-line)!important;
    border-radius:999px!important;
    background:#fff!important;
    box-shadow:none!important;
    color:var(--tmd-text)!important;
    font-family:inherit!important;
    font-size:13px!important;
    font-weight:700!important;
    line-height:1!important;
    letter-spacing:0!important;
    text-transform:none!important;
    white-space:nowrap;
    cursor:pointer;
    transition:background-color .15s ease,border-color .15s ease,color .15s ease;
    -webkit-tap-highlight-color:transparent;
}

.tmd-gpc .tmd-gpc__chip:hover{
    border-color:var(--tmd-gold-light)!important;
    background:#fffaf0!important;
    color:var(--tmd-gold-deep)!important;
}

.tmd-gpc .tmd-gpc__chip.is-active{
    border-color:var(--tmd-navy)!important;
    background:var(--tmd-navy)!important;
    color:var(--tmd-gold-light)!important;
}

/* ---------- Rate strip ---------- */

.tmd-gpc__rate{
    display:flex;
    align-items:center;
    justify-content:space-between;
    flex-wrap:wrap;
    gap:10px 16px;
    margin-top:auto;
    padding:16px 18px;
    border:1px solid var(--tmd-line);
    border-radius:var(--tmd-radius-sm);
    background:linear-gradient(180deg,#fffdf8,#fbf6ea);
}

.tmd-gpc__rate-main{
    display:flex;
    flex-direction:column;
    gap:2px;
    min-width:0;
}

.tmd-gpc__rate-label{
    color:var(--tmd-muted);
    font-size:12px;
    font-weight:700;
    line-height:1.5;
}

.tmd-gpc__rate-value{
    display:flex;
    align-items:baseline;
    gap:8px;
    color:var(--tmd-ink);
    line-height:1.2;
}

.tmd-gpc__rate-value .tmd-gpc__num{
    font-size:24px;
    font-weight:800;
    font-variant-numeric:tabular-nums;
    white-space:nowrap;
}

.tmd-gpc__rate-value small{
    color:var(--tmd-muted);
    font-size:12px;
    font-weight:700;
    white-space:nowrap;
}

.tmd-gpc__rate-value--na{
    color:var(--tmd-faint);
    font-size:16px;
    font-weight:700;
}

.tmd-gpc__rate-meta{
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    gap:4px;
}

.tmd-gpc__live{
    display:inline-flex;
    align-items:center;
    gap:7px;
    padding:4px 10px;
    border-radius:999px;
    background:rgba(31,157,87,.09);
    color:#17784a;
    font-size:11.5px;
    font-weight:700;
    line-height:1.5;
    white-space:nowrap;
}

.tmd-gpc__live i{
    position:relative;
    flex:0 0 7px;
    width:7px;
    height:7px;
    border-radius:50%;
    background:var(--tmd-green);
}

.tmd-gpc__live i::after{
    content:"";
    position:absolute;
    inset:0;
    border-radius:50%;
    background:var(--tmd-green);
    animation:tmd-gpc-ping 2s cubic-bezier(0,0,.2,1) infinite;
}

.tmd-gpc__live--error{
    background:rgba(194,65,45,.08);
    color:var(--tmd-red);
}

.tmd-gpc__live--error i,
.tmd-gpc__live--error i::after{
    background:var(--tmd-red);
    animation:none;
}

.tmd-gpc__date{
    color:var(--tmd-faint);
    font-size:11.5px;
    font-weight:600;
    line-height:1.5;
    white-space:nowrap;
}

/* ---------- Summary panel ---------- */

.tmd-gpc__summary{
    position:relative;
    display:flex;
    flex-direction:column;
    min-width:0;
    padding:30px 28px 26px;
    overflow:hidden;
    isolation:isolate;
    color:#e9e4d8;
    background:
        radial-gradient(90% 60% at 0% 0%,rgba(214,162,60,.22),transparent 65%),
        radial-gradient(70% 50% at 100% 100%,rgba(241,210,122,.08),transparent 70%),
        linear-gradient(160deg,var(--tmd-navy-2) 0%,var(--tmd-navy) 70%);
}

/* نقش خطوط ذهبية خفيفة */
.tmd-gpc__summary::before{
    content:"";
    position:absolute;
    inset:0;
    z-index:-1;
    background:repeating-linear-gradient(135deg,rgba(241,210,122,.045) 0 1px,transparent 1px 14px);
    -webkit-mask-image:linear-gradient(200deg,#000 0%,transparent 55%);
            mask-image:linear-gradient(200deg,#000 0%,transparent 55%);
    pointer-events:none;
}

/* خط ذهبي علوي */
.tmd-gpc__summary::after{
    content:"";
    position:absolute;
    top:0;
    right:28px;
    left:28px;
    height:2px;
    background:var(--tmd-gold-grad);
    opacity:.85;
}

.tmd-gpc__summary-label{
    color:#dcc173;
    font-size:13px;
    font-weight:700;
    line-height:1.5;
}

.tmd-gpc__total{
    display:flex;
    align-items:baseline;
    flex-wrap:wrap;
    gap:4px 10px;
    margin:8px 0 22px;
}

.tmd-gpc__total-value{
    display:inline-block;
    unicode-bidi:isolate;
    direction:ltr;
    color:var(--tmd-gold-light);
    font-size:44px;
    font-weight:800;
    line-height:1.15;
    letter-spacing:-.5px;
    font-variant-numeric:tabular-nums;
    white-space:nowrap;
    background:linear-gradient(180deg,#fbe9b4 0%,#e9c15f 55%,#c99130 100%);
    -webkit-background-clip:text;
            background-clip:text;
    -webkit-text-fill-color:transparent;
    transition:filter .3s ease;
}

.tmd-gpc__currency{
    color:#d8d2c4;
    font-size:15px;
    font-weight:700;
    line-height:1;
}

.tmd-gpc__breakdown{
    display:flex;
    flex-direction:column;
    margin:auto 0 0;
    padding:4px 0 0;
    border-top:1px dashed rgba(241,210,122,.22);
}

.tmd-gpc__row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:11px 0;
    border-bottom:1px solid rgba(255,255,255,.06);
    font-size:13.5px;
    line-height:1.5;
}

.tmd-gpc__row:last-child{
    border-bottom:0;
}

.tmd-gpc__row > span:first-child{
    color:#a3a29d;
    font-weight:600;
}

.tmd-gpc__row > span:last-child{
    color:#f5f1e7;
    font-weight:700;
    white-space:nowrap;
}

.tmd-gpc__row .tmd-gpc__num{
    font-variant-numeric:tabular-nums;
}

.tmd-gpc .tmd-gpc__note,
.tmd-gpc .tmd-gpc__alert{
    margin:6px 0 0!important;
    padding:14px 0 0!important;
    border-top:1px solid rgba(255,255,255,.07);
    color:#8f9092!important;
    font-size:12px!important;
    font-weight:500!important;
    line-height:1.8!important;
}

.tmd-gpc .tmd-gpc__alert{
    color:#f3b4a8!important;
}

.tmd-gpc__sr{
    position:absolute!important;
    width:1px!important;
    height:1px!important;
    padding:0!important;
    margin:-1px!important;
    overflow:hidden!important;
    clip:rect(0,0,0,0)!important;
    white-space:nowrap!important;
    border:0!important;
}

/* ---------- States ---------- */

.tmd-gpc.is-pulse .tmd-gpc__total-value{
    animation:tmd-gpc-glow .6s ease;
}

.tmd-gpc:not(.has-value) .tmd-gpc__total-value{
    filter:saturate(.55) brightness(.85);
}

.tmd-gpc.is-unavailable .tmd-gpc__control{
    opacity:.55;
    pointer-events:none;
}

.tmd-gpc.is-unavailable .tmd-gpc__presets{
    opacity:.5;
    pointer-events:none;
}

.tmd-gpc.is-unavailable .tmd-gpc__total-value{
    background:none;
    -webkit-text-fill-color:currentColor;
    color:#6e7174;
}

@keyframes tmd-gpc-ping{
    75%,100%{transform:scale(2.4);opacity:0;}
}

@keyframes tmd-gpc-glow{
    0%{filter:brightness(1);}
    35%{filter:brightness(1.35) drop-shadow(0 0 12px rgba(241,210,122,.45));}
    100%{filter:brightness(1);}
}

@media (prefers-reduced-motion:reduce){
    .tmd-gpc *,
    .tmd-gpc *::before,
    .tmd-gpc *::after{
        animation:none!important;
        transition:none!important;
    }
}

/* ---------- Responsive (حسب عرض البطاقة نفسها) ---------- */

@container (max-width:760px){
    .tmd-gpc__main{
        padding:24px 22px 22px;
    }
    .tmd-gpc__summary{
        padding:26px 22px 22px;
    }
    .tmd-gpc__total-value{
        font-size:38px;
    }
}

@container (max-width:640px){
    .tmd-gpc__main,
    .tmd-gpc__summary{
        grid-column:1 / -1;
    }
}

/* احتياطي للمتصفحات بدون container queries */
@media (max-width:700px){
    .tmd-gpc{
        grid-template-columns:minmax(0,1fr);
        margin:22px 0;
        border-radius:20px;
    }
}

@media (max-width:480px){
    .tmd-gpc__main{
        gap:18px;
        padding:22px 16px 18px;
    }
    .tmd-gpc__summary{
        padding:22px 16px 18px;
    }
    .tmd-gpc__summary::after{
        right:16px;
        left:16px;
    }
    .tmd-gpc .tmd-gpc__title{
        font-size:19px!important;
    }
    .tmd-gpc .tmd-gpc__subtitle{
        font-size:13.5px!important;
    }
    .tmd-gpc__control{
        height:62px;
    }
    .tmd-gpc .tmd-gpc__step{
        width:48px!important;
        height:48px!important;
    }
    .tmd-gpc .tmd-gpc__input{
        height:48px!important;
        font-size:23px!important;
    }
    .tmd-gpc .tmd-gpc__chip{
        flex:1 1 0;
        min-width:0!important;
        padding:0 8px!important;
    }
    .tmd-gpc__rate{
        padding:14px;
    }
    .tmd-gpc__rate-meta{
        flex-direction:row;
        flex-wrap:wrap;
        align-items:center;
        gap:6px 10px;
    }
    .tmd-gpc__total-value{
        font-size:36px;
    }
}
