/**
 * Example — кастомные стили поверх Bootstrap 5.
 */

.content a:not(.btn) {
    text-underline-offset: 0.15em;
}

/**
 * Email Builder стили - Современный дизайн 2026
 */
.email-builder-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    background: #f5f6fa;
}

.builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e1e8ed;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.builder-header-left {
    flex: 1;
    max-width: 300px;
}

.builder-title-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    padding: 4px 0;
}

.builder-title-input:focus {
    outline: none;
    border-bottom: 2px solid #0d6efd;
}

.builder-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.builder-subject-input {
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    width: 250px;
    transition: all 0.2s;
}

.builder-subject-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid #e1e8ed;
    background: #ffffff;
    color: #495057;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f8f9fa;
    border-color: #0d6efd;
    color: #0d6efd;
    transform: translateY(-1px);
}

.btn-icon.btn-primary {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

.btn-icon.btn-primary:hover {
    background: #0b5ed7;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.builder-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.builder-sidebar {
    width: 280px;
    background: #ffffff;
    border-right: 1px solid #e1e8ed;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.builder-sidebar-right {
    border-right: none;
    border-left: 1px solid #e1e8ed;
    display: none;
}

.builder-sidebar-right.active {
    display: flex;
}

.builder-sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e1e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafbfc;
}

.builder-sidebar-header h6 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    margin: 0;
}

.btn-close-sidebar {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-close-sidebar:hover {
    background: #e9ecef;
    color: #495057;
}

.builder-elements-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
}

.builder-element-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    background: #ffffff;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    min-height: 90px;
}

.builder-element-btn:hover {
    border-color: #0d6efd;
    background: #f0f7ff;
    color: #0d6efd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.15);
}

.builder-element-btn i {
    font-size: 24px;
    margin-bottom: 8px;
}

.builder-element-btn span {
    font-size: 12px;
    font-weight: 500;
}

.builder-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f5f6fa;
}

.builder-canvas {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #ffffff;
    margin: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-height: 400px;
}

.builder-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    color: #adb5bd;
    text-align: center;
}

.builder-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.builder-empty-state p {
    margin: 0;
    font-size: 14px;
}

.builder-block {
    position: relative;
    margin-bottom: 16px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: #ffffff;
    transition: all 0.2s;
    cursor: pointer;
}

.builder-block:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
}

.builder-block.selected {
    border-color: #0d6efd !important;
    border-width: 3px !important;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.3), 0 4px 12px rgba(13, 110, 253, 0.2) !important;
    background: #f0f7ff !important;
    position: relative;
}

.builder-block.selected::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 2px solid #0d6efd;
    border-radius: 8px;
    pointer-events: none;
    z-index: -1;
}

.builder-block-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.builder-block:hover .builder-block-actions,
.builder-block.selected .builder-block-actions {
    opacity: 1;
}

.builder-block-action {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: #ffffff;
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.builder-block-action:hover {
    background: #0d6efd;
    color: #ffffff;
    transform: scale(1.1);
}

.builder-block-action.delete:hover {
    background: #dc3545;
}

.builder-block-gear {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: #ffffff;
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    opacity: 0;
    z-index: 10;
}

.builder-block:hover .builder-block-gear,
.builder-block.selected .builder-block-gear {
    opacity: 1;
}

.builder-block-gear:hover {
    background: #0d6efd;
    color: #ffffff;
    transform: rotate(90deg);
}

.builder-block-content {
    padding: 20px;
}

.builder-block-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.builder-block-content a {
    text-decoration: none;
}

.builder-settings-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.builder-settings-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #adb5bd;
    text-align: center;
}

.builder-settings-empty i {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.builder-settings-empty p {
    margin: 0;
    font-size: 13px;
}

/* Визуальные кнопки выравнивания */
.align-buttons {
    display: flex;
    gap: 4px;
    background: #f8f9fa;
    padding: 4px;
    border-radius: 6px;
}

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

.align-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.align-btn.active {
    background: #0d6efd;
    color: #ffffff;
}

/* Улучшенные контролы */
.builder-setting-group {
    margin-bottom: 20px;
}

.builder-setting-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    margin-bottom: 8px;
}

.builder-setting-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.builder-setting-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.builder-color-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.builder-color-input {
    width: 50px;
    height: 40px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    cursor: pointer;
}

.builder-color-text {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    font-size: 14px;
    font-family: monospace;
}

/* Управление колонками */
.columns-manager {
    margin-top: 12px;
}

.column-item {
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    background: #fafbfc;
}

.column-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.column-item-title {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
}

.column-item-actions {
    display: flex;
    gap: 4px;
}

