/* ==========================================================================
   Email Edit Page Styles
   ========================================================================== */
/* --- Form Container --- */
.campaign-form {
    background-color: #fff;
    padding: 24px 28px;
    border-radius: 3px;
    border: 1px solid #D2DAD2;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 12px;
    position: relative;
    /* Context for dropdowns */
}

.form-group label {
    width: 90px;
    flex-shrink: 0;
    font-family: 'Urbanist', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #232323BF;
    padding-top: 10px;
}

.input-wrapper {
    flex-grow: 1;
    position: relative;
}

/* Inputs & Selects */
.form-input,
.form-select {
    width: 100%;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #D2DAD2;
    border-radius: 3px;
    font-family: 'Urbanist', sans-serif;
    font-size: 14px;
    color: #232323;
    outline: none;
    background: #fff;
}

.form-input:focus,
.form-select:focus {
    border-color: #159C2A;
}

.form-input::placeholder {
    color: #23232359;
}

/* Field Note */
.field-note {
    font-size: 10px;
    color: #232323B2;
    margin-top: 6px;
    font-family: 'Urbanist', sans-serif;
    line-height: 12px;
    font-weight: 500;
}

.field-note .green-text {
    color: #159C2A;
    text-decoration: underline;
    cursor: pointer;
}

/* --- Multi-Column Row --- */
.form-row {
    display: flex;
    margin-bottom: 10px;
}

.form-row>*:not(:first-child) {
    padding-left: 24px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-row>*:not(:first-child) label {
    width: auto;
}

.half-width {
    width: 50%;
    margin-bottom: 0;
}

/* FIX: Label width in half-width rows should be same as standard (150px) or just auto */
.half-width label {
    width: 90px;
}

/* --- Custom Multi-select Dropdown (Updated Design) --- */
.custom-multiselect {
    flex-grow: 1;
    position: relative;
    font-family: 'Urbanist', sans-serif;
}

.select-box {
    width: 100%;
    height: 34px;
    border: 1px solid #D2DAD2;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    cursor: pointer;
    background: #fff;
    user-select: none;
    font-size: 14px;
}

.select-box .arrow {
    transition: transform 0.2s;
}

.custom-multiselect.open .arrow {
    transform: rotate(180deg);
}

/* Dropdown Options Container */
.options-list {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background: #fff;
    border-radius: 6px;
    z-index: 100;
    box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.1);
    /* Soft shadow like image */
    padding: 8px 0;
}

.custom-multiselect.open .options-list {
    display: block;
}

/* Option Item Style */
.option-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    color: #232323;
    position: relative;
    transition: background-color 0.2s;
}

.option-item:hover {
    background-color: #F7F7F7;
}

.option-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Custom Checkbox Box */
.checkmark {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    height: 18px;
    width: 18px;
    background-color: #fff;
    border: 1px solid #CCCCCC;
    border-radius: 3px;
    transition: all 0.2s;
}

.option-label {
    margin-left: 28px;
    /* Space for checkbox */
}

/* Checked Row Background */
.option-item:has(input:checked) {
    background-color: #E8F6EA;
}


/* --- Custom Date Picker Modal --- */
.date-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.date-picker-overlay.active {
    display: flex;
}

.date-picker-modal {
    background: #fff;
    width: 330px;
    border-radius: 3px;
    padding: 28px 24px;
    font-family: 'Urbanist', sans-serif;
    position: relative;
    box-shadow: 0px 4px 15px 0px #23232326;
    border: 1px solid #EEEEEE;
}

/* Modal Header */
.dp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dp-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #232323;
    margin: 0;
}

