/*Global*/
:root {
    --primary-color: #1061A3;
    --secondary-color: white;
    --dark-gray: #868686;
    --text-color: #555;
}

.hx-modal .modal-body {
    white-space: pre-line;
}

.hx-modal .modal-title {
    color: var(--primary-color);
    font-weight: bold;
}

.hx-modal .modal-footer .btn-primary {
    padding: 5px 7px;
    background-color: var(--primary-color);
    border-radius: 4px;
    color: var(--secondary-color);
    border: none;
}

.hx-modal .modal-footer .btn-secondary {
    padding: 5px 7px;
    background-color: var(--secondary-color);
    border: 1px solid #ddd;
    border-radius: 4px;
    color: var(--text-color);
}

.hx-modal .btn-close {
    background-image: none;
    background-color: var(--primary-color);
    opacity: 1;
    -webkit-mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
    mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
    -webkit-mask-size: 1em;
    mask-size: 1em;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

body{
    font-family: inter, Arial !important;
}

article.content {
    padding: 0 !important;
}

/*font setting */

.a4-page .field-label,
.a4-page .field-input,
.a4-page .field-textarea,
.a4-page .help-text,
.a4-page .radio-label,
.a4-page .checkbox-label,
.a4-page .radio-label span,
.a4-page .checkbox-label span,
.a4-page .field-card-header .field-label,
.a4-page .matrix-table th,
.a4-page .matrix-table td,
.a4-page .option-label,
.a4-page .other-input,
.a4-page .matrix-dropdown {
    font-size: var(--base-font-size, 14px) !important;
}

.label {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.label-blue{
    color: var(--primary-color)
}

.select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.select-setting {
    width: 85px
}

.input {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.input-setting{
    width: 60px
}

.custom-headline {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    justify-items: center;
    align-items: center;
    margin: 0;
    color: var(--primary-color)
}

.icon{
    color: var(--secondary-color);
    font-size: 28px;
}

.icon-blue{
    color: var(--primary-color);
    font-size: 25px;
}

.space-between{
 display: flex;
 justify-content: space-between;
 align-items: center;
 gap: 5px;
}


/*Google fonts - icons*/
@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 100 700;
    src: url('fonts/MaterialSymbolsOutlined.ttf') format('truetype');
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: 250;
    font-style: normal;
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'liga';
}

/*Buttons*/

.primary-button {
    padding: 5px 7px;
    background-color: var(--primary-color);
    border-radius: 4px;
    color: var(--secondary-color);
    border: none;
    margin: 10px 0;
    cursor: pointer;
    width: fit-content;
    font-size: 14px;
}

.secondary-button {
    padding: 5px 7px;
    margin: 10px 0;
    cursor: pointer;
    width: fit-content;
    font-size: 14px;
    color: var(--text-color);
    background-color: var(--secondary-color);
    border: 1px solid #ddd;
    border-radius: 4px;
}

    .secondary-button.disabled {
        opacity: 0.5;
        cursor: not-allowed;
        background-color: #e0e0e0;
        color: #9e9e9e;
    }

.icon-button {
    font-size: 30px;
}

.btn-send{
    background: #e6027c;
    border-color: #e6027c;
    color: #fff;
    width: fit-content;
    padding: 11px 51px;
}

    .btn-send:hover {
        background-color: #cf0270;
        color: #fff;
    }

.fill-mode-toolbar .btn-send {
    position: fixed;
    top: 6rem;
    right: 2rem;
    z-index: 100;
}

.save-status-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 0;
    font-weight: 600;
    font-size: 15px;
}

.save-status-banner.success {
    color: #28a745;
}

.save-status-banner.error {
    color: #dc3545;
}

.save-status-banner.saving {
    color: #6c757d;
}

/* Main container */
.form-editor-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 3.5rem);
    background-color: #f5f5f5;
}

.form-editor-container.fill-mode {
    background-color: #ece9f2;
    height: auto;
}

.fill-mode .main-layout {
    overflow: visible;
}

.fill-mode .center-panel {
    overflow: visible;
}

.fill-mode .panel-content {
    overflow: visible;
}

