/* =============================================
   DOBRA Hotspot CSS v9
   Više hotspot fotografija - svaka kao zasebna grupa
   ============================================= */

/* ---- ADD GROUP BUTTON ---- */
.dobra-btn-add-group {
    background: #2271b1;
    color: #fff;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    margin-top: 15px;
    transition: background 0.2s;
}
.dobra-btn-add-group:hover { background: #135e96; }

/* ---- EMPTY STATE ---- */
.dobra-empty-state {
    text-align: center;
    padding: 40px 20px;
    background: #fff;
    border: 2px dashed #c3c4c7;
    border-radius: 8px;
    color: #57606a;
}
.dobra-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ---- GROUP CARD ---- */
.dobra-group-card {
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.dobra-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f6f8fa;
    border-bottom: 1px solid #d0d7de;
    gap: 12px;
}

.dobra-group-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    flex-wrap: wrap;
}

.dobra-group-num {
    font-weight: 700;
    color: #1d2327;
    font-size: 14px;
    white-space: nowrap;
}

.dobra-group-label-input {
    flex: 1;
    min-width: 150px;
    padding: 6px 10px;
    border: 1px solid #c3c4c7;
    border-radius: 5px;
    font-size: 13px;
    background: #fff;
}

.dobra-group-header-right {
    display: flex;
    gap: 6px;
}

.dobra-btn-icon {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}
.dobra-btn-icon:hover {
    background: #fee;
    border-color: #f1aeb5;
}

.dobra-group-body {
    padding: 16px;
}