.dp-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.calendar-icon {
    position: absolute;
    width: 14px;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

/* Flatpickr Customization (Inline) */
.flatpickr-calendar {
    box-shadow: none !important;
    width: 100% !important;
}

.flatpickr-months {
    margin-bottom: 10px;
}

.flatpickr-months .flatpickr-month {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 21px;
}

.flatpickr-current-month {
    font-size: 14px;
    line-height: 21px;
    font-weight: 500;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    font-size: 14px;
    line-height: 21px;
    font-weight: 500;
}

.flatpickr-months .flatpickr-prev-month.flatpickr-next-month,
.flatpickr-months .flatpickr-next-month.flatpickr-next-month,
.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month.flatpickr-prev-month {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    height: 21px;
}

.flatpickr-rContainer {
    width: 100%;
}

.flatpickr-weekdays .flatpickr-weekdaycontainer {
    justify-content: space-between;
}

.flatpickr-weekdays {
    margin-bottom: 10px;
    height: auto;
}

span.flatpickr-weekday {
    font-size: 12px;
    color: #232323;
    line-height: 18px;
    font-weight: 500;
    width: 24px;
    flex: unset;
}

.flatpickr-days {
    width: 100%;
}

.dayContainer {
    width: 100%;
    min-width: unset;
    max-width: unset;
    gap: 6px 15px;
    padding: 0;
    justify-content: space-between;
}

.flatpickr-day {
    border-radius: 3px !important;
    width: 24px;
    min-width: unset;
    max-width: unset;
    flex: unset;
    height: 22px;
    line-height: 1;
    padding: 0;
    font-size: 12px;
    font-weight: 500;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover,
.flatpickr-day.selected.prevMonthDay,
.flatpickr-day.startRange.prevMonthDay,
.flatpickr-day.endRange.prevMonthDay,
.flatpickr-day.selected.nextMonthDay,
.flatpickr-day.startRange.nextMonthDay,
.flatpickr-day.endRange.nextMonthDay {
    background: #1BB21B !important;
    border-color: #1BB21B !important;
    border-radius: 3px !important;
    border: none !important;
}

/* Time Controls below calendar */
.dp-time-controls {
    display: flex;
    gap: 5px;
    margin-top: 28px;
    margin-bottom: 28px;
}

.time-input {
    height: 34px;
    border: 1px solid #D2DAD2;
    border-radius: 3px;
    padding: 0px 12px;
    font-size: 14px;
    color: #232323;
    outline: none;
    width: 195px;
    font-weight: 500;
}

.time-input:focus {
    border-color: #159C2A;
}

.ampm-select {
    flex: 1;
    height: 34px;
    border: 1px solid #D2DAD2;
    border-radius: 3px;
    padding: 0px 12px;
    font-size: 14px;
    color: #232323;
    background: #fff;
    cursor: pointer;
    outline: none;
    font-weight: 500;
}

/* Schedule Button */
.schedule-btn {
    width: 100%;
    background-color: #159C2A;
    color: #fff;
    border: none;
    height: 34px;
    border-radius: 3px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 14px;
    font-family: 'Urbanist', sans-serif;
}

.schedule-btn:hover {
    background-color: #128323;
}

.selected-datetime-display {
    text-align: center;
    color: #23232399;
    font-size: 14px;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 1024px) {
    .form-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .form-group label {
        width: 100%;
    }

    .form-row {
        flex-direction: column;
        gap: 20px;
    }

    .half-width {
        width: 100%;
    }

    .half-width label {
        width: 100%;
    }
}

/* ==========================================================================
   Email Edit Page Styles (Waypoint-like)
   ========================================================================== */

/* --- BUILDER WRAPPER --- */
.email-builder-wrapper {
    /* Висота екрану мінус хедер (приблизно 150px на око: хедер + відступи) */
    height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
    border: 1px solid #D2DAD2;
    border-radius: 3px;
    overflow: hidden;
    /* Щоб нічого не вилазило за рамки */
    background: #fff;
}

/* --- TOOLBAR --- */
.builder-toolbar {
    height: 50px;
    background: #fff;
    border-bottom: 1px solid #D2DAD2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
}

.toolbar-actions,
.toolbar-history {
    display: flex;
    gap: 8px;
}

.tool-btn {
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: #F0F0F0;
}

.tool-btn.active {
    background: #E8F6EA;
    color: #159C2A;
    border-color: #E8F6EA;
}

/* --- WORKSPACE (CANVAS + SIDEBAR) --- */
.builder-workspace {
    flex-grow: 1;
    display: flex;
    overflow: hidden;
    /* Прибираємо загальний скрол, щоб скролили дочірні елементи */
    height: 100%;
    /* Важливо */
}

/* Canvas Area */
.canvas-container {
    flex-grow: 1;
    height: 100%;
    overflow-y: auto;
    /* Внутрішній скрол */
    background-color: #F5F5F5;
    padding: 24px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Щоб лист починався зверху */
}

/* THE PAPER (600px Max) */
.email-paper {
    width: 100%;
    max-width: 600px;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.email-paper:not(.preview-active) a {
    pointer-events: none !important;
}

/* Static Sections */
.static-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #BBBBBB;
}

.header-logo img {
    width: 180px;
}

.header-socials {
    display: flex;
    gap: 8px;
}

.social-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* Dynamic Dropzone */
.builder-dropzone {
    flex-grow: 1;
    padding: 20px;
    min-height: 300px;
    position: relative;
    border: 2px solid transparent;
    /* Highlight on dragover */
}

.builder-dropzone.drag-active {
    border-color: #159C2A;
    background: #E8F6EA;
}

.empty-state-message {
    height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed #D0D0D0;
    border-radius: 8px;
    color: #999;
}

/* Blocks in Canvas */
.canvas-block {
    position: relative;
    margin-bottom: 5px;
    cursor: pointer;
    border: 2px solid transparent;
}

.canvas-block:hover {
    box-shadow: inset 0 0 0 1px #159C2A;
}

.canvas-block.selected {
    border: 2px solid #159C2A;
    z-index: 10;
}

/* Selection Label (like design) */
.canvas-block.selected::before {
    content: "Stripe - Content";
    position: absolute;
    top: -22px;
    left: -2px;
    background: #159C2A;
    color: #fff;
    font-size: 10px;
    line-height: 12px;
    padding: 4px 8px;
    border-radius: 4px 4px 0 0;
    font-family: sans-serif;
}

/* Static Footer */
.static-footer {
    padding: 10px 24px 24px;
    border-top: 1px solid #BBBBBB;
    font-family: 'Urbanist', sans-serif;
}

.footer-divider {
    text-align: center;
    font-size: 11px;
    color: #232323CC;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.footer-content {
    display: flex;
    gap: 12px;
    max-width: 410px;
    margin: 0 auto 10px;
    align-items: center;
    justify-content: center;
}

.footer-profile {
    width: 120px;
    text-align: center;
    flex-shrink: 0;
}

.manager-photo {
    width: 100%;
    margin-bottom: 10px;
}

.manager-info h3 {
    font-size: 14px;
    margin: 0;
    font-weight: 500;
}

.manager-info p {
    font-size: 10px;
    color: #232323;
    margin: 0;
}

.footer-details p {
    font-size: 12px;
    margin: 4px 0;
    color: #555;
}

.footer-actions {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.footer-btn {
    background: #159C2A;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.footer-disclaimer {
    font-size: 10px;
    color: #999;
    line-height: 1.4;
    margin-bottom: 15px;
}

.footer-copyright {
    text-align: center;
    font-size: 11px;
    color: #232323CC;
}

/* --- SIDEBAR (RIGHT) --- */
.builder-sidebar {
    width: 320px;
    height: 100%;
    background: #fff;
    border-left: 1px solid #D2DAD2;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-tabs {
    display: flex;
}

.sb-tab {
    flex: 1;
    padding: 12px 15px;
    background: #F3F9F5;
    border: 1px solid transparent;
    border-bottom-color: #D2DAD2;
    font-weight: 500;
    color: #6B7B6F;
    cursor: pointer;
    font-family: 'Urbanist', sans-serif;
    font-size: 15px;
    line-height: 18px;
}

.sb-tab.active {
    background: #fff;
}

.sb-tab.active:first-child {
    border-right-color: #D2DAD2;
    border-bottom-color: transparent;
}

.sb-tab.active:last-child {
    border-left-color: #D2DAD2;
    border-bottom-color: transparent;
}

.sb-panel {
    display: none;
    flex-grow: 1;
    overflow-y: auto;
    /* Скрол для інструментів */
    height: 100%;
    padding-bottom: 20px;
}

.sb-panel.active {
    display: block;
}

/* Blocks Grid (Waypoint style) */
.blocks-container {
    height: 100%;
}

.block-category {
    font-size: 12px;
    font-weight: 700;
    color: #999;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.blocks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* 2 columns */
    gap: 10px;
}

.draggable-item {
    background: #fff;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: grab;
    transition: all 0.2s;
}

.draggable-item:hover {
    border-color: #159C2A;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.icon-box {
    color: #555;
}

/* Inspector */
.inspector-container.hidden {
    display: none;
}

.inspector-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.back-btn {
    background: none;
    border: none;
    color: #159C2A;
    cursor: pointer;
    font-weight: 600;
}

/* Inspector Controls (Sliders, Inputs) */
.insp-group {
    margin-bottom: 15px;
}

.insp-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
}

.insp-input,
.insp-select,
.insp-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
}

.insp-row {
    display: flex;
    gap: 10px;
}

.insp-col {
    flex: 1;
}

.btn-group-align {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.align-btn {
    flex: 1;
    border: none;
    background: #fff;
    padding: 6px;
    cursor: pointer;
    border-right: 1px solid #ddd;
}

.align-btn:last-child {
    border-right: none;
}

.align-btn.active {
    background: #E8F6EA;
    color: #159C2A;
}

/* ==========================================================================
   STYLE PANEL CUSTOM CONTROLS & COLOR PICKER
   ========================================================================== */

.style-group {
    margin-bottom: 24px;
}

.style-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 10px;
    font-family: 'Urbanist', sans-serif;
}

/* Color Swatch Wrapper */
.color-swatch-wrapper {
    position: relative;
    width: 44px;
    height: 44px;
    cursor: pointer;
}

.color-swatch {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    border: 1px solid #E0E0E0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    background-color: #fff;
    transition: all 0.2s;
}

.plus-swatch {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- CUSTOM COLOR PICKER POPUP --- */
.cp-popup {
    position: fixed;
    z-index: 9999;
    background: #fff;
    width: 240px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    padding: 12px;
    display: none;
    /* Hidden by default */
    border: 1px solid #eee;
    top: 0;
    left: 0;
}

.cp-popup.active {
    display: block;
}

/* Saturation/Value Box */
.cp-saturation {
    width: 100%;
    height: 150px;
    position: relative;
    background-color: red;
    /* Changed dynamically via JS */
    border-radius: 4px;
    margin-bottom: 10px;
    cursor: crosshair;
}

.cp-saturation-white {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right, #fff, transparent);
    border-radius: 4px;
}

.cp-saturation-black {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent, #000);
    border-radius: 4px;
}

.cp-cursor {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
    transform: translate(-5px, -5px);
    top: 0;
    left: 100%;
    pointer-events: none;
}

/* Hue Slider */
.cp-hue {
    width: 100%;
    height: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
    position: relative;
    cursor: pointer;
}

.cp-hue-cursor {
    position: absolute;
    top: -2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transform: translateX(-8px);
    pointer-events: none;
}

/* Presets */
.cp-presets {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.cp-preset-color {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.1s;
}

.cp-preset-color:hover {
    transform: scale(1.1);
}

/* Hex Input */
.cp-hex-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    padding: 0 8px;
    height: 36px;
}

.cp-hex-prefix {
    color: #888;
    font-size: 14px;
    margin-right: 4px;
}

.cp-hex-input {
    border: none;
    outline: none;
    font-family: 'Urbanist', sans-serif;
    font-size: 14px;
    color: #232323;
    width: 100%;
    text-transform: uppercase;
}

/* Range Slider Styles (Updated) */
.style-range {
    -webkit-appearance: none;
    width: 100%;
    height: 2px;
    background: #E0E0E0;
    border-radius: 2px;
    outline: none;
    flex-grow: 1;
}

.style-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #007BFF;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   UPDATED SIDEBAR (Accordion Style)
   ========================================================================== */

.sb-accordion-item {
    border-bottom: 1px solid #D2DAD2;
}

.sb-accordion-header {
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Urbanist', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #6B7B6F;
    user-select: none;
    line-height: 18px;
}

.sb-accordion-header:hover {
    color: #232323;
}

#inspector-controls {
    padding: 12px 15px 0;
}

/* Arrow rotation */
.sb-accordion-header .arrow {
    transition: transform 0.2s;
}

.sb-accordion-header.active .arrow {
    transform: rotate(180deg);
}

/* Accordion Body */
.sb-accordion-body {
    display: none;
    padding-bottom: 20px;
}

.sb-accordion-body.open {
    display: block;
}

/* --- BLOCKS GRID (Updated to 1 Row) --- */
.blocks-grid-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 3 items in a row */
    gap: 12px;
    padding: 12px 15px 0;
}