/* Top toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--dark-gray);
    padding: 5px 20px 5px 60px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.toolbar-button {
    color: var(--secondary-color);
    background-color: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

    .toolbar-button:hover {
        transform: scale(1.2);
    }

/*    TODO*/

    .toolbar-button.active {
        transform: scale(1.2);
        font-weight: 500;
    }



/* Main layout with three panels */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Wizard mode: 60/40 split */
.main-layout.wizard-mode .center-panel {
    flex: 0 0 60%;
    max-width: 60%;
}

.wizard-panel {
    flex: 0 0 40%;
    max-width: 40%;
    padding: 0;
    background: #f5f5f5;
    border-left: 1px solid #ddd;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Wizard screen indicator */
.wizard-screen-indicator {
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

/* Phone frame container */
.phone-frame-container {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 16px 8px;
    overflow-y: auto;
}

/* Phone frame - iPhone style mockup */
.phone-frame {
    width: 375px;
    min-height: 667px;
    background: #fff;
    border-radius: 40px;
    border: 3px solid #1a1a1a;
    box-shadow:
        0 0 0 2px #333,
        0 8px 40px rgba(0, 0, 0, 0.15),
        inset 0 0 0 1px #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transform-origin: top center;
    flex-shrink: 0;
}

/* Scale phone to fit in panel on smaller screens */
@media (max-width: 1600px) {
    .phone-frame {
        transform: scale(0.85);
        margin-bottom: -100px;
    }
}

@media (max-width: 1400px) {
    .phone-frame {
        transform: scale(0.75);
        margin-bottom: -160px;
    }
}

/* Phone notch */
.phone-notch {
    width: 150px;
    height: 28px;
    background: #1a1a1a;
    border-radius: 0 0 20px 20px;
    margin: 0 auto;
    flex-shrink: 0;
}

/* Phone screen */
.phone-screen {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-y: auto;
    background: #fafafa;
}

    .phone-screen::-webkit-scrollbar {
        width: 4px;
    }

    .phone-screen::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 2px;
    }

/* Phone home bar */
.phone-home-bar {
    width: 134px;
    height: 5px;
    background: #1a1a1a;
    border-radius: 3px;
    margin: 8px auto 10px;
    flex-shrink: 0;
}

/* Field inside phone - always 100% width */
.phone-field-card {
    width: 100%;
    flex: 1;
}

    .phone-field-card .field-card {
        border: none;
        padding: 0;
        width: 100% !important;
        max-width: 100% !important;
        flex: unset !important;
    }

    .phone-field-card .field-horizontal-layout {
        flex-direction: column;
        align-items: flex-start;
    }

/* Phone empty state */
.phone-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    text-align: center;
    gap: 12px;
    padding: 40px 20px;
}

    .phone-empty-state .material-symbols-outlined {
        font-size: 48px;
        color: #ccc;
    }

    .phone-empty-state p {
        font-size: 14px;
        line-height: 1.5;
        margin: 0;
    }

/* Navigation buttons */
.phone-nav-buttons {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    margin-top: auto;
    flex-shrink: 0;
}

.phone-nav-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

    .phone-nav-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

.phone-nav-btn.back {
    background: #e0e0e0;
    color: #333;
}

    .phone-nav-btn.back:hover:not(:disabled) {
        background: #d0d0d0;
    }

.phone-nav-btn.next {
    background: #1061A3;
    color: white;
}

    .phone-nav-btn.next:hover:not(:disabled) {
        background: #0d4f8a;
    }

/* Wizard field toolbar on A4 fields */
.wizard-field-toolbar {
    gap: 6px;
    align-items: center;
}



.wizard-screen-badge {
    height: 24px;
    padding: 0 14px;
    border-radius: 12px;
    background: #1061A3;
    color: white;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    white-space: nowrap;
}


/* Phone fields scroll container */
.phone-fields-scroll {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
}