.column-item-action {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.column-item-action:hover {
    background: #e9ecef;
    color: #495057;
}

.add-column-btn {
    width: 100%;
    padding: 10px;
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.add-column-btn:hover {
    border-color: #0d6efd;
    color: #0d6efd;
    background: #f0f7ff;
}

.add-column-inline-btn {
    width: 100%;
    padding: 12px;
    border: 2px dashed #0d6efd;
    border-radius: 6px;
    background: #f0f7ff;
    color: #0d6efd;
    font-weight: 500;
    transition: all 0.2s;
}

.add-column-inline-btn:hover {
    background: #0d6efd;
    color: #ffffff;
    border-color: #0d6efd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

/* Drag and Drop стили */
.builder-drag-handle {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: move;
    color: #6c757d;
    opacity: 0;
    transition: all 0.2s;
    z-index: 10;
}

.builder-block:hover .builder-drag-handle,
.builder-block.selected .builder-drag-handle {
    opacity: 1;
}

.builder-drag-handle:hover {
    background: #0d6efd;
    color: #ffffff;
    border-color: #0d6efd;
}

.builder-block.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.builder-block.drag-over {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.3);
}

.builder-row {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 12px;
    background: #f8f9fa;
    min-height: 100px;
    transition: all 0.2s;
}

.builder-row.selected {
    border-color: #0d6efd !important;
    border-style: solid !important;
    border-width: 3px !important;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.3), 0 4px 12px rgba(13, 110, 253, 0.2) !important;
    background: #f0f7ff !important;
}

.builder-row-empty {
    text-align: center;
    padding: 40px 20px;
    color: #adb5bd;
    font-size: 14px;
}

.builder-column {
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: #ffffff;
    min-height: 80px;
    position: relative;
}

.builder-column:hover {
    border-color: #adb5bd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.builder-column.selected {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

/* Колонки внутри ряда */
.builder-row .col-md-1 > .builder-block,
.builder-row .col-md-2 > .builder-block,
.builder-row .col-md-3 > .builder-block,
.builder-row .col-md-4 > .builder-block,
.builder-row .col-md-5 > .builder-block,
.builder-row .col-md-6 > .builder-block,
.builder-row .col-md-7 > .builder-block,
.builder-row .col-md-8 > .builder-block,
.builder-row .col-md-9 > .builder-block,
.builder-row .col-md-10 > .builder-block,
.builder-row .col-md-11 > .builder-block,
.builder-row .col-md-12 > .builder-block {
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: #ffffff;
    min-height: 60px;
    margin: 4px;
}

.builder-row .col-md-1 > .builder-block:hover,
.builder-row .col-md-2 > .builder-block:hover,
.builder-row .col-md-3 > .builder-block:hover,
.builder-row .col-md-4 > .builder-block:hover,
.builder-row .col-md-5 > .builder-block:hover,
.builder-row .col-md-6 > .builder-block:hover,
.builder-row .col-md-7 > .builder-block:hover,
.builder-row .col-md-8 > .builder-block:hover,
.builder-row .col-md-9 > .builder-block:hover,
.builder-row .col-md-10 > .builder-block:hover,
.builder-row .col-md-11 > .builder-block:hover,
.builder-row .col-md-12 > .builder-block:hover {
    border-color: #adb5bd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.builder-row .col-md-1 > .builder-block.selected,
.builder-row .col-md-2 > .builder-block.selected,
.builder-row .col-md-3 > .builder-block.selected,
.builder-row .col-md-4 > .builder-block.selected,
.builder-row .col-md-5 > .builder-block.selected,
.builder-row .col-md-6 > .builder-block.selected,
.builder-row .col-md-7 > .builder-block.selected,
.builder-row .col-md-8 > .builder-block.selected,
.builder-row .col-md-9 > .builder-block.selected,
.builder-row .col-md-10 > .builder-block.selected,
.builder-row .col-md-11 > .builder-block.selected,
.builder-row .col-md-12 > .builder-block.selected {
    border-color: #0d6efd !important;
    border-width: 3px !important;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.3), 0 4px 12px rgba(13, 110, 253, 0.2) !important;
    background: #f0f7ff !important;
}

/* Управление шириной колонок */
.column-width-control {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
}

.column-width-display {
    font-weight: 600;
    font-size: 16px;
    color: #495057;
    min-width: 60px;
    text-align: center;
}

.column-width-control-small {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    background: #f8f9fa;
    border-radius: 4px;
}

.column-width-display-small {
    font-weight: 600;
    font-size: 14px;
    color: #495057;
    min-width: 50px;
    text-align: center;
}

/* Ряд в настройках */
.builder-row-children {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    min-height: 60px;
}

/* Drag and Drop из сайдбара */
.builder-element-btn.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    cursor: grabbing !important;
}

.builder-element-btn {
    cursor: grab;
}

.builder-element-btn:active {
    cursor: grabbing;
}

.builder-canvas.builder-drop-zone {
    border-color: #0d6efd;
    background: #f0f7ff;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.2);
}

.builder-block.builder-drop-zone {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.3);
    position: relative;
}

.builder-block.builder-drop-zone::after {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: #0d6efd;
    border-radius: 2px;
    z-index: 100;
}

.builder-row.builder-drop-zone {
    background: #e7f3ff;
    border-color: #0d6efd;
}

/* Стили для превью в модальном окне */
#previewFrame {
    background: #ffffff;
}

/* Улучшенные стили для карточек шаблонов */
.templates-page .card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.templates-page .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Стили для панели настроек */
#settingsPanel .form-label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

#settingsPanel .form-control-sm,
#settingsPanel .form-select-sm {
    font-size: 0.875rem;
}

/* Bootstrap Icons подключены через <link> в layout */

/* Стили для ползунков (sliders) */
.slider-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.builder-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e1e8ed;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.builder-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0d6efd;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.builder-slider::-webkit-slider-thumb:hover {
    background: #0b5ed7;
    transform: scale(1.1);
}

.builder-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0d6efd;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.builder-slider::-moz-range-thumb:hover {
    background: #0b5ed7;
    transform: scale(1.1);
}

.slider-value {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.slider-unit {
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
    min-width: 20px;
}

.slider-number-input {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    font-weight: 500;
    -moz-appearance: textfield; /* Убираем стрелки в Firefox */
}

.slider-number-input::-webkit-outer-spin-button,
.slider-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none; /* Убираем стрелки в Chrome/Safari */
    margin: 0;
}

.slider-number-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.slider-unit {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}
