/* PMAM Visual CMS Editor Styles */

body.cms-has-admin-bar {
    padding-top: 42px;
}

body.cms-edit-mode {
    padding-top: 88px;
}

.cms-admin-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99990;
    background: linear-gradient(135deg, #1d3557 0%, #14243d 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.cms-admin-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.cms-admin-brand {
    font-weight: 700;
    margin-right: 8px;
}

.cms-admin-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 13px;
}

.cms-admin-link:hover {
    color: #fff;
}

.cms-admin-btn,
.cms-admin-btn-off {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    background: #e63946;
    color: #fff;
}

.cms-admin-btn-off {
    background: rgba(255, 255, 255, 0.15);
}

.cms-toolbar {
    position: fixed;
    top: 42px;
    left: 0;
    right: 0;
    z-index: 99989;
    background: #e63946;
    color: #fff;
    box-shadow: 0 2px 8px rgba(230, 57, 70, 0.35);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.cms-toolbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.cms-toolbar-title {
    font-size: 13px;
    font-weight: 600;
}

.cms-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cms-lang-btn {
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: transparent;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.cms-lang-btn.active {
    background: #fff;
    color: #e63946;
    border-color: #fff;
}

.cms-toolbar-exit {
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    margin-left: 8px;
}

.cms-toolbar-home {
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    margin-left: 6px;
    background: rgba(255, 255, 255, 0.15);
}

.cms-toolbar-home:hover {
    background: rgba(255, 255, 255, 0.3);
}

.cms-hover {
    outline: 2px dashed #e63946 !important;
    outline-offset: 2px;
    cursor: pointer !important;
}

.cms-highlight {
    outline: 3px solid #e63946 !important;
    outline-offset: 2px;
}

.cms-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cms-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.cms-modal-panel {
    position: relative;
    width: min(720px, 100%);
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cms-modal-panel-wide {
    width: min(860px, 100%);
}

.cms-about-combined .cms-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1d3557;
    margin: 0 0 8px;
}

.cms-about-combined .cms-field-label + .cms-about-image-preview,
.cms-about-combined .cms-field-label + .cms-quill-wrap {
    margin-bottom: 16px;
}

.cms-about-image-preview {
    border: 1px solid #e8eef3;
    border-radius: 10px;
    padding: 12px;
    background: #f8f9fa;
    text-align: center;
}

.cms-about-image-preview img {
    max-width: 100%;
    max-height: 220px;
    border-radius: 8px;
    object-fit: cover;
}

.cms-about-preview-empty {
    padding: 28px 12px;
    color: #888;
    font-size: 14px;
}

.cms-about-upload {
    margin-bottom: 20px;
}

.cms-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.cms-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1d3557;
}

.cms-modal-close {
    border: none;
    background: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.cms-modal-body {
    padding: 16px 20px;
    overflow: auto;
}

.cms-modal-footer {
    padding: 12px 20px 16px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.cms-btn {
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
}

.cms-btn-primary {
    background: #e63946;
    color: #fff;
}

.cms-btn-muted {
    background: #f1f3f5;
    color: #333;
}

#cms-text-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.cms-quill-wrap {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.cms-quill-wrap .ql-toolbar.ql-snow {
    border: none;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
}

.cms-quill-wrap .ql-container.ql-snow {
    border: none;
    min-height: 260px;
    font-size: 15px;
}

#cms-quill-editor {
    min-height: 260px;
}

.cms-quill-wrap .quill-html-source-editor {
    min-height: 260px;
    width: 100%;
    box-sizing: border-box;
    border: none;
    border-top: 1px solid #ddd;
    padding: 12px;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}

.cms-modal-tip {
    margin: 10px 0 0;
    font-size: 12px;
    color: #666;
}

.cms-link-btn {
    border: none;
    background: none;
    color: #e63946;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    font-size: 12px;
}

.cms-image-preview {
    margin-bottom: 12px;
    text-align: center;
}

.cms-image-preview img {
    max-width: 100%;
    max-height: 240px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.cms-upload-label {
    display: block;
    padding: 12px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    color: #555;
}

.cms-upload-label input {
    display: none;
}

.cms-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1d3557;
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.25s ease;
    z-index: 100000;
    pointer-events: none;
}

        .cms-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.cms-quick-wrap {
    position: relative;
}

.cms-quick-toggle {
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.08);
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.cms-quick-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    overflow: hidden;
    z-index: 100001;
}

.cms-quick-menu.open {
    display: block;
}

.cms-quick-item {
    display: block;
    padding: 10px 14px;
    color: #1d3557;
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
}

.cms-quick-item:hover {
    background: #f8f9fa;
}

.cms-global-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #444;
}

.cms-field-label {
    display: block;
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.cms-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    margin-bottom: 12px;
}

#cms-link-text {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    margin-bottom: 12px;
    resize: vertical;
}

.cms-bg-preview {
    width: 100%;
    height: 160px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    border: 1px solid #eee;
}

body.cms-editing-active img {
    pointer-events: auto !important;
}

body.cms-editing-active {
    user-select: text !important;
    -webkit-user-select: text !important;
}

/* About page — visual edit polish */
body.cms-edit-mode.page-about .about-panel {
    box-shadow: 0 18px 50px rgba(29, 53, 87, 0.08), 0 0 0 1px rgba(230, 57, 70, 0.08);
}

body.cms-edit-mode.page-about [data-cms-about-block].cms-hover {
    outline-offset: 4px;
    box-shadow: 0 18px 50px rgba(29, 53, 87, 0.12), 0 0 0 3px rgba(230, 57, 70, 0.2);
}

body.cms-edit-mode.page-about .certifications-section .feature-card {
    transition: outline-color 0.2s ease, box-shadow 0.2s ease;
}

body.cms-edit-mode.page-about .page-header-about .cms-hover {
    outline-color: rgba(255, 255, 255, 0.85);
    outline-offset: 4px;
}

body.cms-edit-mode.page-about .certifications-section .feature-card.cms-hover {
    outline-offset: 3px;
}

html[lang="zh-CN"] body.cms-edit-mode.page-about [data-cms-about-block]::after {
    content: '点击编辑公司介绍（主图+正文）';
}

html[lang="en"] body.cms-edit-mode.page-about [data-cms-about-block]::after {
    content: 'Edit about section (image + text)';
}

body.cms-edit-mode.page-about [data-cms-about-block]::after {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(230, 57, 70, 0.92);
    color: #fff;
    font-size: 12px;
    line-height: 1.35;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}

body.cms-edit-mode.page-about [data-cms-about-block]:hover::after {
    opacity: 1;
}

body.cms-edit-mode.page-about [data-cms-about-block] {
    position: relative;
}

@media (max-width: 640px) {
    body.cms-edit-mode {
        padding-top: 120px;
    }

    .cms-toolbar {
        top: 42px;
    }

    .cms-admin-btn,
    .cms-admin-btn-off {
        margin-left: 0;
    }
}
