
/* ==== POPUP OVERLAY ==== */
.apa-popup-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 9998; }

/* ==== POPUP CONTENT ==== */
.apa-popup-content {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: #fff; padding: 18px 18px 12px 18px; border-radius: 16px;
    z-index: 9999; width: 90%; max-width: 820px; box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    text-align: left; max-height: 85vh; overflow: hidden;
}

/* Header */
.apa-popup-header {
    position: sticky; top: 0; display: grid; grid-template-columns: 1fr auto;
    align-items: center; gap: 12px; padding: 12px 8px; background: #fff; border-bottom: 1px solid #eee; z-index: 2;
}
.apa-popup-title { text-align: center; font-size: 18px; font-weight: 600; margin: 0 auto; }
.apa-close-popup { background: transparent; color: #333; border: none; font-size: 22px; line-height: 1; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; }
.apa-close-popup:hover { background: #f2f2f2; }

/* Items area */
.apa-popup-items { padding-right: 4px; padding-bottom: 24px; max-height: calc(85vh - 64px); overflow-y: auto; }
.apa-loading { font-size: 16px; padding: 6px 0; }

/* ==== GRID ==== */
.apa-addon-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 8px; padding-bottom: 20px; }
@media (max-width: 1024px) { .apa-addon-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .apa-addon-grid { grid-template-columns: repeat(2, 1fr); } }

/* ==== ITEM CARD ==== */
.apa-addon-item { border: 1px solid #eee; padding: 10px; border-radius: 12px; background: #fafafa; text-align: center; transition: box-shadow .2s ease; }
.apa-addon-item:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.1); }
.apa-addon-item img { width: 100%; height: auto; border-radius: 8px; }
.apa-addon-item h4 { font-size: 14px; margin: 10px 0 6px; }
.apa-addon-price { color: #555; font-size: 13px; margin-bottom: 8px; }

/* ==== GUMB "DODAJ +" ==== */
.apa-addon-select-btn {
    background: #26282a;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: filter .2s ease, color .2s ease;
    font-size: 14px;
}
.apa-addon-select-btn:hover { filter: brightness(1.15); color: #eaeaea; }
.apa-addon-select-btn.apa-selected { background: #333 !important; cursor: default; }

/* ==== SELEKTIRANI PRIVJESCI ==== */
.apa-selected-addons { margin-top: 10px; padding: 6px 0; }
.apa-selected-box { display: flex; flex-direction: column; gap: 8px; }

.apa-selected-item.full {
    width: 100%;
    display: grid;
    grid-template-columns: 56px 1fr 28px;
    align-items: center;
    gap: 10px;
    background: #f7f7f7;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #eaeaea;
}
.apa-selected-img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.apa-selected-info { display: flex; flex-direction: column; gap: 2px; }
.apa-selected-title { font-size: 14px; font-weight: 600; }
.apa-selected-price { font-size: 12px; color: #666; }

.apa-remove-addon {
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    font-size: 16px;
    cursor: pointer;
    margin-right: 4px; /* Pomaknuto malo ulijevo */
}
.apa-remove-addon:hover { background: #c0392b; }

/* ==== GUMB "Dodaj privjesak" ===== */
.apa-addon-wrapper { margin-top: 12px; }
.apa-open-popup {
    background: #26282a !important;
    color: #fff !important;
    border-radius: 9999px !important;
    padding: 12px 18px;
    border: none;
    cursor: pointer;
    transition: filter .2s ease, color .2s ease;
    font-size: 14px;
    width: 100%;
}
.apa-open-popup:hover { filter: brightness(1.15); color: #eaeaea !important; }

/* Hint under button */
.apa-max-hint { display: block; margin-top: 4px; font-size: 12px; color: #888; text-align: left; }

/* Košarica label */
.apa-addon-label { color:#666; font-size:13px; font-style:italic; margin-left: 8px; }

/* Lock body scroll when popup open */
body.apa-lock { overflow: hidden; }

/* ==== LIVE TOTAL FADE + SIZE ==== */
.apa-live-total { display:inline-block; transition: opacity .25s ease; font-size: 1.3em; font-weight: 600; color: var(--wd-primary-color, #26282a); font-size: 32px; }
@media (max-width:768px){ .apa-live-total { font-size: 1.5em; } }
.apa-live-total.updating { opacity: .25; }