/* Left panel */
.left-panel {
    width: 15%;
    background-color: #ffffff;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

/* Center panel */
.center-panel {
    flex: 1;
    /* background-color: #f9f9f9; */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    justify-content: center;
    align-items: center;
}

/* Right panel */
.right-panel {
    width: 25%;
    background-color: #ffffff;
    border-left: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

/* Panel titles */
.panel-title {
    height:55px;
    padding: 0 20px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    background-color: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items:center;
}

/* Panel content */
.panel-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

    /* Scrollbar styling */
    .panel-content::-webkit-scrollbar {
        width: 8px;
    }

    .panel-content::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .panel-content::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 4px;
    }

        .panel-content::-webkit-scrollbar-thumb:hover {
            background: #a8a8a8;
        }

/* Field Types Panel */
.field-category {
    margin-bottom: 24px;
}

.category-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.field-type-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 6px;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    text-align: left;
}

    .field-type-btn:hover {
        background-color: #f0f7ff;
        border-color: #3b6ba8;
        box-shadow: 0 2px 4px rgba(59, 107, 168, 0.1);
    }

    .field-type-btn:active {
        transform: scale(0.98);
    }

.field-icon {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
}

.field-label {
    color: #333;
    font-size: 14px;
}

.field-horizontal-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.field-label-left {

    height: 100%;
}
/* Center Panel - Form Canvas */
.empty-canvas {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 16px;
}

.page-wrapper {
    height: 100%;
    flex: 1;
}

.form-canvas {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    flex: none;
    gap: 8px;
    align-items: flex-start;
    overflow: hidden;
}

/* Form Header */
.form-header {
    width: 100%;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: none;
}

.form-title-input {
    width: 100%;
    height:55px;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    background: transparent;
    transition: border-color 0.2s;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}


    .form-title-input:focus {
        outline: none;
        border-bottom-color: #3b6ba8;
    }

    .form-title-input::placeholder {
        color: #999;
    }

.form-description-input {
    width: 100%;
    margin-top: 12px;
    padding: 8px 0;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 16px;
    color: #666;
    background: transparent;
    resize: none;
    transition: border-color 0.2s;
}

    .form-description-input:focus {
        outline: none;
        border-bottom-color: #3b6ba8;
    }

    .form-description-input::placeholder {
        color: #999;
    }

.form-title-display {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin: 0;
    padding-bottom: 12px;
}

.form-description-display {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* Preview Mode */
.center-panel.preview-mode {
    margin: 0 auto;
    max-width: 900px;
}

.preview-mode .field-card {
    cursor: default;
    border-color: #e0e0e0;
}

    .preview-mode .field-card:hover {
        border-color: #e0e0e0;
        box-shadow: none;
    }

    .preview-mode .field-card.selected {
        border-color: #e0e0e0;
        background-color: white;
        box-shadow: none;
    }

/* A4 Pages */
.a4-pages-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: center;
    padding: 20px 0;
}

