/* BuilderPro - Page Builder Styles */

/* ===== ADMIN BUILDER ===== */
#bp-builder-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 20px 0;
}

#bp-builder-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #1e293b;
    border-radius: 6px 6px 0 0;
    flex-wrap: wrap;
}

#bp-builder-toolbar button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

#bp-add-section {
    background: #6366f1;
    color: #fff;
}
#bp-add-section:hover { background: #4f46e5; }

#bp-preview-btn {
    background: #0ea5e9;
    color: #fff;
}
#bp-preview-btn:hover { background: #0284c7; }

#bp-save-builder {
    background: #10b981;
    color: #fff;
    margin-left: auto;
}
#bp-save-builder:hover { background: #059669; }

#bp-builder-canvas {
    border: 1px solid #e2e8f0;
    border-top: none;
    min-height: 400px;
    background: #f8fafc;
    padding: 16px;
}

/* Sections */
.bp-builder-section {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.bp-builder-section:hover { border-color: #6366f1; }

.bp-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    cursor: grab;
}
.bp-section-header:active { cursor: grabbing; }

.bp-section-label {
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    flex: 1;
}

.bp-section-actions { display: flex; gap: 6px; }
.bp-section-actions button,
.bp-row-actions button,
.bp-module-actions button {
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    color: #374151;
    transition: all 0.15s;
}
.bp-section-actions button:hover,
.bp-row-actions button:hover,
.bp-module-actions button:hover {
    background: #f3f4f6;
}
.bp-btn-delete:hover { background: #fef2f2 !important; border-color: #ef4444 !important; color: #ef4444 !important; }

/* Rows */
.bp-builder-row {
    display: grid;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px dashed #e2e8f0;
}
.bp-builder-row:last-child { border-bottom: none; }
.bp-row-cols-1 { grid-template-columns: 1fr; }
.bp-row-cols-2 { grid-template-columns: 1fr 1fr; }
.bp-row-cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.bp-row-cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.bp-row-cols-13 { grid-template-columns: 1fr 3fr; }
.bp-row-cols-31 { grid-template-columns: 3fr 1fr; }

.bp-row-header {
    display: flex;
    align-items: center;
    gap: 6px;
    grid-column: 1 / -1;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 4px;
}
.bp-row-label { font-size: 11px; color: #6b7280; font-weight: 500; flex: 1; }
.bp-row-actions { display: flex; gap: 4px; }

/* Columns */
.bp-builder-column {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 4px;
    padding: 10px;
    min-height: 80px;
    transition: border-color 0.2s, background 0.2s;
}
.bp-builder-column.drag-over {
    border-color: #6366f1;
    background: #eef2ff;
}
.bp-col-empty {
    color: #9ca3af;
    font-size: 12px;
    text-align: center;
    padding: 16px 8px;
    pointer-events: none;
}

/* Modules */
.bp-builder-module {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: grab;
    transition: box-shadow 0.2s;
}
.bp-builder-module:active { cursor: grabbing; }
.bp-builder-module:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.bp-builder-module.dragging { opacity: 0.5; }

.bp-module-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.bp-module-icon { font-size: 16px; }
.bp-module-type {
    font-size: 11px;
    font-weight: 600;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex: 1;
}
.bp-module-actions { display: flex; gap: 4px; }
.bp-module-preview {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Section/Row add buttons */
.bp-add-row-btn, .bp-add-module-btn {
    display: block;
    width: 100%;
    padding: 8px;
    border: 1px dashed #cbd5e1;
    border-radius: 4px;
    background: transparent;
    color: #6b7280;
    font-size: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    margin-top: 8px;
}
.bp-add-row-btn:hover, .bp-add-module-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #eef2ff;
}

/* Empty canvas */
.bp-canvas-empty {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}
.bp-canvas-empty h3 { font-size: 18px; color: #374151; margin-bottom: 8px; }
.bp-canvas-empty p { font-size: 14px; margin-bottom: 20px; }
.bp-canvas-empty button {
    padding: 10px 24px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

/* Modal */
.bp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}
.bp-modal-overlay.active { display: flex; }

.bp-modal {
    background: #fff;
    border-radius: 8px;
    width: 620px;
    max-width: 95vw;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.bp-modal-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: #1e293b;
    color: #fff;
}
.bp-modal-title { font-size: 16px; font-weight: 600; flex: 1; }
.bp-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.bp-modal-close:hover { opacity: 0.7; }

.bp-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.bp-form-group { margin-bottom: 16px; }
.bp-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}
.bp-form-group input[type="text"],
.bp-form-group input[type="url"],
.bp-form-group input[type="number"],
.bp-form-group input[type="color"],
.bp-form-group select,
.bp-form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    color: #374151;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.bp-form-group input:focus,
.bp-form-group select:focus,
.bp-form-group textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}
.bp-form-group textarea { resize: vertical; min-height: 100px; }
.bp-form-group input[type="color"] { height: 38px; padding: 2px 6px; }

.bp-form-section {
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 20px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f1f5f9;
}

.bp-modal-footer {
    display: flex;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    justify-content: flex-end;
}
.bp-btn-cancel {
    padding: 8px 20px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
}
.bp-btn-cancel:hover { background: #f3f4f6; }
.bp-btn-save {
    padding: 8px 24px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}
.bp-btn-save:hover { background: #4f46e5; }

/* Column chooser modal */
.bp-col-chooser {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
}
.bp-col-option {
    padding: 12px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    font-size: 12px;
    color: #374151;
    transition: all 0.15s;
    background: #fff;
}
.bp-col-option:hover, .bp-col-option.selected {
    border-color: #6366f1;
    background: #eef2ff;
    color: #6366f1;
}
.bp-col-visual {
    display: flex;
    gap: 3px;
    height: 24px;
    margin-bottom: 6px;
    justify-content: center;
    align-items: stretch;
}
.bp-col-visual span {
    display: block;
    background: currentColor;
    border-radius: 2px;
    opacity: 0.3;
    flex: 1;
}

/* Module picker */
.bp-module-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.bp-module-pick-item {
    padding: 14px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
}
.bp-module-pick-item:hover {
    border-color: #6366f1;
    background: #eef2ff;
}
.bp-module-pick-icon { font-size: 22px; display: block; margin-bottom: 6px; }
.bp-module-pick-label { font-size: 12px; color: #374151; font-weight: 500; }

/* Lightbox */
.bp-lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 999999;
    align-items: center;
    justify-content: center;
}
.bp-lightbox-overlay.active { display: flex; }
.bp-lightbox-inner { position: relative; max-width: 90vw; max-height: 90vh; }
.bp-lightbox-img { max-width: 90vw; max-height: 85vh; object-fit: contain; display: block; }
.bp-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
}
.bp-lightbox-prev, .bp-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 32px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bp-lightbox-prev { left: -56px; }
.bp-lightbox-next { right: -56px; }
.bp-lightbox-prev:hover, .bp-lightbox-next:hover { background: rgba(255,255,255,0.4); }

/* Drag-and-drop indicator */
.bp-drop-indicator {
    height: 3px;
    background: #6366f1;
    border-radius: 2px;
    margin: 4px 0;
    display: none;
}
.bp-drop-indicator.visible { display: block; }

/* Notifications */
.bp-notice {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: #1e293b;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    z-index: 999999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s;
}
.bp-notice.show { transform: translateY(0); opacity: 1; }
.bp-notice.success { background: #10b981; }
.bp-notice.error { background: #ef4444; }