#panel-style {
    padding: 12px 15px;
}

.slider-wrapper {
    display: grid;
    align-items: center;
    gap: 6px;
    grid-template-columns: 22px 1fr 38px;
}

.slider-value {
    text-align: end;
}

.draggable-item {
    background: #fff;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    padding: 15px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: grab;
    transition: all 0.2s;
    aspect-ratio: 1;
    /* Make them square */
}

.draggable-item:hover {
    border-color: #159C2A;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.draggable-item span {
    font-size: 12px;
    color: #555;
    font-weight: 500;
}

.icon-box svg {
    color: #555;
    /* Default icon color */
}

.draggable-item:hover .icon-box svg {
    color: #159C2A;
    /* Green on hover */
}

/* --- INSPECTOR INSIDE ACCORDION --- */
.empty-state-inspect {
    font-size: 13px;
    color: #999;
    text-align: center;
    padding: 20px 0;
    font-style: italic;
}

/* Adjust inspector inputs to fit tight space if needed */
.insp-group {
    margin-bottom: 15px;
}

.insp-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #555;
}

/* ==========================================================================
   INSPECTOR UI COMPONENTS (Design Match)
   ========================================================================== */

.insp-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #999;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    text-transform: uppercase;
}

/* --- Toggle Switch --- */
.flex-row-center {
    display: flex;
    align-items: center;
    gap: 10px;
}