.a4-page {
    width: 210mm;
    height: 297mm;
    background: white;
    padding: 20mm;
    margin: 0 auto;
    box-shadow: none;
    border: none;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.page-number {
    position: absolute;
    top: 10mm;
    right: 10mm;
    font-size: 12px;
    color: #999;
    font-weight: 500;
}

/* Document number - absolute overlay on page, right side, text bottom-to-top */
.document-number-overlay {
    position: absolute;
    right: 2mm;
    top: 66%;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    pointer-events: none;
    z-index: 5;
}

/* Document number preview shown in editor field card */
.document-number-preview {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 10px;
    color: #666;
    white-space: nowrap;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-break {
    width: 210mm;
    height: 30px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

    .page-break::before {
        content: '';
        position: absolute;
        width: 100%;
        height: 1px;
        border-top: 2px dashed #ccc;
    }

/* Page Break Field */
.page-break-field {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 16px;
    margin: 8px 0;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

    .page-break-field:hover {
        border-color: #3b6ba8;
        box-shadow: 0 2px 8px rgba(59, 107, 168, 0.15);
    }

    .page-break-field.selected {
        border-color: #3b6ba8;
        background-color: #f0f7ff;
        box-shadow: 0 0 0 3px rgba(59, 107, 168, 0.1);
    }

.page-break-line {
    flex: 1;
    height: 2px;
    background: linear-gradient(to right, transparent, #ccc, transparent);
}

.page-break-text {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
    padding: 0 12px;
}

.field-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    box-sizing: border-box;
    padding: 10px
}

    .field-card:hover {
        border-color: #3b6ba8;
        box-shadow: 0 2px 8px rgba(59, 107, 168, 0.15);
    }

    .field-card.selected {
        border-color: #3b6ba8;
        background-color: #f0f7ff;
        box-shadow: 0 0 0 3px rgba(59, 107, 168, 0.1);
    }

.richtext-field-wrapper {
    border: none;
    cursor: pointer;
}

/* Field Toolbar */
.field-toolbar {
    position: absolute;
    top: -12px;
    right: 12px;
    display: flex;
    gap: 4px;
    background: white;
    padding: 4px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.toolbar-section{
   display: flex;
   flex-wrap: wrap;
   gap: 15px;
   margin-top: 16px;
}

.field-card:hover .field-toolbar,
.field-card.selected .field-toolbar,
.page-break-field:hover .field-toolbar,
.page-break-field.selected .field-toolbar,
.document-number-overlay:hover .field-toolbar {
    opacity: 1;
}

.toolbar-icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

    .toolbar-icon-btn:hover:not(:disabled) {
        background: #f0f7ff;
        border-color: #3b6ba8;
        transform: scale(1.05);
    }

    .toolbar-icon-btn:active:not(:disabled) {
        transform: scale(0.95);
    }

    .toolbar-icon-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

.field-card-header {
    margin-bottom: 12px;
}

    .field-card-header .field-label {
        font-size: 15px;
        font-weight: 600;
        color: #333;
    }

.required-star {
    color: #e74c3c;
    margin-left: 4px;
}

.field-card-body {
    width: 100%;
}

.help-text {
    margin-top: 8px;
    color: #666;
    line-height: 1.4;
}

.field-input,
.field-textarea {
    width: 100%;
    padding: 5px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s;
}

    .field-input:focus,
    .field-textarea:focus {
        outline: none;
        border-color: #3b6ba8;
        box-shadow: 0 0 0 3px rgba(59, 107, 168, 0.1);
    }

    .field-input.dotted-border {
        border-bottom: 2px dotted #999;
    }


    .field-input.no-border {
        border: none;
        background: transparent;
    }

.field-textarea {
    resize: vertical;
    min-height: 80px;
}

    .field-input.dotted-border,
    .field-textarea.dotted-border,
    .field-input.dotted-border:focus,
    .field-textarea.dotted-border:focus {
        border: none;
        border-bottom: 2px dotted #999;
        border-radius: 0;
        background: transparent;
    }

/*Page setting*/

.page-margin {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 15px;
    width: auto;
}


/* Radio and Checkbox Groups */
.radio-group.horizontal,
.checkbox-group.horizontal {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

    .radio-group.horizontal .radio-label,
    .checkbox-group.horizontal .checkbox-label {
        margin-bottom: 0;
    }

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
    cursor: pointer;
}

    .radio-label input[type="radio"],
    .checkbox-label input[type="checkbox"] {
        width: 18px;
        height: 18px;
        cursor: pointer;
    }

    .radio-label span,
    .checkbox-label span {
        user-select: none;
    }

.other-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-left: 8px;
}

/* Right Panel - Properties */
.no-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    text-align: center;
    padding: 20px;
}


.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom:25px
}

.property-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.property-input,
.property-select,
.property-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

    .property-input:focus,
    .property-select:focus,
    .property-textarea:focus {
        outline: none;
        border-color: #3b6ba8;
        box-shadow: 0 0 0 3px rgba(59, 107, 168, 0.1);
    }

.property-textarea {
    resize: vertical;
    min-height: 60px;
}

.property-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    user-select: none;
}

    .property-checkbox-label input[type="checkbox"] {
        width: 18px;
        height: 18px;
        cursor: pointer;
    }

/* Options List in Properties Panel */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.option-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.option-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

    .option-input:focus {
        outline: none;
        border-color: #3b6ba8;
        box-shadow: 0 0 0 3px rgba(59, 107, 168, 0.1);
    }

.option-depth-input {
    width: 32px;
    padding: 6px 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    transition: border-color 0.2s;
}

    .option-depth-input:focus {
        outline: none;
        border-color: #3b6ba8;
        box-shadow: 0 0 0 3px rgba(59, 107, 168, 0.1);
    }

.option-delete-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

    .option-delete-btn:hover {
        background: #fee;
        border-color: #e74c3c;
    }

.add-option-btn {
    width: 100%;
    padding: 10px;
    background: #f8f9fa;
    border: 1px dashed #3b6ba8;
    border-radius: 4px;
    color: #3b6ba8;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

    .add-option-btn:hover {
        background: #e8f2ff;
        border-style: solid;
    }

/* Matrix Table */
.matrix-container {
    width: 100%;
    overflow-x: auto;
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

    .matrix-table th,
    .matrix-table td {
        padding: 12px;
        text-align: center;
        border: none;
    }

    .matrix-table th {
        background-color: transparent;
        font-weight: 600;
        color: #333;
    }

    .matrix-table td.row-label {
        background-color: transparent;
        font-weight: 500;
        text-align: left;
        color: #333;
    }

    .matrix-table td.matrix-cell {
        background-color: transparent;
    }

    .matrix-table input[type="radio"] {
        width: 18px;
        height: 18px;
        cursor: pointer;
    }

.matrix-dropdown {
    width: 100%;
    min-width: 120px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
}

    .matrix-dropdown:focus {
        outline: none;
        border-color: #3b6ba8;
    }


/* Warning for fields near page end */
.field-card.near-page-break {
    position: relative;
    border-color: #ff9800 !important;
}

    .field-card.near-page-break::before {
        content: '';
        position: absolute;
        top: -2px;
        left: -2px;
        right: -2px;
        bottom: -2px;
        background: linear-gradient(135deg, rgba(255, 152, 0, 0.1) 0%, rgba(255, 152, 0, 0.05) 100%);
        border-radius: 8px;
        pointer-events: none;
        z-index: -1;
    }

    .field-card.near-page-break .field-warning-badge {
        display: flex;
        align-items: center;
        gap: 4px;
        position: absolute;
        top: -10px;
        left: 12px;
        background: #ff9800;
        color: white;
        padding: 4px 10px;
        border-radius: 12px;
        font-size: 11px;
        font-weight: 600;
        box-shadow: 0 2px 6px rgba(255, 152, 0, 0.3);
        z-index: 5;
    }

.field-warning-badge .warning-icon {
    font-size: 12px;
}

.field-card.no-border,
.field-horizontal-layout.no-border {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0;
}

/* Tooltip for warning */
.field-warning-tooltip {
    position: absolute;
    top: -45px;
    left: 12px;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

    .field-warning-tooltip::after {
        content: '';
        position: absolute;
        bottom: -6px;
        left: 20px;
        width: 0;
        height: 0;
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-top: 6px solid #333;
    }

.field-card.near-page-break:hover .field-warning-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Page fill indicator */
.page-fill-indicator {
    position: absolute;
    bottom: 10mm;
    right: 10mm;
    background: rgba(59, 107, 168, 0.1);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    color: #666;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

    .page-fill-indicator .fill-bar {
        width: 40px;
        height: 6px;
        background: #e0e0e0;
        border-radius: 3px;
        overflow: hidden;
        position: relative;
    }

    .page-fill-indicator .fill-bar-inner {
        height: 100%;
        background: linear-gradient(90deg, #2ecc71 0%, #f39c12 70%, #e74c3c 90%);
        transition: width 0.3s ease;
    }

/* Warning pulse animation */
@keyframes pulse-warning {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(255, 152, 0, 0);
    }
}

.field-card.near-page-break.selected {
    animation: pulse-warning 2s ease-in-out infinite;
}


/* Page almost full indicator */
.a4-page.page-almost-full {
    border-color: #ff9800;
}

    .a4-page.page-almost-full .page-number {
        color: #ff9800;
        font-weight: 600;
    }

/* Page Settings Dialog */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.dialog-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}







.dialog-section {
    margin-bottom: 28px;
}

    .dialog-section:last-child {
        margin-bottom: 0;
    }

.dialog-section-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #3b6ba8;
}

.dialog-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.dialog-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dialog-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.dialog-input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

    .dialog-input:focus {
        outline: none;
        border-color: #3b6ba8;
        box-shadow: 0 0 0 3px rgba(59, 107, 168, 0.1);
    }

.dialog-input-suffix {
    position: relative;
}

    .dialog-input-suffix input {
        padding-right: 40px;
    }

    .dialog-input-suffix::after {
        content: attr(data-suffix);
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: #999;
        font-size: 13px;
        pointer-events: none;
    }

.dialog-radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.dialog-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

    .dialog-radio-label input[type="radio"] {
        width: 18px;
        height: 18px;
        cursor: pointer;
    }

.dialog-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    margin-bottom: 12px;
}

    .dialog-checkbox-label input[type="checkbox"] {
        width: 18px;
        height: 18px;
        cursor: pointer;
    }

.dialog-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    transition: all 0.2s;
}

    .dialog-textarea:focus {
        outline: none;
        border-color: #3b6ba8;
        box-shadow: 0 0 0 3px rgba(59, 107, 168, 0.1);
    }


/* Page number position selector */
.page-number-position-selector {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.position-option {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    font-weight: 500;
    color: #666;
}

    .position-option:hover {
        border-color: #3b6ba8;
        background: #f0f7ff;
    }

    .position-option.active {
        border-color: #3b6ba8;
        background: #3b6ba8;
        color: white;
    }

/* Help text */
.dialog-help-text {
    font-size: 12px;
    color: #666;
    margin-top: 6px;
    line-height: 1.4;
}

/* Dynamic page settings */
.a4-page.landscape {
    width: 297mm;
    height: 210mm;
}

.a4-page.portrait {
    width: 210mm;
    height: 297mm;
}

/* Logo position selector with icons */
.logo-position-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.logo-position-option {
    padding: 16px 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: white;
}

    .logo-position-option:hover {
        border-color: #3b6ba8;
        background: #f0f7ff;
    }

    .logo-position-option.active {
        border-color: #3b6ba8;
        background: #3b6ba8;
        color: white;
    }

.logo-position-icon {
    font-size: 24px;
    line-height: 1;
}

.logo-position-label {
    font-size: 11px;
    font-weight: 500;
}

.logo-position-option.active .logo-position-label {
    color: white;
}

/* Markdown help text */
.markdown-help {
    font-size: 11px;
    color: #666;
    background: #f8f9fa;
    padding: 8px 10px;
    border-radius: 4px;
    margin-top: 6px;
    line-height: 1.6;
}

    .markdown-help code {
        background: white;
        padding: 2px 4px;
        border-radius: 2px;
        color: #e74c3c;
    }

/* Header/Footer rendering with logos */
.page-header-content,
.page-footer-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Logo positions */
.header-footer-layout-left {
    flex-direction: row;
}

.header-footer-layout-right {
    flex-direction: row-reverse;
}

.header-footer-layout-top {
    flex-direction: column;
}

.header-footer-layout-bottom {
    flex-direction: column-reverse;
}

.header-footer-layout-standalone {
    justify-content: center;
}

.header-footer-text {
    font-size: 11px;
    color: #666;
    line-height: 1.6;
    white-space: pre-line;
    flex: 1;
}

    .header-footer-text strong {
        font-weight: 700;
        color: #333;
    }

    .header-footer-text em {
        font-style: italic;
    }

.header-footer-logo {
    max-height: 50px;
    max-width: 150px;
    object-fit: contain;
}

.header-footer-logo-error {
    max-height: 50px;
    max-width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border: 1px dashed #ccc;
    border-radius: 4px;
    padding: 12px;
    font-size: 10px;
    color: #999;
}

/* Simplified page header/footer wrappers */

.page-header-wrapper, .page-footer-wrapper {
    flex-shrink: 0;
}

.page-footer-wrapper {
    margin-top: auto;
}

.page-number-display {
    font-size: 11px;
    color: #666;
    font-weight: 500;
}

    .page-number-display.pos-left {
        order: -1;
    }

    .page-number-display.pos-center {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    .page-number-display.pos-right {
        margin-left: auto;
    }

.grid-editor {
    padding: 0 16px 16px 16px;
}

.grid-setup-toolbar {
    padding: 25px;
}

.grid-setup-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.empty-grid-placeholder {
    padding: 30px 20px;
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    text-align: center;
    color: #6b7280;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-grid-placeholder p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.setup-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-radius: 4px;
}

row-select {
    width: 50px;
}

.select-row {
    width: 10px
}

.setup-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    cursor: pointer;
}

/*Grid designer*/

.create-grid-btn {
    width: 100%;
    padding: 12px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

    .create-grid-btn:hover {
        background: #1976D2;
    }

.grid-editor-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}


/*  Grit preview    */

.grid-preview-label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.grid-tamplate {
    display: grid;
    gap: 0;
    border: 2px solid #2196F3;
    background: white;
    min-height: 160px;
}

    .grid-tamplate .grid-cell {
        border: 1px solid #ddd;
        padding: 8px;
        cursor: pointer;
        transition: all 0.2s;
        position: relative;
        min-height: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: white;
    }

    .grid-tamplate .grid-cell:hover {
        background: #f5f5f5;
    }
    .grid-tamplate .grid-cell.selected {
        background: #e3f2fd !important;
        box-shadow: inset 0 0 0 2px #2196F3;
        z-index: 1;
    }

/*    Grid render   */
.table-grid {
    display: grid;
    gap: 0;
    background: white;
    min-height: 20px;
}

    .table-grid .grid-cell-render {
        border: none;
        padding: 8px;
        min-height: 20px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        background: white;
        font-size: 13px;
        line-height: 1.4;
    }

    .table-grid .grid-cell {
        border: none;
        padding: 8px;
        min-height: 20px; 
        display: flex;
        align-items: center;
        justify-content: center;
        background: white;
    }

    /* Grid border */
    .table-grid.grid-with-border {
        border: 1px solid #9ca3af;
    }
        .table-grid.grid-with-border .grid-cell-render {
            border: 1px solid #d1d5db;
        }

        .table-grid.grid-with-border .grid-cell {
            border: 1px solid #d1d5db;
        }


.cell-empty {
    color: #999;
    font-size: 12px;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell-position {
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 4px;
}

.cell-text {
    width: 100%;
    overflow: auto;
    font-size: 13px;
    line-height: 1.4;
}

    .cell-text p {
        margin: 0;
    }

.cell-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

    .cell-image img {
        max-width: 100%;
        max-height: 200px;
        object-fit: contain;
    }

.merged-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #FF9800;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.selection-info {
    padding: 8px 12px;
    background: #e3f2fd;
    border-radius: 4px;
    font-size: 13px;
    color: #1976D2;
    font-weight: 500;
}

.reset-grid-btn {
    background: #f44336;
    transition: background 0.2s;
    margin-bottom: 25px;
}

    .reset-grid-btn:hover {
        background: #d32f2f;
    }

/* Grid input fields */
.grid-text-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    transition: border-color 0.2s;
}

    .grid-text-input:focus {
        outline: none;
        border-color: #2196F3;
        box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
    }

    .grid-text-input:disabled {
        background: #f5f5f5;
        cursor: not-allowed;
    }

.grid-checkbox-input {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #2196F3;
}

    .grid-checkbox-input:disabled {
        cursor: not-allowed;
        opacity: 0.5;
    }
/* Grid header/footer */
/*.grid-cell-render {
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: white;
    font-size: 13px;
    line-height: 1.4;
}

.grid-cell-render > div {
    width: 100%;
}

.grid-cell-render div[style*="text-align: right"] {
    width: 100%;
    display: block;
}*/

.alignment-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.alignment-btn {
    padding: 8px 16px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}

    .alignment-btn:hover {
        border-color: #999;
        background: #f5f5f5;
    }

    .alignment-btn.active {
        border-color: #007bff;
        background: #e7f3ff;
    }


/*    header/footer text editor*/

.editor-dialog {
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.dialog-header {
    padding: 15px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dialog-close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    color: #666;
    transition: all 0.2s;
}

    .dialog-close-btn:hover {
        background: #f0f0f0;
        color: #333;
    }

.dialog-body {
    padding: 0 24px 24px 24px;
    overflow-y: auto;
    flex: 1;
}

    .dialog-body::-webkit-scrollbar {
        width: 8px;
    }

    .dialog-body::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .dialog-body::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 4px;
    }

        .dialog-body::-webkit-scrollbar-thumb:hover {
            background: #a8a8a8;
        }

.dialog-footer {
    padding: 16px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.setting-group{
    margin: 15px 0;
}

.nav-item {
  color: white;
}

/* Validation styles */
.field-input.is-invalid,
.field-textarea.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.validation-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}