/*
 * Shared by the classic (desktop) and mobile UI: bid dialog, toasts, "Twoja oferta" badge,
 * ended auctions, "Moje oferty" cards, live countdowns, translation results.
 */
:root {
    --ka-red: #b91313;
    --ka-red-dark: #8e0f0f;
    --ka-green: #1e8449;
    --ka-green-bg: #e3f6ea;
    --ka-yellow-bg: #fff5c2;
    --ka-yellow: #7a5d00;
    --ka-blue-bg: #e8f0fb;
    --ka-blue: #1f4e8c;
    --ka-grey-bg: #eef0f2;
    --ka-grey: #555;
    --ka-text: #222;
}

/* ---- Bid dialog ----------------------------------------------------------- */
html.ka-modal-open,
html.ka-modal-open body { overflow: hidden; }

.ka-modal { position: fixed; inset: 0; z-index: 5000; display: none; }
.ka-modal.is-open { display: flex; align-items: center; justify-content: center; }
.ka-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.ka-modal-box {
    position: relative;
    width: min(440px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow: auto;
    box-sizing: border-box;
    padding: 22px 20px 18px;
    background: #fff;
    color: var(--ka-text);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
    text-align: left;
    font-size: 16px;
    line-height: 1.4;
}
.ka-modal-x {
    position: absolute; top: 8px; right: 8px;
    width: 36px; height: 36px; padding: 0;
    border: none; border-radius: 50%;
    background: transparent; color: #666;
    font-size: 24px; line-height: 36px; cursor: pointer;
}
.ka-modal-x:hover { background: #f0f0f0; color: #000; }
.ka-modal-title { margin: 0 36px 14px 0; font-size: 19px; line-height: 1.3; color: var(--ka-text); text-align: left; }
.ka-modal-loading { padding: 20px 0; color: #666; }
.ka-bid-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 16px; }
.ka-bid-facts div { padding: 10px 12px; background: #f5f6f8; border-radius: 10px; }
.ka-bid-facts dt { margin: 0 0 2px; font-size: 12px; color: #666; text-transform: uppercase; letter-spacing: .03em; }
.ka-bid-facts dd { margin: 0; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ka-bid-facts dd.is-urgent { color: var(--ka-red); }
.ka-label { display: block; margin: 0 0 6px; font-weight: 600; font-size: 14px; color: var(--ka-text); }
.ka-input {
    display: block; width: 100%; box-sizing: border-box;
    padding: 12px 14px;
    border: 2px solid #ccd1d6; border-radius: 10px;
    font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums;
    color: var(--ka-text); background: #fff;
}
.ka-input:focus { outline: none; border-color: var(--ka-red); box-shadow: 0 0 0 3px rgba(185, 19, 19, .15); }
.ka-input[aria-invalid="true"] { border-color: #c0392b; }
.ka-msg { min-height: 20px; margin: 8px 0 0; font-size: 14px; }
.ka-msg--error { color: #c0392b; }
.ka-msg--ok { color: var(--ka-green); }
.ka-confirm-text { margin: 4px 0 6px; font-size: 17px; }
.ka-modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.ka-btn {
    flex: 1;
    min-height: 46px; padding: 10px 14px;
    border: none; border-radius: 10px;
    font-size: 16px; font-weight: 700; cursor: pointer;
}
.ka-btn--primary { background: var(--ka-red); color: #fff; }
.ka-btn--primary:hover:not(:disabled) { background: var(--ka-red-dark); }
.ka-btn--primary:disabled { background: #d9a5a5; cursor: not-allowed; }
.ka-btn--ghost { background: #eceff1; color: #333; }
.ka-btn--ghost:hover { background: #dfe3e6; }

/* ---- Toasts --------------------------------------------------------------- */
.ka-toasts {
    position: fixed; z-index: 6000;
    left: 50%; bottom: 20px; transform: translateX(-50%);
    display: flex; flex-direction: column; gap: 8px; align-items: center;
    width: min(460px, calc(100vw - 24px));
    pointer-events: none;
}
.ka-toast {
    width: 100%; box-sizing: border-box;
    padding: 12px 16px; border-radius: 10px;
    color: #fff; font-size: 15px; font-weight: 600; text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    opacity: 0; transform: translateY(10px);
    transition: opacity .25s ease, transform .25s ease;
}
.ka-toast.is-visible { opacity: 1; transform: none; }
.ka-toast--success { background: var(--ka-green); }
.ka-toast--error { background: #c0392b; }

/* ---- "Twoja oferta" badge on listing cards -------------------------------- */
.my-bid-badge {
    display: inline-block;
    align-self: center;
    margin: 6px auto;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--ka-blue-bg);
    color: var(--ka-blue);
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.my-bid-badge.is-new { animation: ka-pop .6s ease; }
@keyframes ka-pop { 0% { transform: scale(.85); } 60% { transform: scale(1.08); } 100% { transform: none; } }

/* ---- Ended auctions -------------------------------------------------------- */
.auction-ended { opacity: .55; filter: grayscale(.9); }
.auction-ended:hover { transform: none !important; }
.place-bid:disabled, .place-bid[aria-disabled="true"] { cursor: not-allowed; opacity: .7; }

/* ---- Live countdown pill (also used by the mobile UI) --------------------- */
.js-countdown { font-variant-numeric: tabular-nums; }
.time-left {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    background: #eef1f4;
    color: #333;
    white-space: nowrap;
}
.time-left.soon { background: #fdecea; color: var(--ka-red); }
.time-left.urgent { background: var(--ka-red); color: #fff; }
.time-left.ended { background: #ddd; color: #666; }

/* ---- "Moje oferty" / archive cards ---------------------------------------- */
.bid-legend { margin: 0 auto 16px; max-width: 1100px; font-size: 13px; line-height: 2; color: #555; text-align: center; }
.bid-legend .bid-status { margin: 0 2px; }
.bid-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.6;
    white-space: nowrap;
}
.bid-status--won { background: var(--ka-green-bg); color: var(--ka-green); }
.bid-status--highest { background: var(--ka-yellow-bg); color: var(--ka-yellow); }

.bid-card { cursor: pointer; text-align: left; border-left: 5px solid #ccc !important; }
.bid-card--won { border-left-color: var(--ka-green) !important; }
.bid-card--highest { border-left-color: #e2b800 !important; }
.bid-card-title { font-size: 17px; font-weight: 700; color: var(--ka-text); margin: 0 0 8px; text-align: center; }
.bid-card-photo { display: block; width: 100%; }
.bid-card-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; max-height: none !important; }
.bid-card-body { width: 100%; padding: 10px 2px 0; font-size: 14px; color: #444; }
.bid-card-body > * { margin: 0 0 6px; }
.bid-card-amount { font-size: 15px; }
.bid-card-amount strong { font-size: 18px; color: var(--ka-text); font-variant-numeric: tabular-nums; }
.bid-card-meta { color: #777; font-size: 13px; }
.bid-history summary { cursor: pointer; color: var(--ka-blue); font-weight: 600; }
.bid-history ul { margin: 6px 0 0; padding: 0; list-style: none; }
.bid-history li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed #e3e3e3; font-variant-numeric: tabular-nums; }
.bid-history li:first-child strong { color: var(--ka-text); }
.bid-card-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; margin-top: 8px; }
.bid-card-actions > * { flex: 1; text-align: center; text-decoration: none; }
.bid-card-link { display: inline-block; padding: 8px 12px; border-radius: 8px; background: #eceff1; color: #333 !important; font-weight: 600; }
.bid-empty { text-align: center; color: #666; }

/* ---- "Twoje oferty" on the detail pages ----------------------------------- */
.user-bids-list ul { margin: 5px 0; padding-left: 20px; }
.user-bids-list li { font-variant-numeric: tabular-nums; }
.user-bids-list li.is-latest { font-weight: 700; }

/* ---- Translation results keep line breaks --------------------------------- */
.translation-content { white-space: pre-line; }
.bid-card-actions > * {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 42px; margin: 0; box-sizing: border-box;
    font-size: 14px; line-height: 1.2;
}
.bid-card-amount strong { white-space: nowrap; }

/* The global "button" rules of styles_new.css (flex: 1 1 100%, max-width 200px,
   margin auto) must not apply inside the dialog / cards */
.ka-modal-box button,
.bid-card-actions button { max-width: none; margin: 0; }
.ka-modal-box button:hover { transform: none; box-shadow: none; }
.ka-btn--primary:hover:not(:disabled) { background: var(--ka-red-dark); }
.ka-btn--ghost:hover { background: #dfe3e6; color: #333; }
.ka-modal-x:hover { background: #f0f0f0; color: #000; }
.mobile-offer.bid-card { padding: 12px; }