.insp-label-inline {
    font-size: 14px;
    color: #232323;
}

.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: #159C2A;
}

input:checked+.slider:before {
    transform: translateX(16px);
}

.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- Segmented Controls (Font Weight, Alignment) --- */
.segmented-control {
    display: flex;
    background: #F2F2F2;
    padding: 2px;
    border-radius: 6px;
    width: 100%;
}

.segmented-control button {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 0;
    font-size: 13px;
    color: #555;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Urbanist', sans-serif;
    font-weight: 500;
}

.segmented-control button:hover {
    color: #000;
}

.segmented-control button.active {
    background: #fff;
    color: #232323;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.segmented-control.icon-mode button {
    display: flex;
    align-items: center;
    justify-content: center;
}

.segmented-control.icon-mode button svg {
    opacity: 0.6;
}

.segmented-control.icon-mode button.active svg {
    opacity: 1;
    color: #232323;
}

/* --- Slider Rows (Font Size, Padding) --- */
.slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.slider-row.compact {
    margin-bottom: 8px;
    /* For padding stack */
}

.icon-label {
    width: 20px;
    font-size: 14px;
    font-weight: bold;
    color: #232323;
}

.icon-label-img {
    width: 20px;
    display: flex;
    align-items: center;
}

.val-label {
    width: 35px;
    text-align: right;
    font-size: 12px;
    color: #555;
}

