/* ═══════════════════════════════════════════════════════════
   Studio Block Document — stiluri (editor + vizualizare)
   Companion: studio-block-document.js
   ═══════════════════════════════════════════════════════════ */

/* ── EDITOR: zona de upload ─────────────────────────────── */

.sbd-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 44px 20px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    text-align: center;
    transition: border-color .15s ease, background .15s ease;
}
.sbd-upload-zone:hover,
.sbd-upload-zone.is-dragover {
    border-color: #3b82f6;
    background: #eff6ff;
}
.sbd-upload-icon svg {
    width: 44px;
    height: 44px;
    color: #94a3b8;
}
.sbd-upload-title {
    margin: 4px 0 0;
    font-size: 15px;
    font-weight: 600;
    color: #334155;
}
.sbd-upload-sub {
    margin: 0;
    font-size: 12.5px;
    color: #94a3b8;
}
.sbd-upload-status {
    display: block;
    min-height: 16px;
    margin-top: 6px;
    font-size: 12.5px;
    color: #64748b;
}
.sbd-upload-status.is-busy { color: #2563eb; }
.sbd-upload-status.is-error { color: #dc2626; font-weight: 600; }

/* ── EDITOR: card rezumat document ──────────────────────── */

.sbd-ed-card {
    display: flex;
    gap: 18px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .05);
}
.sbd-ed-preview {
    flex: 0 0 120px;
}
.sbd-ed-preview img {
    display: block;
    width: 120px;
    height: auto;
    max-height: 170px;
    object-fit: cover;
    object-position: top;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}
.sbd-ed-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sbd-ed-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    overflow: hidden;
}
.sbd-ed-name svg { width: 18px; height: 18px; flex: 0 0 auto; color: #ef4444; }
.sbd-ed-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sbd-ed-sub {
    font-size: 12.5px;
    color: #64748b;
}
.sbd-ed-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.sbd-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 11.5px;
    font-weight: 600;
}
.sbd-badge svg { width: 12px; height: 12px; }
.sbd-badge.is-time { background: #fef3c7; color: #92400e; }
.sbd-badge.is-mand { background: #dbeafe; color: #1d4ed8; }
.sbd-badge.is-dl   { background: #dcfce7; color: #166534; }

.sbd-ed-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}
.sbd-ed-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    background: #3b82f6;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease;
}
.sbd-ed-btn:hover { background: #2563eb; }
.sbd-ed-btn svg { width: 14px; height: 14px; }
.sbd-ed-btn.is-ghost {
    background: #f1f5f9;
    color: #475569;
}
.sbd-ed-btn.is-ghost:hover { background: #e2e8f0; }

/* ── TOOLBAR: buton + panou optiuni ─────────────────────── */

.sbd-badge-d { background: #ef4444 !important; }

.sbd-tb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: #334155;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.sbd-tb-btn:hover { background: #f1f5f9; }
.sbd-tb-btn svg { width: 14px; height: 14px; }

.sbd-opt-wrap { position: relative; }
.sbd-opt-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    width: 300px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .16);
}
.sbd-opt-panel.is-open { display: block; }

.sbd-opt-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 0;
}
.sbd-opt-lbl {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}
.sbd-opt-lbl svg { width: 15px; height: 15px; color: #64748b; }

.sbd-switch {
    position: relative;
    flex: 0 0 auto;
    width: 38px;
    height: 20px;
    border: none;
    border-radius: 999px;
    background: #cbd5e1;
    cursor: pointer;
    transition: background .15s ease;
}
.sbd-switch.is-on { background: #3b82f6; }
.sbd-switch-dot {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
    transition: left .15s ease;
}
.sbd-switch.is-on .sbd-switch-dot { left: 20px; }

.sbd-opt-sec {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 8px;
}
.sbd-opt-sec.is-hidden { display: none; }
.sbd-opt-sec-lbl { font-size: 12.5px; color: #475569; }
.sbd-opt-sec-input {
    width: 74px;
    padding: 5px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    font-size: 13px;
}
.sbd-opt-hint {
    display: block;
    padding-bottom: 6px;
    font-size: 11.5px;
    line-height: 1.4;
    color: #94a3b8;
}

/* ── MODAL: selectia paginilor ──────────────────────────── */

.sbd-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, .55);
}
.sbd-modal {
    display: flex;
    flex-direction: column;
    width: min(920px, 100%);
    max-height: min(86vh, 900px);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
    overflow: hidden;
}
.sbd-modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
}
.sbd-modal-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15.5px;
    font-weight: 700;
    color: #1e293b;
}
.sbd-modal-title svg { width: 17px; height: 17px; color: #3b82f6; }
.sbd-modal-file {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12.5px;
    color: #94a3b8;
}
.sbd-modal-x {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 21px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
}
.sbd-modal-x:hover { background: #f1f5f9; color: #0f172a; }

.sbd-modal-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 18px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}
.sbd-mini-btn {
    padding: 6px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
}
.sbd-mini-btn:hover { background: #f1f5f9; }
.sbd-mini-btn.is-primary {
    border-color: #3b82f6;
    background: #3b82f6;
    color: #fff;
}
.sbd-mini-btn.is-primary:hover { background: #2563eb; }
.sbd-mini-btn.is-primary:disabled { opacity: .6; cursor: default; }
.sbd-mini-btn.is-ghost { border-color: transparent; background: transparent; color: #64748b; }
.sbd-modal-range { display: inline-flex; align-items: center; gap: 6px; }
.sbd-range-input {
    width: 140px;
    padding: 6px 9px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    font-size: 12.5px;
}
.sbd-modal-count {
    margin-left: auto;
    font-size: 12.5px;
    font-weight: 600;
    color: #2563eb;
}

.sbd-modal-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 12px;
    padding: 16px 18px;
}
.sbd-thumb {
    position: relative;
    padding: 0;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.sbd-thumb:hover { border-color: #93c5fd; }
.sbd-thumb img {
    display: block;
    width: 100%;
    height: auto;
    opacity: .55;
    transition: opacity .12s ease;
}
.sbd-thumb.is-on { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59, 130, 246, .25); }
.sbd-thumb.is-on img { opacity: 1; }
.sbd-thumb-num {
    position: absolute;
    left: 6px;
    bottom: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .72);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}
.sbd-thumb-check {
    position: absolute;
    top: 6px;
    right: 6px;
    display: none;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #3b82f6;
    color: #fff;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
}
.sbd-thumb.is-on .sbd-thumb-check { display: block; }

.sbd-modal-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}
.sbd-modal-err {
    margin-right: auto;
    font-size: 12.5px;
    font-weight: 600;
    color: #dc2626;
}

/* ── VIZUALIZARE ANGAJAT ────────────────────────────────── */

.sbd-view {
    width: 100%;
}
.sbd-missing {
    padding: 24px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}

/* Mod Paginare (slider) */
.sbd-slider-frame {
    overflow: hidden;
    border-radius: 10px;
}
.sbd-slider {
    display: flex;
    transition: transform .3s ease;
}
.sbd-slide {
    min-width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 8px 0;
}
.sbd-slide img {
    max-width: 100%;
    height: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .1);
    cursor: zoom-in;
}

.sbd-progress {
    height: 5px;
    margin: 10px 4px 0;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}
.sbd-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: #3b82f6;
    transition: width .3s ease;
}

