/* PostForge e-posta tasarimcisi — editor arayuzu */
.eb {
    --eb-border: var(--bs-border-color, #dee2e6);
    --eb-panel: var(--bs-body-bg, #fff);
    --eb-muted: var(--bs-secondary-color, #6c757d);
    --eb-accent: var(--bs-primary, #0d6efd);
    --eb-stage: #e9ecf1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 230px);
    min-height: 640px;
    border: 1px solid var(--eb-border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--eb-panel);
}

[data-bs-theme="dark"] .eb { --eb-stage: #1b1f24; }

/* Ust arac cubugu */
.eb-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--eb-border);
    background: var(--eb-panel);
    flex-wrap: wrap;
}
.eb-topbar-group { display: flex; align-items: center; gap: 2px; position: relative; }
.eb-topbar-group + .eb-topbar-group { padding-left: 8px; border-left: 1px solid var(--eb-border); }
.eb-topbar-spacer { flex: 1; }
.eb-topbar-spacer + .eb-topbar-group { border-left: 0; }

.eb-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .12s, color .12s, border-color .12s;
}
.eb-tool:hover:not(:disabled) { background: var(--bs-tertiary-bg, #f1f3f5); }
.eb-tool:disabled { opacity: .35; cursor: default; }
.eb-tool.is-active { background: rgba(var(--bs-primary-rgb, 13, 110, 253), .12); color: var(--eb-accent); }
.eb-tool-text { padding: 0 10px; }
.eb-tool-danger:hover:not(:disabled) { background: rgba(var(--bs-danger-rgb, 220, 53, 69), .12); color: var(--bs-danger, #dc3545); }

.eb-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 8px;
    z-index: 40;
    display: none;
    min-width: 280px;
    padding: 6px;
    border: 1px solid var(--eb-border);
    border-radius: 10px;
    background: var(--eb-panel);
    box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
}
.eb-menu.is-open { display: block; }
.eb-menu-item {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.eb-menu-item:hover { background: var(--bs-tertiary-bg, #f1f3f5); }
.eb-menu-item code { font-size: 12px; }

/* Govde: palet | tuval | ozellikler */
.eb-body {
    display: grid;
    grid-template-columns: 216px minmax(0, 1fr) 300px;
    flex: 1;
    min-height: 0;
}
.eb-palette, .eb-inspector {
    overflow-y: auto;
    padding: 14px;
    background: var(--eb-panel);
}
.eb-palette { border-right: 1px solid var(--eb-border); }
.eb-inspector { border-left: 1px solid var(--eb-border); }

.eb-panel-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.eb-panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.eb-panel-hint { font-size: 12px; color: var(--eb-muted); margin: 0 0 12px; }
.eb-hint-box { padding: 10px 12px; border-radius: 8px; background: var(--bs-tertiary-bg, #f1f3f5); }
.eb-link { border: 0; background: none; padding: 0; color: var(--eb-accent); font-size: 12px; cursor: pointer; }

.eb-palette-group + .eb-palette-group { margin-top: 14px; }
.eb-palette-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--eb-muted); margin-bottom: 6px; }
.eb-palette-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.eb-palette-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px 10px;
    border: 1px solid var(--eb-border);
    border-radius: 10px;
    background: var(--eb-panel);
    color: inherit;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    cursor: grab;
    transition: border-color .12s, box-shadow .12s, transform .12s;
}
.eb-palette-item:hover { border-color: var(--eb-accent); box-shadow: 0 4px 12px rgba(15, 23, 42, .08); transform: translateY(-1px); }
.eb-palette-item:active { cursor: grabbing; }
.eb-palette-item { user-select: none; }
.eb-palette-item:focus-visible { outline: 2px solid var(--eb-accent); outline-offset: 2px; }
.eb-palette-item svg { color: var(--eb-accent); }

/* Tuval */
.eb-stage { position: relative; min-width: 0; min-height: 0; background: var(--eb-stage); }
.eb-canvas {
    height: 100%;
    overflow-y: auto;
    padding: 28px 16px 80px;
    transition: background-color .2s;
}
.eb-mail {
    margin: 0 auto;
    min-height: 240px;
    overflow: hidden;
    box-shadow: 0 6px 28px rgba(15, 23, 42, .12);
    transition: width .2s;
}
.eb-canvas.is-mobile .eb-mail { width: 375px !important; max-width: 100%; border-radius: 18px !important; }

/* E-posta icerigini bootstrap varsayilanlarindan ayir: istemcilerdeki gorunume yaklas */
.eb-mail, .eb-mail * { box-sizing: content-box; }
.eb-mail table { border-collapse: collapse; }
.eb-mail img { vertical-align: top; }
.eb-mail a { color: var(--eb-link, #2563eb); }

/* Mobil gorunum: derlenmis HTML'deki media query'lerin tuval karsiligi */
.eb-canvas.is-mobile .pf-col { display: block !important; width: 100% !important; max-width: 100% !important; padding: 0 0 24px 0 !important; }
.eb-canvas.is-mobile .pf-pad { padding-left: 20px !important; padding-right: 20px !important; }
.eb-canvas.is-mobile .pf-col img { width: 100% !important; height: auto !important; }

.eb-blocks { min-height: 240px; }
.eb-empty {
    margin: 24px;
    padding: 56px 24px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    color: #64748b;
    font: 500 14px/1.5 system-ui, sans-serif;
    text-align: center;
}

.eb-block { position: relative; outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .1s; }
.eb-block:hover { outline-color: rgba(var(--bs-primary-rgb, 13, 110, 253), .45); }
.eb-block.is-selected { outline-color: var(--eb-accent); z-index: 2; }
.eb-block.is-dragging { opacity: .4; }
.eb-block-empty { padding: 16px; color: #94a3b8; font: 13px system-ui, sans-serif; text-align: center; }

.eb-block-label {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3;
    display: none;
    padding: 2px 8px;
    border-radius: 0 0 6px 0;
    background: var(--eb-accent);
    color: #fff;
    font: 600 11px/1.6 system-ui, sans-serif;
    pointer-events: none;
}
.eb-block:hover .eb-block-label, .eb-block.is-selected .eb-block-label { display: block; }
.eb-block:not(.is-selected):hover .eb-block-label { background: rgba(var(--bs-primary-rgb, 13, 110, 253), .75); }

.eb-block-tools {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 4;
    display: none;
    gap: 2px;
    padding: 3px;
    border-radius: 9px;
    background: #fff;
    color: #1f2937;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .18);
}
.eb-block.is-selected .eb-block-tools { display: flex; }
.eb-block-tools .eb-tool { min-width: 28px; height: 28px; }
.eb-block-tools .eb-tool:hover { background: #f1f5f9; }
/* Metin blogunda ust kenari Quill arac cubugu kullanir: blok araclari alta, etiket gizli */
.eb-block.is-selected[data-type="text"] .eb-block-tools { top: auto; bottom: 4px; }
.eb-block.is-selected[data-type="text"] .eb-block-label { display: none; }
.eb-block.is-selected[data-type="text"] .eb-block-content { padding-bottom: 36px; }
.eb-handle { cursor: grab; }
.eb-handle:active { cursor: grabbing; }

.eb-block [data-eb-inline] { outline: none; cursor: text; }
.eb-block.is-selected [data-eb-inline]:hover { box-shadow: inset 0 0 0 1px rgba(var(--bs-primary-rgb, 13, 110, 253), .35); }
.eb-block.is-selected [data-eb-inline]:focus { box-shadow: inset 0 0 0 2px rgba(var(--bs-primary-rgb, 13, 110, 253), .5); border-radius: 2px; }

/* Satir ici Quill metin editoru */
.eb-block .ql-toolbar.ql-snow {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0 0 8px;
    padding: 4px 6px;
    border: 1px solid var(--eb-border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .12);
    font-family: system-ui, sans-serif;
}
.eb-block .ql-container.ql-snow { border: 0; font-family: inherit; font-size: inherit; }
.eb-block .ql-editor { padding: 0; min-height: 1.6em; line-height: inherit; color: inherit; overflow: visible; }
.eb-block .ql-editor p, .eb-block .ql-editor ol, .eb-block .ql-editor ul { margin: 0 0 12px; }
.eb-block .ql-editor > :last-child { margin-bottom: 0; }
.eb-block .ql-editor ol, .eb-block .ql-editor ul { padding-left: 24px; }
.eb-block .ql-editor li { padding-left: 0; }
.eb-block .ql-editor a { color: var(--eb-link, #2563eb); }
.eb-block .ql-tooltip { z-index: 10; }

.eb-drop-indicator {
    height: 4px;
    margin: -2px 12px;
    border-radius: 4px;
    background: var(--eb-accent);
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb, 13, 110, 253), .2);
    position: relative;
    z-index: 6;
}

.eb-toast {
    position: absolute;
    left: 50%;
    bottom: 18px;
    z-index: 20;
    max-width: 90%;
    padding: 8px 14px;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 8px);
    transition: opacity .18s, transform .18s;
}
.eb-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Ozellik paneli formu */
.eb-form { display: flex; flex-direction: column; gap: 12px; }
.eb-section {
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--eb-border);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--eb-muted);
}
.eb-form > .eb-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.eb-label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 12px; font-weight: 600; }
.eb-range-value, .eb-counter { font-weight: 500; color: var(--eb-muted); font-variant-numeric: tabular-nums; }
.eb-help { margin-top: 4px; font-size: 11px; line-height: 1.4; color: var(--eb-muted); }
.eb-field .form-range { display: block; }
.eb-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.eb-thumb { display: block; max-width: 100%; max-height: 90px; margin-top: 6px; border-radius: 6px; border: 1px solid var(--eb-border); object-fit: contain; background: repeating-conic-gradient(#f1f5f9 0 25%, #fff 0 50%) 0 / 12px 12px; }
.eb-field-toggle { margin: 0; padding-left: 2.5em; }

.eb-color-row { display: flex; align-items: center; gap: 6px; }
.eb-color { width: 34px; height: 31px; padding: 2px; border: 1px solid var(--eb-border); border-radius: 6px; background: transparent; cursor: pointer; flex: none; }
.eb-hex { font-family: ui-monospace, monospace; text-transform: lowercase; }
.eb-hex::placeholder { font-family: var(--bs-body-font-family); text-transform: none; }
.eb-chip {
    flex: none;
    padding: 4px 8px;
    border: 1px solid var(--eb-border);
    border-radius: 999px;
    background: transparent;
    color: var(--eb-muted);
    font-size: 11px;
    cursor: pointer;
}
.eb-chip.is-active { border-color: var(--eb-accent); color: var(--eb-accent); background: rgba(var(--bs-primary-rgb, 13, 110, 253), .08); }

.eb-segment { display: inline-flex; border: 1px solid var(--eb-border); border-radius: 8px; overflow: hidden; }
.eb-segment-btn { padding: 5px 12px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.eb-segment-btn + .eb-segment-btn { border-left: 1px solid var(--eb-border); }
.eb-segment-btn.is-active { background: rgba(var(--bs-primary-rgb, 13, 110, 253), .12); color: var(--eb-accent); }

/* Duyarli yerlesim */
@media (max-width: 1399.98px) {
    .eb-body { grid-template-columns: 188px minmax(0, 1fr) 272px; }
}
@media (max-width: 991.98px) {
    .eb { height: auto; min-height: 0; }
    .eb-body { display: flex; flex-direction: column; }
    .eb-palette { border-right: 0; border-bottom: 1px solid var(--eb-border); }
    .eb-palette-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
    .eb-canvas { height: auto; max-height: 75vh; }
    .eb-inspector { border-left: 0; border-top: 1px solid var(--eb-border); }
}