/* Styling the Range Input to look more like the design */
/* (Base .style-range styles were added previously, refining here) */
.style-range {
    height: 3px;
    background: #E0E0E0;
    border-radius: 2px;
}

.style-range::-webkit-slider-thumb {
    margin-top: -6px;
    /* center on track */
    background: #007BFF;
    /* Blue thumb */
    border: 2px solid #fff;
    /* White border */
    width: 14px;
    height: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* --- Color Swatch Plus Icon fix --- */
.plus-swatch svg {
    width: 10px;
    height: 10px;
}

/* TextArea refine */
.insp-textarea {
    resize: vertical;
    font-family: 'Urbanist', sans-serif;
    border-color: #E0E0E0;
    background: #fff;
}

.insp-textarea:focus {
    border-color: #159C2A;
}

/* --- Inspector Inputs Layout --- */
.insp-half-row {
    display: flex;
    gap: 15px;
}

.insp-half-col {
    flex: 1;
    position: relative;
}

.input-wrapper-suffix {
    position: relative;
}

.input-suffix {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 12px;
    pointer-events: none;
}

.insp-input-with-suffix {
    padding-right: 30px;
    /* Space for 'px' */
}

/* ==========================================================================
   CANVAS CONTROLS (Sorting & Quick Add)
   ========================================================================== */

/* 1. Remove spacing between blocks */
.canvas-block {
    margin-bottom: 0 !important;
    /* Force no margin */
    position: relative;
    /* Context for absolute controls */
    border: 2px solid transparent;
    /* Placeholder for selection border */
    transition: background-color 0.2s;
}

.canvas-block.selected {
    border-color: #159C2A;
    z-index: 10;
    /* Bring on top to show controls */
}

/* 2. Drag Handle (Right Side) */
.block-handle {
    position: absolute;
    right: -24px;
    /* Move outside the block */
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 40px;
    background-color: #999;
    border-radius: 0 4px 4px 0;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.canvas-block.selected .block-handle {
    opacity: 1;
    pointer-events: auto;
}

.block-handle:active {
    cursor: grabbing;
}

/* 3. Quick Add Trigger (Bottom Left) */
.block-add-trigger {
    position: absolute;
    left: 0;
    bottom: -12px;
    /* Center on the bottom edge */
    width: 24px;
    height: 24px;
    background-color: #159C2A;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.block-add-trigger:hover {
    transform: scale(1.1);
}

.canvas-block.selected .block-add-trigger {
    opacity: 1;
    pointer-events: auto;
}

/* 4. Quick Add Dropdown Menu */
.quick-add-menu {
    position: absolute;
    top: 25px;
    /* Below the plus button */
    left: 0;
    background: white;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    width: 260px;
    /* Wider to fit 3 items */
    padding: 10px;
    z-index: 100;
    display: none;
    cursor: default;
}

.quick-add-menu.active {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.quick-add-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 5px;
    border: 1px solid #eee;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-add-item:hover {
    border-color: #159C2A;
    background-color: #F9F9F9;
}

.quick-add-item span {
    font-size: 11px;
    color: #555;
    margin-top: 5px;
    font-weight: 600;
}

.quick-add-item svg {
    color: #555;
}

.quick-add-item:hover svg {
    color: #159C2A;
}

/* Visual cue when dragging over for sort */
.canvas-block.sort-over-top {
    border-top: 2px solid #159C2A;
}

.canvas-block.sort-over-bottom {
    border-bottom: 2px solid #159C2A;
}

/* ==========================================================================
   IMPROVED DRAG & DROP UX
   ========================================================================== */

/* Стиль для элемента, который остался на странице, пока мы тащим его копию */
.canvas-block.dragging {
    opacity: 0.4;
    background-color: #f9f9f9;
    border: 2px dashed #ccc;
    box-shadow: none;
}

/* Убираем старые стили для линий, они больше не нужны */
.canvas-block.sort-over-top,
.canvas-block.sort-over-bottom {
    border-top: none;
    border-bottom: none;
}

/* Гарантируем, что контейнер имеет высоту, чтобы в него можно было бросить, даже если он пуст */
.builder-dropzone {
    min-height: 100px;
    height: auto;
    display: flex;
    flex-direction: column;
    /* Важно для вертикального списка */
}

/* ==========================================================================
   TOOLBAR FUNCTIONALITY STYLES
   ========================================================================== */

/* --- JSON Modal --- */
.json-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.json-modal-overlay.active {
    display: flex;
}

.json-modal {
    background: #fff;
    width: 600px;
    max-width: 90%;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.json-modal h3 {
    margin: 0;
    font-family: 'Urbanist', sans-serif;
    font-size: 18px;
}

.json-textarea {
    width: 100%;
    height: 300px;
    padding: 10px;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    resize: none;
    outline: none;
    background: #F9F9F9;
}

.json-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.json-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
}

.json-btn.close {
    background: #eee;
    color: #333;
}

.json-btn.copy {
    background: #159C2A;
    color: #fff;
}

/* --- Preview Mode --- */
.preview-active .canvas-block {
    cursor: default !important;
    border-color: transparent !important;
}

.preview-active .canvas-block:hover {
    box-shadow: none !important;
}

/* В режиме превью ссылки должны работать */
.preview-active a {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Скрываем контролы в превью */
.preview-active .block-handle,
.preview-active .block-add-trigger {
    display: none !important;
}

/* ==========================================================================
   IN-CANVAS CODE VIEW
   ========================================================================== */

.canvas-container.mode-code .email-paper {
    display: none !important;
}

#canvas-code-editor {
    display: none;
    width: 100%;
    height: 100%;
    min-height: 600px;
    color: #232323;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    outline: none;
    overflow: auto;
    margin: 0;
    white-space: pre-wrap;
}

.canvas-container.mode-code {
    padding: 16px;
    background-color: #F2F5F7 !important;
}

.canvas-container.mode-code #canvas-code-editor {
    display: block;
}

/* --- Custom Multi-select Dropdown (Updated Design) --- */
.custom-multiselect {
    flex-grow: 1;
    position: relative;
    font-family: 'Urbanist', sans-serif;
}

.select-box {
    /* Оставляем стили самого поля выбора без изменений, если не требовалось менять */
    width: 100%;
    height: 34px;
    border: 1px solid #D2DAD2;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    cursor: pointer;
    background: #fff;
    user-select: none;
    font-size: 14px;
}

.select-box .arrow {
    transition: transform 0.2s;
}

.custom-multiselect.open .arrow {
    transform: rotate(180deg);
}

/* Dropdown Options Container */
.options-list {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background: #fff;
    z-index: 100;

    /* Новые стили контейнера */
    border-radius: 3px;
    border: 1px solid #EEEEEE;
    box-shadow: 0px 7px 20px 0px #23232326;
    padding: 0;
    /* Убираем отступы, чтобы элементы прижимались к краям */
    overflow: hidden;
    /* Чтобы border-radius работал на углах */
}

.custom-multiselect.open .options-list {
    display: block;
}

/* Option Item Style */
.option-item {
    display: flex;
    align-items: center;
    /* Вертикальное центрирование (vertical-align: middle) */
    width: 100% !important;
    height: 30px;
    /* Фиксированная высота */
    padding: 0 10px !important;
    /* Паддинги по бокам */
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s;
    box-sizing: border-box;
}

.option-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Custom Checkbox Box */
.checkmark {
    /* Переделываем с абсолютного позиционирования на Flex-элемент */
    position: relative;
    top: auto;
    left: auto;
    transform: none;

    height: 15px;
    width: 15px;
    background-color: #fff;
    border: 1px solid #C6C6C6;
    border-radius: 3px;
    flex-shrink: 0;
    /* Чтобы чекбокс не сплющивался */
    margin-right: 7px;
    /* 7 пикселей до текста */
    transition: all 0.2s;

    /* Для центрирования галочки внутри */
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-label {
    margin-left: 0;
    /* Убираем старый отступ */

    /* Текст по умолчанию */
    font-family: 'Urbanist', sans-serif;
    font-weight: 400;
    /* Regular */
    font-size: 12px;
    line-height: 100%;
    letter-spacing: 0%;
    color: #232323;
    /* Цвет текста по умолчанию */
}

/* Hover State */
.option-item:hover {
    background-color: #00800008;
}

/* Checked State - Row Background */
.option-item:has(input:checked) {
    background-color: #00800008;
}

/* Checked State - Checkbox */
.option-item input:checked~.checkmark {
    background-color: #28B028;
    border-color: #28B028;
}

/* Checked State - Checkmark Icon */
.option-item input:checked~.checkmark:after {
    content: "";
    display: block;
    background-image: url("data:image/svg+xml,%3Csvg width='8' height='7' viewBox='0 0 8 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.60195 0.210938L2.4858 5.04331L0.759195 3.41562L0.210938 4.00661L2.54922 6.21094L7.21094 0.738057L6.60195 0.210938Z' fill='white' stroke='white' stroke-width='0.3'/%3E%3C/svg%3E%0A");
    background-size: contain;
    background-repeat: no-repeat;
    width: 8px;
    height: 7px;
    /* Небольшая коррекция для визуального центра */
}

/* Checked State - Text Typography */
.option-item input:checked~.option-label {
    font-weight: 600;
    /* SemiBold */
}

.footer-details {
    display: grid;
    gap: 14px;
    max-width: 410px;
    margin: 0 auto;
    font-family: 'Urbanist', sans-serif;
}

/* --- Контакты --- */
.fd-contacts .fd-contact {
    display: flex;
    align-items: flex-start;
    gap: 3px;
    margin-bottom: 7px;
}

.fd-contact:last-child {
    margin-bottom: 0;
}

.fd-contact img {
    width: 10px;
    height: auto;
    margin-top: 1px;
}

.fd-contact p {
    margin: 0;
    font-weight: 400;
    font-size: 7.33px;
    line-height: 6.31px;
    letter-spacing: 0%;
    color: #232323;
}

.fd-contact .w500 {
    font-weight: 500;
}

/* --- Соцсети + кнопка --- */
.fd-actions {
    display: flex;
    align-items: center;
}

.fd-socials {
    display: flex;
    gap: 5px;
    margin-right: 32px;
}

.fd-socials img {
    width: 18px;
    height: auto;
    display: block;
}

.fd-apply-btn {
    font-family: 'Urbanist', sans-serif;
    font-weight: 500;
    font-size: 7.72px;
    line-height: 100%;
    text-transform: uppercase;
    letter-spacing: 0%;
    color: #fff;
    background: #159C2A;
    border: none;
    padding: 6px 17px;
    border-radius: 3px;
    cursor: pointer;
}

/* --- Дисклеймер --- */
.fd-disclaimer p {
    margin: 0;
    font-weight: 400;
    font-size: 6px;
    line-height: 100%;
    letter-spacing: 0%;
    color: #232323;
}

/* --- Updated Toolbar Layout --- */
.builder-toolbar {
    /* Обновляем, чтобы разнести влево и вправо */
    justify-content: space-between;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* View Toggles (Segmented Control style) */
.view-toggles {
    display: flex;
    background: #F2F2F2;
    padding: 2px;
    border-radius: 6px;
    margin-right: 10px;
}

.view-btn {
    border: none;
    background: transparent;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    color: #808080;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.view-btn.active {
    background: #fff;
    color: #232323;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.view-btn:hover:not(.active) {
    color: #555;
}

/* --- Mobile View in Canvas --- */
.email-paper.mobile-view {
    max-width: 375px !important;
    /* Стандартная ширина мобильного */
    transition: max-width 0.3s ease;
}

/* --- JSON Import Modal (Styled like DatePicker) --- */
.json-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.json-modal-overlay.active {
    display: flex;
}

.json-modal-box {
    background: #fff;
    width: 500px;
    border-radius: 6px;
    padding: 24px;
    box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.15);
    font-family: 'Urbanist', sans-serif;
    display: flex;
    flex-direction: column;
}

.json-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.json-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #232323;
}

.json-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.json-modal-body p {
    font-size: 13px;
    color: #555;
    margin-bottom: 10px;
    line-height: 1.4;
}

.json-modal-body textarea {
    width: 100%;
    height: 200px;
    border: 1px solid #D2DAD2;
    border-radius: 3px;
    padding: 10px;
    font-family: monospace;
    font-size: 12px;
    resize: none;
    outline: none;
    color: #232323;
}

.json-modal-body textarea:focus {
    border-color: #159C2A;
}

.json-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-cancel {
    background: transparent;
    border: 1px solid transparent;
    color: #555;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 16px;
    font-family: 'Urbanist', sans-serif;
}

.btn-import {
    background: #159C2A;
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: 3px;
    padding: 8px 20px;
    cursor: pointer;
    font-family: 'Urbanist', sans-serif;
}

.btn-import:hover {
    background-color: #128323;
}