/* CMS inline editor — admin overlay */
#me-cms-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    background: linear-gradient(90deg, #001216, #01222B);
    border-bottom: 2px solid #FF9933;
    color: #c0c0c0;
    font: 600 13px/1.4 Arial, sans-serif;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.45);
}

#me-cms-bar strong { color: #FFAA00; }

.me-cms-host {
    position: relative !important;
    display: inline-block;
    max-width: 100%;
}

.me-cms-host.me-cms-host-block {
    display: block;
}

.me-cms-wrap {
    position: relative !important;
}

.me-cms-pencil {
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 99998;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #FF9933;
    color: #001216;
    font-size: 14px;
    line-height: 28px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
    opacity: 0.92;
    padding: 0;
}

html[dir="rtl"] .me-cms-pencil {
    right: auto;
    left: 2px;
}

.me-cms-pencil:hover {
    background: #FFAA00;
    transform: scale(1.08);
}

.me-cms-file-btn {
    width: 100%;
    margin-top: 4px;
}

.me-cms-image-preview {
    display: block;
    max-width: 100%;
    max-height: 220px;
    margin-top: 10px;
    border-radius: 6px;
    border: 1px solid #2a3a40;
}

.me-cms-highlight {
    outline: 2px dashed rgba(255, 153, 51, 0.85) !important;
    outline-offset: 2px;
}

#me-cms-modal {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    background: rgba(0, 10, 14, 0.82);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

#me-cms-modal.me-open { display: flex; }

.me-cms-dialog {
    background: #01222B;
    border: 1px solid #3D3D3D;
    border-radius: 10px;
    width: 100%;
    max-width: 720px;
    max-height: 92vh;
    overflow: auto;
    color: #c0c0c0;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
}

.me-cms-dialog-head {
    padding: 14px 18px;
    border-bottom: 1px solid #1a2a30;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.me-cms-dialog-head h3 {
    margin: 0;
    color: #FFAA00;
    font-size: 16px;
}

.me-cms-dialog-body { padding: 16px 18px; }

.me-cms-dialog-foot {
    padding: 12px 18px;
    border-top: 1px solid #1a2a30;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.me-cms-field { margin-bottom: 12px; }

.me-cms-field label {
    display: block;
    color: #FFBB00;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.me-cms-field input,
.me-cms-field textarea,
.me-cms-field select {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid #3D3D3D;
    border-radius: 6px;
    background: #001216;
    color: #c0c0c0;
    font: inherit;
}

.me-cms-field textarea { min-height: 120px; resize: vertical; }

.me-cms-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
}

.me-cms-btn-primary { background: #FF9933; color: #001216; }
.me-cms-btn-secondary { background: #1a2a30; color: #c0c0c0; }
.me-cms-btn-danger { background: #5a2020; color: #ffb0b0; }

.me-cms-crop-wrap {
    position: relative;
    width: 100%;
    min-height: 200px;
    max-height: 360px;
    overflow: hidden;
    background: #000;
    border: 2px solid #FF9933;
    border-radius: 8px;
    touch-action: none;
    margin-top: 10px;
}

.me-cms-crop-wrap img {
    display: block;
    max-width: none;
    user-select: none;
    pointer-events: none;
}

.me-cms-crop-box {
    position: absolute;
    border: 2px dashed #FF9933;
    box-shadow: 0 0 0 9999px rgba(0,0,0,.45);
    cursor: move;
    box-sizing: border-box;
    z-index: 2;
}

.me-cms-crop-tools {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.me-cms-crop-tools-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #c0c0c0;
    font-size: 12px;
}

.me-cms-crop-tools-row input[type=range] {
    flex: 1;
    min-width: 120px;
}

.me-cms-crop-hint {
    margin: 8px 0 0;
    color: #888;
    font-size: 12px;
    line-height: 1.5;
}

.me-cms-crop-uploader {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #2a3a40;
}

.me-cms-crop-section-title {
    color: #FFAA00;
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 8px;
}

.me-cms-slider-item .me-cms-btn-change {
    flex-shrink: 0;
    padding: 6px 10px;
    font-size: 11px;
}

.me-cms-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.me-cms-slider-row input[type=range] { flex: 1; }

.me-cms-slider-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px;
    border: 1px solid #1a2a30;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #001216;
}

.me-cms-slider-item img {
    width: 80px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

.me-cms-slider-item input { flex: 1; }

.me-cms-area-row {
    border: 1px solid #1a2a30;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    background: #001216;
}

body.me-cms-active { padding-top: 44px !important; }

@media (max-width: 991px) {
    #me-cms-bar { font-size: 11px; padding: 6px 10px; }
    body.me-cms-active { padding-top: 38px !important; }
}