/* ---- INLINE EDITOR (oko grupa) ---- */
.dobra-editor-section.dobra-editor-inline {
    background: #f8f9fa;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    margin: 15px 0 25px;
    padding: 20px;
    opacity: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.dobra-editor-inline .dobra-editor-inner {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.dobra-editor-intro {
    color: #57606a;
    font-size: 14px;
    margin: 0 0 16px;
    line-height: 1.5;
}

/* ---- EDITOR SEKCIJA (legacy) ---- */
.dobra-editor-section {
    background: #f8f9fa;
    border-top: 3px solid #2271b1;
    margin-top: 30px;
    padding: 30px 0;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.dobra-editor-section.dobra-editor-visible {
    opacity: 1;
}

.dobra-editor-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.dobra-editor-header h3 {
    font-size: 22px;
    margin-bottom: 8px;
    color: #1d2327;
}

.dobra-editor-header p {
    color: #646970;
    margin-bottom: 20px;
}

/* ---- UPLOAD PLACEHOLDER ---- */
.dobra-upload-placeholder {
    border: 2px dashed #c3c4c7;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.2s, background 0.2s;
}

.dobra-upload-placeholder:hover {
    border-color: #2271b1;
    background: #f0f6fc;
}

.dobra-upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.dobra-upload-placeholder p {
    color: #646970;
    margin: 0;
}

/* ---- BASE IMAGE WRAP (EDITOR) ---- */
.dobra-base-wrap {
    position: relative;   /* KLJUČNO: pinovi se pozicioniraju unutar ovog */
    display: block;
    width: 100%;
    overflow: hidden;     /* KLJUČNO: sprječava curenje pinova van */
    border-radius: 8px;
    background: #eee;
    margin-bottom: 16px;
    line-height: 0;       /* Uklanja prazninu ispod slike */
}

.dobra-base-wrap img,
#dobraBaseImg,
.dobra-base-img {
    display: block;
    width: 100%;
    height: auto;
}

/* ---- KONTROLE ---- */
.dobra-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.dobra-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.dobra-btn:hover { opacity: 0.85; }
.dobra-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.dobra-btn-primary  { background: #2271b1; color: #fff; }
.dobra-btn-secondary { background: #f0f0f1; color: #1d2327; border: 1px solid #c3c4c7; }
.dobra-btn-save     { background: #00a32a; color: #fff; }

.dobra-btn-primary.active {
    background: #b32d2e;
}

/* ---- EDITOR PINOVI (na slici) - radi za sve grupe ---- */
#dobraPinsOnImg,
.dobra-pins-on-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

.dobra-editor-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: all;
    cursor: default;
    z-index: 5;
}

.dobra-editor-pin .dobra-pin-dot {
    display: block;
    width: 20px;
    height: 20px;
    background: #2271b1;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.dobra-editor-pin .dobra-pin-label {
    position: absolute;
    top: -8px;
    left: 20px;
    background: #2271b1;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Cursor za pin mode */
.dobra-base-wrap.pin-mode,
.dobra-base-wrap.pin-mode img {
    cursor: crosshair;
}

/* ---- STATUS ---- */
.dobra-status {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-weight: 500;
    display: none;
}

.dobra-status.success { background: #d1e7dd; color: #0a3622; border: 1px solid #a3cfbb; }
.dobra-status.error   { background: #f8d7da; color: #58151c; border: 1px solid #f1aeb5; }
.dobra-status.info    { background: #cff4fc; color: #055160; border: 1px solid #9eeaf9; }

/* ---- LISTA PINOVA ---- */
.dobra-pins-list {
    margin-top: 20px;
}

.dobra-pin-item {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.dobra-pin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.dobra-pin-label-txt {
    font-weight: 600;
    color: #1d2327;
}

.dobra-remove-pin {
    background: #f8d7da;
    color: #58151c;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
}

.dobra-remove-pin:hover { background: #f1aeb5; }

.dobra-detail-area {
    margin-bottom: 10px;
    min-height: 40px;
}

.dobra-upload-label,
.dobra-upload-detail-btn {
    display: inline-block;
    padding: 10px 16px;
    background: #f0f6fc;
    border: 2px dashed #2271b1;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #2271b1;
    font-weight: 600;
    transition: background 0.2s;
}

.dobra-upload-label:hover,
.dobra-upload-detail-btn:hover { background: #dce8f5; }

.dobra-thumb-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.dobra-detail-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #c3c4c7;
}

.dobra-desc-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    font-size: 14px;
}

.dobra-uploading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #646970;
    font-size: 14px;
}

.dobra-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #c3c4c7;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: dobra-spin 0.8s linear infinite;
}

@keyframes dobra-spin {
    to { transform: rotate(360deg); }
}

.dobra-empty-msg {
    color: #646970;
    font-style: italic;
    text-align: center;
    padding: 20px;
}


/* =============================================
   VIEWER - FRONTEND PRIKAZ NA SINGLE LISTING
   ============================================= */
#dobraViewerSection,
.dobra-hotspot-section {
    display: block !important;
    position: relative;
    width: 100%;
    clear: both;
    margin: 0;
    padding: 40px 0;
    background: #f8f9fa;
    box-sizing: border-box;
}

.dobra-hotspot-title {
    font-size: 22px;
    font-weight: 700;
    color: #1d2327;
    margin-bottom: 6px !important;
}

.dobra-hotspot-hint {
    color: #646970;
    margin-bottom: 20px !important;
    font-size: 14px;
}

/* KLJUČNI DIO - viewer mora biti relative i overflow:hidden */
.dobra-hotspot-viewer {
    position: relative !important;  /* Pinovi se pozicioniraju unutar ovoga */
    display: block !important;
    width: 100%;
    max-width: 900px;
    overflow: hidden !important;    /* SPRJEČAVA CURENJE PINOVA VAN SLIKE */
    border-radius: 10px;
    background: #222;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    line-height: 0;                 /* Uklanja prazninu ispod slike */
}

/* Hotspot bazna slika - mora biti 100% širine */
.dobra-base-image {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
}

/* ---- VIEWER PINOVI ---- */
.dobra-pin {
    position: absolute !important;  /* Pozicioniran unutar .dobra-hotspot-viewer */
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 10;
    width: 30px;
    height: 30px;
}

.dobra-pin-pulse {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.3);
    animation: dobra-pulse 1.8s ease-out infinite;
}

.dobra-pin-dot {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: #dc2626;
    border: 2.5px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    z-index: 2;
    transition: transform 0.2s;
}

.dobra-pin:hover .dobra-pin-dot {
    transform: translate(-50%, -50%) scale(1.3);
}

@keyframes dobra-pulse {
    0%   { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

/* Tooltip */
.dobra-pin-tooltip {
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 20;
}

.dobra-pin:hover .dobra-pin-tooltip {
    opacity: 1;
}


/* ---- LIGHTBOX ---- */
.dobra-lightbox {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 99999;
    display: none;
}

.dobra-lightbox-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    cursor: pointer;
}

.dobra-lightbox-content {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
    z-index: 2;
}

.dobra-lightbox-content img {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.dobra-lightbox-desc {
    color: #fff;
    margin-top: 12px;
    font-size: 15px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.dobra-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.dobra-lightbox-close:hover { background: rgba(255,255,255,0.3); }

body.dobra-lb-open { overflow: hidden; }

/* ---- RESPONZIVNOST ---- */
@media (max-width: 768px) {
    .dobra-hotspot-title { font-size: 18px; }
    .dobra-pin { width: 24px; height: 24px; }
    .dobra-pin-dot { width: 14px; height: 14px; }
    .dobra-pin-pulse { width: 24px; height: 24px; }
    .dobra-lightbox-content { max-width: 95vw; }
    .dobra-controls { flex-direction: column; }
    .dobra-btn { width: 100%; text-align: center; }
}