.sbd-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}
.sbd-indicator {
    font-size: 13.5px;
    color: #64748b;
}
.sbd-nav-btn {
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    background: #3b82f6;
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, opacity .15s ease;
}
.sbd-nav-btn:hover { background: #2563eb; }
.sbd-nav-btn.is-locked,
.sbd-nav-btn:disabled {
    background: #cbd5e1;
    color: #475569;
    cursor: default;
}

/* Mod Continuu */
.sbd-cont {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 8px 0;
}
.sbd-cont-page {
    position: relative;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.sbd-cont-page img {
    max-width: 100%;
    height: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .1);
    cursor: zoom-in;
}
.sbd-page-badge {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 14px;
    border-radius: 999px;
    background: #3b82f6;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}

/* Buton download */
.sbd-dl {
    margin-top: 14px;
    text-align: center;
}
.sbd-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #334155 !important;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background .15s ease;
}
.sbd-dl-btn:hover { background: #e2e8f0; }
.sbd-dl-btn svg { width: 15px; height: 15px; }

/* Lightbox (lupa) */
.sbd-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    background: rgba(2, 6, 23, .88);
    cursor: zoom-out;
}
.sbd-lightbox img {
    max-width: 96vw;
    max-height: 90vh;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.sbd-lightbox-hint {
    font-size: 12.5px;
    color: rgba(255, 255, 255, .65);
}

/* Mobil */
@media (max-width: 640px) {
    .sbd-ed-card { flex-direction: column; }
    .sbd-ed-preview { flex: none; }
    .sbd-modal-overlay { padding: 8px; }
    .sbd-modal { max-height: 94vh; }
    .sbd-modal-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; padding: 12px; }
    .sbd-controls { flex-wrap: wrap; justify-content: center; }
    .sbd-indicator { order: -1; width: 100%; text-align: center; }
}
