/* UI Components */

/* Toggle button */
.gbn-toggle-wrapper {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 90000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.gbn-toggle-btn {
    appearance: none;
    border: none;
    border-radius: 999px;
    background: #111827;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 10px 18px;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.gbn-toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.22);
}

.gbn-toggle-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.12), 0 10px 28px rgba(15, 23, 42, 0.24);
}

.gbn-toggle-btn[data-gbn-state='on'] {
    background: #1d8ff1;
    box-shadow: 0 16px 38px rgba(29, 143, 241, 0.28);
}

.gbn-toggle-secondary {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 200px;
}

.gbn-secondary-btn {
    appearance: none;
    border: none;
    border-radius: 8px;
    background: #ffffff;
    color: #111827;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 12px;
    text-align: right;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.gbn-secondary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16);
}

.gbn-secondary-btn[disabled],
.gbn-toggle-wrapper[data-enabled='0'] .gbn-secondary-btn {
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

/* Controls Group */
.gbn-controls-group {
    position: absolute;
    top: 8px;
    right: 8px;
    display: none;
    align-items: center;
    gap: 4px; /* Reduced gap */
    z-index: 20;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;

    /* Dock-like style */
    padding: 3px 6px; /* Reduced padding */
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Principal (Blue) Theme */
.gbn-controls-principal {
    background: rgba(29, 143, 241, 0.95);
    border-color: rgba(29, 143, 241, 0.2);
}

.gbn-controls-principal .gbn-config-btn,
.gbn-controls-principal .gbn-add-btn,
.gbn-controls-principal .gbn-delete-btn {
    color: #fff;
}

.gbn-controls-principal .gbn-config-btn:hover,
.gbn-controls-principal .gbn-add-btn:hover,
.gbn-controls-principal .gbn-delete-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Secundario (Orange) Theme */
.gbn-controls-secundario {
    background: rgba(245, 158, 11, 0.95);
    border-color: rgba(245, 158, 11, 0.2);
    right: auto;
    left: 8px;
}

.gbn-controls-secundario .gbn-config-btn,
.gbn-controls-secundario .gbn-add-btn,
.gbn-controls-secundario .gbn-delete-btn {
    color: #fff;
}

.gbn-controls-secundario .gbn-config-btn:hover,
.gbn-controls-secundario .gbn-add-btn:hover,
.gbn-controls-secundario .gbn-delete-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Centered Controls (Components) */
.gbn-controls-centered {
    position: absolute;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(107, 33, 168, 0.95); /* Purple for components */
    border-color: rgba(107, 33, 168, 0.2);
    opacity: 0;
    pointer-events: none; /* Prevent blocking when hidden */
    box-shadow: 0 0 15px rgba(107, 33, 168, 0.4); /* Glow effect */
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 100; /* Ensure it's on top */
    display: flex; /* Ensure content centers */
    align-items: center;
    justify-content: center;
    margin: 0; /* Remove any margin */
}

.gbn-active .gbn-show-controls > .gbn-controls-centered {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.gbn-controls-centered .gbn-config-btn,
.gbn-controls-centered .gbn-add-btn,
.gbn-controls-centered .gbn-delete-btn {
    color: #fff;
}

.gbn-controls-centered .gbn-config-btn:hover,
.gbn-controls-centered .gbn-add-btn:hover,
.gbn-controls-centered .gbn-delete-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.gbn-active .gbn-show-controls > .gbn-controls-group {
    opacity: 1;
    /* transform: translateY(-2px); Removed to fix centering */
}

.gbn-active .gbn-block-active > .gbn-controls-group {
    opacity: 1;
    /* transform: translateY(-2px); Removed to fix centering */
}

.gbn-config-btn,
.gbn-add-btn,
.gbn-delete-btn {
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #555; /* Default color if not themed */
    width: 20px; /* Reduced size */
    height: 20px; /* Reduced size */
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.gbn-config-btn svg,
.gbn-add-btn svg,
.gbn-delete-btn svg {
    display: block;
    width: 14px; /* Reduced icon size */
    height: 14px; /* Reduced icon size */
}

.gbn-config-btn:hover,
.gbn-add-btn:hover,
.gbn-delete-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

.gbn-config-btn:focus,
.gbn-add-btn:focus,
.gbn-delete-btn:focus {
    outline: none;
}

.gbn-config-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.4;
}

/* Botón flotante de edición */
.gbn-floating-edit {
    position: absolute;
    top: 8px;
    right: 8px;
    background: unset;
    color: var(--text, #111111);
    border: unset;
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: 0;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    align-content: center;
    justify-content: center;
    line-height: 0;
    z-index: 3;
    pointer-events: auto;
}
.glory-split:hover > .gbn-floating-edit {
    opacity: 0.85;
}

.gbn-floating-edit:hover {
    opacity: 1;
}

/* Ajustar tamaño del ícono del botón flotante para no aumentar altura */
.gbn-floating-edit svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* Botón flotante de ajustes (engranaje) */
.gbn-floating-settings {
    position: absolute;
    top: 8px;
    right: 36px; /* separarlo del botón editar */
    background: unset;
    color: var(--text, #111111);
    border: unset;
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: 0;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    z-index: 3;
    pointer-events: auto;
}
.glory-split:hover > .gbn-floating-settings {
    opacity: 0.85;
}
.gbn-floating-settings:hover {
    opacity: 1;
}

/* Acciones inline en cada título */
.gbn-title-actions {
    display: inline-flex;
    gap: 6px;
    margin-left: 8px;
    opacity: 0;
    transition: opacity 0.15s ease;
    vertical-align: middle;
    position: relative;
    z-index: 2; /* sobre el título */
    align-items: center;
}
.glory-split__item:hover .gbn-title-actions {
    opacity: 0.85;
}
.gbn-title-actions button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text, #111111);
    line-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.gbn-title-actions button:hover {
    opacity: 1;
}
.gbn-title-actions svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* Navegación de pestañas */
.gbn-tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color, #e6e6e6);
    margin-bottom: 16px;
}

.gbn-tab-btn {
    flex: 1;
    padding: 10px 12px;
    background: none;
    border: none;
    color: var(--muted, #6b6b6b);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.gbn-tab-btn.active {
    color: var(--text, #111111);
    border-bottom-color: var(--text, #111111);
}

.gbn-tab-btn:hover:not(.active) {
    color: var(--text, #111111);
    opacity: 0.8;
}

/* Clase común para botones primarios */
.gbn-btn {
    background: var(--primary-bg);
    color: var(--primary-text);
    border: none;
    padding: 6px 15px;
    cursor: pointer;
    font-family: var(--font-family);
    border-radius: 50px;
    font-size: 12px;
}

/* Utilidades (evitar estilos inline desde JS) */
.u-pointer-auto {
    pointer-events: auto;
}
.is-hidden {
    display: none !important;
}

/* Estilos para headers (encabezados de sección) */
.glory-split__item--header .glory-split__title--header {
    font-weight: bold;
    font-size: 1.1em;
}

/* Icono al final del título (solo para enlaces): inline, opacidad reducida, no ocupa varias líneas */
.glory-split__title-text {
    display: inline;
}
.glory-split__title-icon {
    display: inline-block;
    vertical-align: middle;
    opacity: 0.8;
    margin-left: 6px;
    line-height: 1;
    width: 16px;
    height: 16px;
    white-space: nowrap;
}
.glory-split__title-icon svg {
    display: block;
    width: 16px;
    height: 16px;
}

/* Theme Panel Styles */
.gbn-theme-menu {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px 0;
}

.gbn-theme-menu-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 10px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.gbn-theme-menu-btn:hover {
    border-color: #1d8ff1;
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(29, 143, 241, 0.1);
    color: #1d8ff1;
}

.gbn-theme-menu-btn svg {
    width: 24px;
    height: 24px;
    color: #1d8ff1;
    margin-bottom: 4px;
}

.gbn-theme-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.gbn-theme-back-btn {
    background: none;
    border: none;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    background: #f5f5f5;
    transition: all 0.2s ease;
}

.gbn-theme-back-btn:hover {
    background: #e0e0e0;
    color: #333;
}

.gbn-theme-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #111;
}

.gbn-field-header-separator {
    margin-top: 16px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid #f0f0f0;
}

.gbn-field-header-separator h4 {
    margin: 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1d8ff1;
    font-weight: 700;
}

/* Rich Text Editor */
.gbn-rich-text-container {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.gbn-rich-text-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px;
    background: #f9fafb;
    border-bottom: 1px solid #eee;
}

/* Contenedor de acciones de formato (B, I) */
.gbn-rich-text-format-actions {
    display: flex;
    gap: 2px;
}

.gbn-rich-text-format-actions.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.gbn-rich-text-btn {
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    color: #4b5563;
    font-size: 13px;
}

.gbn-rich-text-btn:hover {
    background: #e5e7eb;
    color: #111;
}

/* Toggle Visual/Code */
.gbn-rich-text-view-toggle {
    display: flex;
    gap: 2px;
    background: #e5e7eb;
    border-radius: 4px;
    padding: 2px;
}

.gbn-view-btn {
    background: transparent;
    border: none;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s ease;
}

.gbn-view-btn:hover {
    color: #374151;
}

.gbn-view-btn.active {
    background: #fff;
    color: #111;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Editor visual (contentEditable) */
.gbn-rich-text-visual {
    padding: 10px;
    min-height: 80px;
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    color: #374151;
}

/* Editor código (textarea) */
.gbn-rich-text-code {
    width: 100%;
    padding: 10px;
    min-height: 80px;
    font-size: 12px;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    line-height: 1.5;
    border: none;
    outline: none;
    resize: vertical;
    color: #1e293b;
    background: #f8fafc;
    box-sizing: border-box;
}

/* Custom Colors UI */
.gbn-custom-colors-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.gbn-custom-color-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    transition: border-color 0.2s ease;
}

.gbn-custom-color-item:hover {
    border-color: #d1d5db;
}

.gbn-custom-color-preview {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
}

.gbn-custom-color-preview::-webkit-color-swatch-wrapper {
    padding: 0;
}

.gbn-custom-color-preview::-webkit-color-swatch {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.gbn-custom-color-name {
    flex: 1;
    border: 1px solid transparent;
    background: transparent;
    padding: 4px 8px;
    font-size: 13px;
    color: #333;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.gbn-custom-color-name:hover {
    background: #f9fafb;
}

.gbn-custom-color-name:focus {
    background: #fff;
    border-color: #1d8ff1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(29, 143, 241, 0.1);
}

.gbn-custom-color-delete {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 18px;
    line-height: 1;
}

.gbn-custom-color-delete:hover {
    background: #fee2e2;
    color: #dc2626;
}

.gbn-add-color-form {
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gbn-add-color-row {
    display: flex;
    gap: 10px;
}

.gbn-add-color-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
}

.gbn-add-color-input:focus {
    border-color: #1d8ff1;
    outline: none;
}

.gbn-add-btn-primary {
    background: #1d8ff1;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
    width: 100%;
}

.gbn-add-btn-primary:hover {
    background: #0b76d1;
}

/* ============================================
   FASE 15: Layout Components - REFACTOR-001 (7 Dic 2025)
   ============================================
   
   ELIMINADO: Estilos base de [gloryHeader], [gloryLogo], [gloryMenu], etc.
   
   RAZON: El desarrollador define como se ven estos componentes en su CSS.
   GBN solo aplica cambios inline cuando el usuario edita.
   
   Los estilos de highlight del editor (.gbn-active) estan en la seccion
   siguiente y solo aplican cuando el editor esta activo.
   ============================================ */

/* GBN Editor - Layout Components Highlight */
.gbn-active [gloryHeader]:hover,
.gbn-active .gbn-header:hover {
    outline: 2px solid rgba(29, 143, 241, 0.5);
    outline-offset: -2px;
}

.gbn-active [gloryFooter]:hover,
.gbn-active .gbn-footer:hover {
    outline: 2px solid rgba(29, 143, 241, 0.5);
    outline-offset: -2px;
}

.gbn-active [gloryLogo]:hover,
.gbn-active .gbn-logo:hover {
    outline: 2px dashed rgba(59, 130, 246, 0.6);
    outline-offset: 2px;
}

.gbn-active [gloryMenu]:hover,
.gbn-active .gbn-menu:hover {
    outline: 2px dashed rgba(16, 185, 129, 0.6);
    outline-offset: 2px;
}

/* Control group colors for layout components */
.gbn-controls-header {
    background: rgba(29, 143, 241, 0.95);
    border-color: rgba(29, 143, 241, 0.2);
}

.gbn-controls-footer {
    background: rgba(75, 85, 99, 0.95);
    border-color: rgba(75, 85, 99, 0.2);
}

.gbn-controls-logo {
    background: rgba(59, 130, 246, 0.95);
    border-color: rgba(59, 130, 246, 0.2);
}

.gbn-controls-menu {
    background: rgba(16, 185, 129, 0.95);
    border-color: rgba(16, 185, 129, 0.2);
}

.gbn-controls-header .gbn-config-btn,
.gbn-controls-footer .gbn-config-btn,
.gbn-controls-logo .gbn-config-btn,
.gbn-controls-menu .gbn-config-btn,
.gbn-controls-header .gbn-add-btn,
.gbn-controls-footer .gbn-add-btn,
.gbn-controls-logo .gbn-add-btn,
.gbn-controls-menu .gbn-add-btn {
    color: #fff;
}

.gbn-controls-header .gbn-config-btn:hover,
.gbn-controls-footer .gbn-config-btn:hover,
.gbn-controls-logo .gbn-config-btn:hover,
.gbn-controls-menu .gbn-config-btn:hover,
.gbn-controls-header .gbn-add-btn:hover,
.gbn-controls-footer .gbn-add-btn:hover,
.gbn-controls-logo .gbn-add-btn:hover,
.gbn-controls-menu .gbn-add-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}
