/* ============================================================
   Banner Maker – Frontend / Public Styles
   ============================================================ */

/* ----- Generator wrapper ----- */
.bm-generator {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
    color: #1d2327;
    box-sizing: border-box;
}
.bm-generator *,
.bm-generator *::before,
.bm-generator *::after {
    box-sizing: inherit;
}

/* ----- Controls ----- */
.bm-generator__controls {
    background: #f6f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.bm-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.bm-control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bm-label {
    font-size: 13px;
    font-weight: 600;
    color: #3c434a;
}

.bm-select,
.bm-input {
    height: 40px;
    padding: 0 12px;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    font-size: 14px;
    color: #1d2327;
    background: #fff;
    width: 100%;
    transition: border-color 0.15s;
}
.bm-select:focus,
.bm-input:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(34,113,177,0.2);
}

/* Editable fields */
.bm-editable-fields {
    border-top: 1px solid #e0e0e0;
    padding-top: 16px;
}
.bm-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 12px;
}
.bm-editable-fields__inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

/* ----- Canvas preview ----- */
.bm-generator__preview {
    display: flex;
    justify-content: center;
}

.bm-canvas-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    background: #2c2c2c;
    border-radius: 8px;
    overflow: auto;          /* scroll la 100% size */
    min-height: 200px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 16px;
}

.bm-canvas-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #a7aaad;
    text-align: center;
}
.bm-canvas-placeholder .dashicons {
    font-size: 56px;
    width: 56px;
    height: 56px;
    margin-bottom: 12px;
    color: #646970;
}
.bm-canvas-placeholder p {
    margin: 0;
    font-size: 14px;
}

.bm-main-canvas {
    display: block;
    max-width: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* Loader */
.bm-canvas-loader {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #fff;
    font-size: 14px;
    border-radius: 8px;
}
.bm-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bm-spin 0.7s linear infinite;
}
@keyframes bm-spin {
    to { transform: rotate(360deg); }
}

/* ----- Action buttons ----- */
.bm-generator__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    justify-content: center;
}

.bm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
    text-decoration: none;
}
.bm-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}
.bm-btn--primary {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}
.bm-btn--primary:hover {
    background: #135e96;
    border-color: #135e96;
}
.bm-btn--secondary {
    background: #3c434a;
    color: #fff;
    border-color: #3c434a;
}
.bm-btn--secondary:hover {
    background: #1d2327;
    border-color: #1d2327;
}
.bm-btn--outline {
    background: transparent;
    color: #2271b1;
    border-color: #2271b1;
}
.bm-btn--outline:hover {
    background: #f0f6fd;
}

/* ----- Modal ----- */
.bm-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}
.bm-modal__box {
    position: relative;
    background: #fff;
    border-radius: 10px;
    padding: 0;
    width: 90%;
    max-width: 560px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    overflow: hidden;
}
.bm-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
}
.bm-modal__header h3 {
    margin: 0;
    font-size: 16px;
}
.bm-modal__close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #646970;
    line-height: 1;
    padding: 0 4px;
}
.bm-modal__close:hover { color: #d63638; }
.bm-modal__body {
    padding: 20px;
}
.bm-modal__body p { margin: 0 0 16px; }
.bm-modal__body .bm-label { display: block; margin-bottom: 6px; }

.bm-code-block {
    display: flex;
    align-items: center;
    background: #f6f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 16px;
    gap: 10px;
}
.bm-code-block code {
    flex: 1;
    font-size: 12px;
    color: #3c434a;
    word-break: break-all;
}
.bm-copy-code {
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}
.bm-copy-code:hover { background: #135e96; }

/* ----- Embed mode ----- */
.bm-generator--embed .bm-generator__controls,
.bm-generator--embed .bm-generator__actions {
    display: none;
}
.bm-generator--embed .bm-canvas-wrapper {
    border-radius: 0;
    background: transparent;
}

/* ----- Responsive ----- */
@media (max-width: 640px) {
    .bm-controls-grid {
        grid-template-columns: 1fr;
    }
    .bm-generator__actions {
        flex-direction: column;
        align-items: stretch;
    }
    .bm-btn {
        justify-content: center;
    }
}
