.json-preview {
    margin-top: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    overflow: visible;
    position: relative;
}

.json-container {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    position: relative;
    overflow: visible;
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

.json-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.json-title-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.json-title-left h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

/* Tooltip styles */
.tooltip-containerX {
    position: relative;
    display: inline-block;
}

.info-icon {
    font-size: 12px;
    cursor: help;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.info-icon:hover {
    opacity: 1;
}

.tooltip-textX {
    visibility: hidden;
    opacity: 0;
    background-color: #333;
    color: white;
    text-align: left;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.4;
    width: 280px;

    /* Positioning */
    position: absolute;
    z-index: 9999;
    top: 125%;
    left: 50%;
    margin-left: -140px;

    /* Transition */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tooltip-textX::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent #333 transparent;
}

.tooltip-containerX:hover .tooltip-textX {
    visibility: visible;
    opacity: 1;
}

.copy-json-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.copy-json-btn:hover {
    background: #5a67d8;
}

.json-content {
    flex: 1;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: #f8fafc;
    padding: 0.75rem;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.json-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.json-content code {
    font-size: 0.95rem;
    line-height: 1.4;
    color: #374151;
}

/* Layout principal con grid de 12 columnas */
.rcs-builder-content {
    display: grid;
    grid-template-columns: repeat(12, 1fr); /* 12 columnas */
    gap: 1rem;
    padding: 1rem;
    flex: 1;
    min-height: 0;
    
}

.rcs-builder-container {
    background: transparent;
}

/* Column spans estilo Bootstrap */
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-12 { grid-column: span 12; }

.rcs-builder-header {
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.template-info h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
    font-weight: 600;
}

.template-type {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Sidebar */
.sidebar {
    flex-shrink: 0;
}

/* Main area usa grid interno (toolbar arriba, canvas abajo) */
.main-area {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 1rem;
    min-width: 0;
}

/* Toolbar */
.toolbar {
    flex-shrink: 0;
}

/* Canvas */
.canvas-container {
    flex: 1;
    min-height: 0;
}

/* Vista previa */
.preview-area {
    width: 420px; /* más ancho que 320px */
    flex-shrink: 0;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start; /* pegado arriba */
    padding-top: 0.5rem;
}

/* Opciones de columnas internas en componentes */
.sidebar-5-columns ::deep .components-grid,
.sidebar-5-columns ::deep .sidebar-grid,
.sidebar-5-columns ::deep .component-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.canvas-3-columns ::deep .canvas-grid,
.canvas-3-columns ::deep .design-grid,
.canvas-3-columns ::deep .drop-zone-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .preview-area {
        display: none;
    }
    .sidebar-5-columns ::deep .components-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .rcs-builder-content {
        grid-template-columns: 1fr; /* 1 columna */
    }
    .sidebar, .main-area, .preview-area {
        grid-column: span 1;
        width: 100%;
    }
    .sidebar-5-columns ::deep .components-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .canvas-3-columns ::deep .canvas-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .sidebar-5-columns ::deep .components-grid {
        grid-template-columns: 1fr;
    }
}