/* ============================================
   CSS VARIABLES & RESET
   ============================================ */

:root {
    --bg-body: #f3f4f6;
    --bg-main: #ffffff;
    --bg-sidebar: #f8f9fa;
    --primary-color: #6c63ff;
    --primary-light: #8b84ff;
    --accent-color: #ff5e88;
    --accent-light: #ff9a9e;
    --text-main: #333333;
    --text-muted: #888888;
    --text-light: #999999;
    --border-color: #e5e7eb;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
    --cyan: #00bcd4;
    --pink: #ff1493;
    --purple: #9c27b0;
    --orange: #ff9800;
    --sidebar-width: 320px;
    --sidebar-collapsed-width: 0px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-body);
}

body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
}

/* ============================================
   MAIN CONTAINER
   ============================================ */

.app-container {
    background-color: var(--bg-main);
    width: 100%;
    max-width: 1600px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ============================================
   HEADER
   ============================================ */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-main);
    gap: 24px;
}

.floating-nav {
    position: fixed;
    top: 24px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 28px;
    padding: 12px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
    z-index: 999;
}

.floating-nav-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 18px;
    color: var(--accent-color);
    text-decoration: none;
    background: rgba(108, 99, 255, 0.05);
    transition: background 0.2s ease, transform 0.2s ease;
}

.floating-nav-item i {
    font-size: 18px;
}

.floating-nav-item:hover {
    background: white;
    transform: translateX(2px);
}

.floating-nav-tooltip {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(-8px);
    opacity: 0;
    pointer-events: none;
    background: var(--accent-color);
    color: white;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.floating-nav-item:hover .floating-nav-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(-12px);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #4a3b88;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 1px;
}

.nav-links {
    display: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.preview-public-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    border: none;
    border-radius: 22px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}

.preview-public-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(46, 204, 113, 0.22);
}

.logo-icon {
    color: var(--accent-color);
    font-size: 24px;
}

.sidebar-toggle-global {
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--text-main);
    cursor: pointer;
    padding: 0 8px;
    transition: color 0.3s;
}
.sidebar-toggle-global:hover {
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 40px;
    font-weight: 500;
    font-size: 14px;
}

.nav-item {
    text-decoration: none;
    color: var(--text-main);
    cursor: pointer;
    padding-bottom: 22px;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.nav-item:hover {
    color: var(--primary-color);
}

.nav-item.active {
    border-bottom-color: var(--text-main);
    font-weight: 600;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-area img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.user-area img:hover {
    border-color: var(--accent-color);
}

/* Global avatar utility: make images circular and cover */
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
    vertical-align: middle;
}

/* Smaller variant */
.profile-avatar.sm {
    width: 40px;
    height: 40px;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

.dashboard {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 100px);
    position: relative;
}

/* ============================================
   SIDEBAR (THEME EDITOR) - COLLAPSIBLE
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    background-color: white !important;
    padding: 30px;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    overflow-y: auto;
    max-height: calc(100vh - 100px);
    transition: width 0.3s ease, padding 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    position: relative;
    z-index: 10;
}

.sidebar.collapsed {
    width: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    border-right: none;
    margin-right: 0;
}

.sidebar-toggle-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.sidebar-toggle-btn {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-muted);
    font-size: 14px;
}

.sidebar-toggle-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.sidebar.collapsed .sidebar-toggle-btn {
    transform: rotate(180deg);
}

/* Botón flotante para abrir el sidebar */
.sidebar-floating-toggle {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 100;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-floating-toggle:hover {
    transform: translateY(-50%) scale(1.05);
    background: var(--primary-light);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 30px;
    color: var(--text-main);
}

.section-group {
    margin-bottom: 35px;
}

.section-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Font Selector */
.font-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.font-search-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    width: 100%;
}

.font-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.font-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.font-btn {
    flex: 1;
    min-width: 70px;
    padding: 8px 0;
    border: 1.5px solid var(--border-color);
    border-radius: 20px;
    text-align: center;
    font-size: 11px;
    background: var(--bg-main);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--text-main);
}

.font-btn:hover {
    border-color: var(--primary-color);
    background-color: #f0f4ff;
}

.font-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.font-suggestions {
    max-height: 150px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    display: none;
}

.font-suggestions.show {
    display: block;
}

.font-suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.font-suggestion-item:hover {
    background: #f0f4ff;
}

/* Color Palette with Pickers */
.color-palette {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.color-picker-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.color-swatch {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
}

.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.color-picker-input {
    width: 40px;
    height: 30px;
    border: none;
    padding: 0;
    cursor: pointer;
    background: transparent;
}

.color-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    color: var(--text-muted);
    position: relative;
}

.upload-zone:hover {
    border-color: var(--primary-color);
    background-color: #f0f4ff;
    color: var(--primary-color);
}

.upload-zone i {
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
}

.upload-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(108,99,255,0.08);
}

/* ===== NUEVO: Upload mini para fondos de grid ===== */
.upload-zone-mini {
    display: inline-block;
    padding: 4px 12px;
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    transition: all 0.2s;
    background: white;
}
.upload-zone-mini:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #f0f4ff;
}
.upload-zone-mini.dragover {
    border-color: var(--primary-color);
    background: rgba(108,99,255,0.08);
}

.grid-bg-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.grid-bg-label {
    font-weight: 500;
    font-size: 13px;
    min-width: 50px;
}
.remove-bg-btn {
    padding: 4px 10px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.remove-bg-btn:hover {
    background: #c0392b;
}
.grid-reset-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.reset-grid-btn {
    padding: 6px 16px;
    background: #f39c12;
    color: white;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.reset-grid-btn:hover {
    background: #e67e22;
}

/* ===== NUEVO: Sección de música MP3 ===== */
.music-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    color: var(--text-muted);
    background: white;
}
.music-upload-zone:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
    color: var(--primary-color);
}
.music-upload-zone i {
    display: block;
    font-size: 28px;
    margin-bottom: 6px;
}
.music-upload-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(108,99,255,0.08);
}

/* ===== Botón de play/pause en el banner ===== */
.banner-play-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(4px);
    border: 2px solid rgba(255,255,255,0.4);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: none; /* se muestra solo si hay audio */
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 5;
}
.banner-play-btn:hover {
    background: rgba(255,255,255,0.4);
    transform: scale(1.05);
}
.banner-play-btn i {
    margin-left: 2px;
}

/* Background Music Toggle (para MP3) */
.bg-music-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.toggle-label {
    font-weight: 500;
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
}

.toggle-status {
    font-size: 12px;
    color: var(--text-muted);
}

.toggle-switch {
    width: 48px;
    height: 26px;
    background-color: #ccc;
    border-radius: 13px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background-color: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
}

.toggle-switch.active {
    background-color: var(--cyan);
}

.toggle-switch.active::after {
    left: 24px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    max-height: calc(100vh - 100px);
    transition: margin-left 0.3s ease;
}

/* Banner Container */
.banner-container {
    width: 100%;
    min-height: 150px;
    border-radius: 12px;
    margin-bottom: 25px;
    background-size: cover;
    background-position: center;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-image 0.3s ease;
    overflow: hidden;
    position: relative;
}

.banner-container .banner-content {
    padding: 40px;
    text-align: center;
    background: rgba(0,0,0,0.2);
    width: 100%;
    backdrop-filter: blur(4px);
}

.banner-container h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
}

.banner-container p {
    font-size: 14px;
    opacity: 0.9;
}

/* ============================================
   WIDGET GRID & WIDGETS
   ============================================ */

.widget-grid {
    width: 100%;
    height: 600px;
    background-color: #fafafa;
    border: 2px dashed #ccc;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    margin-top: 20px;
}

.grid-widget {
    position: absolute;
    cursor: move;
    user-select: none;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    min-width: 30px;
    min-height: 30px;
    background: rgba(0,0,0,0.02);
    overflow: visible;
}

.grid-widget:hover {
    border-color: var(--primary-color);
}

.grid-widget.selected {
    border-color: var(--primary-color);
}

.widget-content {
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.widget-content img,
.widget-content iframe,
.widget-content video,
.widget-content .html-content,
.widget-content .text-content {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.widget-content img {
    object-fit: contain;
}

.widget-content iframe {
    border: none;
    pointer-events: none;
}

.widget-content .html-content,
.widget-content .text-content {
    overflow: auto;
    padding: 8px;
    background: white;
    box-sizing: border-box;
}

/* ============================================
   PANEL DE CONTROLES
   ============================================ */

.image-controls {
    position: fixed;
    background: rgba(30, 30, 40, 0.95);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 12px 16px;
    display: none;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    z-index: 1000;
    min-width: 260px;
    pointer-events: auto;
    border: 1px solid rgba(255,255,255,0.15);
    transition: opacity 0.2s;
}

.image-controls.visible {
    display: flex;
}

.image-controls .controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.image-controls .controls-header .pin-btn {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}
.image-controls .controls-header .pin-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}
.image-controls .controls-header .pin-btn.pinned {
    color: var(--primary-color);
}

.image-controls .controls-header .delete-btn {
    background: none;
    border: none;
    color: #ff5e88;
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}
.image-controls .controls-header .delete-btn:hover {
    color: #ff1a4d;
    background: rgba(255,94,136,0.2);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.control-group label {
    color: #aaa;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
    min-width: 36px;
}

.control-group button {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
}

.control-group button:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.control-group .angle-display {
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    min-width: 34px;
    text-align: center;
}

.pos-input, .size-input {
    width: 40px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    color: #fff;
    padding: 2px 4px;
    font-size: 11px;
    text-align: center;
    height: 24px;
}

.pos-input:focus, .size-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.scale-slider {
    width: 60px;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    accent-color: var(--primary-color);
}

.scale-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background: var(--primary-color);
    cursor: nwse-resize;
    border-radius: 0 0 4px 0;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.grid-widget:hover .resize-handle {
    opacity: 1;
}

.layer-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 6px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}
.layer-btn:hover {
    background: var(--primary-color);
}

/* ============================================
   WIDGET LINK
   ============================================ */
.link-content {
    width: 100%;
    height: 100%;
    background: rgba(128, 128, 128, 0.25);
    border: 2px dashed rgba(128, 128, 128, 0.6);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #666;
    transition: background 0.2s;
    cursor: pointer;
    box-sizing: border-box;
    position: relative;
}

.link-content i {
    font-size: 32px;
    color: rgba(0,0,0,0.3);
    margin-right: 8px;
}

.link-content .link-label {
    background: rgba(255,255,255,0.7);
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 12px;
    color: #333;
}

.grid-widget.selected .link-content,
.grid-widget[data-hovering="true"] .link-content,
.grid-widget[data-dragging="true"] .link-content {
    cursor: move;
    background: rgba(128, 128, 128, 0.15);
}

/* ============================================
   MENÚ FLOTANTE DE WIDGETS
   ============================================ */

.widget-menu-floating {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.widget-menu-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 28px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-menu-toggle:hover {
    transform: scale(1.05);
}

.widget-menu-options {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 140px;
}

.widget-menu-options.open {
    display: flex;
}

.widget-option {
    background: none;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    transition: background 0.2s;
}

.widget-option:hover {
    background: #f0f4ff;
}

.widget-option i {
    width: 20px;
    color: var(--primary-color);
}

/* ============================================
   MODALES
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 18px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.modal-content input[type="file"] {
    display: block;
    margin-bottom: 16px;
    width: 100%;
}

.modal-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-btn:hover {
    background: var(--primary-light);
}

.modal-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 12px;
}

.modal-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: monospace;
    resize: vertical;
    margin-bottom: 12px;
}

.modal-text-editor .modal-content {
    max-width: 600px;
}

.modal-text-editor #textEditorContainer {
    height: 250px;
    margin-bottom: 12px;
}

.modal-text-editor .modal-btn {
    margin-right: 8px;
}

.html-css-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.html-css-row label {
    font-weight: 600;
    font-size: 13px;
    color: #555;
}
.html-css-row textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
    resize: vertical;
    min-height: 80px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
    .widget-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .dashboard {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: none;
        padding: 20px;
    }

    .sidebar.collapsed {
        width: 100%;
        padding: 0;
        max-height: 0;
        border-bottom: none;
    }

    .main-content {
        max-height: none;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }

    .nav-links {
        gap: 15px;
        font-size: 12px;
    }

    .nav-item {
        padding-bottom: 10px;
    }

    .sidebar {
        padding: 15px;
    }

    .main-content {
        padding: 15px;
    }

    .banner-container .banner-content {
        padding: 20px;
    }
    .banner-container h1 {
        font-size: 22px;
    }

    .widget-grid {
        height: 400px;
    }
    .control-group {
        flex: 1 1 auto;
        min-width: 80px;
    }
    .widget-menu-floating {
        bottom: 16px;
        right: 16px;
    }
    .widget-menu-toggle {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    .banner-play-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
        bottom: 12px;
        right: 12px;
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   SOCIAL LINKS - SIDEBAR Y BANNER
   ============================================ */

/* Social Links en sidebar */
.social-links-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.social-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.6);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s;
}
.social-input-row:hover {
    border-color: var(--primary-color);
}
.social-input-row i {
    width: 20px;
    font-size: 16px;
    color: var(--text-muted);
}
.social-input-row input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 0;
    font-size: 12px;
    outline: none;
    font-family: inherit;
}
.social-input-row input::placeholder {
    color: #bbb;
}

/* Iconos de redes en el banner (corregido: usar ID en lugar de clase) */
#socialIconsContainer {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    z-index: 10;
    background: var(--primary-color);
    backdrop-filter: blur(4px);
    padding: 8px 14px;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.2);
}

#socialIconsContainer:empty {
    display: none !important;
}

.social-icon-link {
    color: white;
    font-size: 20px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    text-decoration: none;
}
.social-icon-link:hover {
    transform: scale(1.15);
    background: rgba(255,255,255,0.25);
    color: var(--primary-light);
}

/* Toggle segunda cuadrícula */
.grid-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}
.grid-toggle-btn {
    padding: 6px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.grid-toggle-btn:hover {
    background: var(--primary-light);
}

/* Selector de grid en menú flotante */
.grid-selector-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid #eee;
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
}
.grid-selector-row select {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

/* Ajuste para el segundo grid */

#widget-grid-2 {
    margin-top: 20px;
}

/* ============================================
   WIDGETS EXTRA Y ESTADOS
   ============================================ */
.shape-content,
.countdown-content,
.social-content {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.shape-content {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-color: rgba(255,255,255,0.95);
    border-width: 2px;
    border-style: solid;
}

.shape-legend {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    font-size: 10px;
    line-height: 1.2;
    color: rgba(255,255,255,0.9);
    background: rgba(0,0,0,0.18);
    padding: 6px 8px;
    border-radius: 10px;
}

.shape-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.shape-legend .legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.shape-legend .fill-dot {
    background: rgba(255,255,255,0.95);
}

.shape-legend .stroke-dot {
    border: 2px solid rgba(255,255,255,0.95);
    background: transparent;
}

.shape-content.shape-circle { border-radius: 50%; }
.shape-content.shape-diamond { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); }
.shape-content.shape-triangle { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); }

.countdown-content {
    flex-direction: column;
    padding: 18px 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    text-align: center;
    border-radius: 20px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.08);
}

.countdown-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 12px;
    opacity: 0.95;
}

.countdown-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(60px, 1fr));
    gap: 10px;
    width: 100%;
}

.countdown-item {
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 14px;
    padding: 10px 8px;
}

.countdown-item span {
    display: block;
    font-size: 20px;
    font-weight: 800;
}

.countdown-item small {
    font-size: 10px;
    opacity: 0.88;
    text-transform: uppercase;
}

.social-content {
    flex-direction: column;
    gap: 12px;
    padding: 18px 20px;
    background: #ffffff;
    border-radius: 22px;
    border: 1px solid rgba(108,99,255,0.16);
    color: #222;
    box-shadow: 0 18px 35px rgba(108,99,255,0.08);
}

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

.social-platform {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--primary-color);
}

.social-handle {
    font-size: 18px;
    font-weight: 800;
    color: #1f1f1f;
        margin-top: 4px;
    }

    .social-badge {
        font-size: 10px;
        padding: 4px 8px;
        border-radius: 999px;
        background: rgba(108,99,255,0.12);
        color: var(--primary-color);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.1em;
    }

    .social-message {
        font-size: 14px;
        text-align: left;
        opacity: 0.88;
        line-height: 1.5;
        padding: 0 2px;
    border-color: var(--primary-color);
}

.qr-content {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    box-sizing: border-box;
}

.grid-widget.selected {
    box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.2), 0 8px 22px rgba(0, 0, 0, 0.08);
}

.grid-widget.locked {
    opacity: 0.95;
    filter: saturate(0.92);
}

.grid-widget.locked .image-controls {
    opacity: 0.8;
}

.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background: var(--primary-color);
    cursor: nwse-resize;
    border-radius: 0 0 4px 0;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.grid-widget:hover .resize-handle {
    opacity: 1;
}

.layer-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 6px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}
.layer-btn:hover {
    background: var(--primary-color);
}

/* ============================================
   WIDGET LINK
   ============================================ */
.link-content {
    width: 100%;
    height: 100%;
    background: rgba(128, 128, 128, 0.25);
    border: 2px dashed rgba(128, 128, 128, 0.6);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #666;
    transition: background 0.2s;
    cursor: pointer;
    box-sizing: border-box;
    position: relative;
}

.link-content i {
    font-size: 32px;
    color: rgba(0,0,0,0.3);
    margin-right: 8px;
}

.link-content .link-label {
    background: rgba(255,255,255,0.7);
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 12px;
    color: #333;
}

.grid-widget.selected .link-content,
.grid-widget[data-hovering="true"] .link-content,
.grid-widget[data-dragging="true"] .link-content {
    cursor: move;
    background: rgba(128, 128, 128, 0.15);
}

/* ============================================
   MENÚ FLOTANTE DE WIDGETS
   ============================================ */

.widget-menu-floating {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.widget-menu-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 28px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-menu-toggle:hover {
    transform: scale(1.05);
}

.widget-menu-options {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 140px;
}

.widget-menu-options.open {
    display: flex;
}

.widget-option {
    background: none;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    transition: background 0.2s;
}

.widget-option:hover {
    background: #f0f4ff;
}

.widget-option i {
    width: 20px;
    color: var(--primary-color);
}

/* ============================================
   MODALES
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 18px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.modal-content input[type="file"] {
    display: block;
    margin-bottom: 16px;
    width: 100%;
}

.modal-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-btn:hover {
    background: var(--primary-light);
}

.modal-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 12px;
}

.modal-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: monospace;
    resize: vertical;
    margin-bottom: 12px;
}

.modal-text-editor .modal-content {
    max-width: 600px;
}

.modal-text-editor #textEditorContainer {
    height: 250px;
    margin-bottom: 12px;
}

.modal-text-editor .modal-btn {
    margin-right: 8px;
}

.html-css-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.html-css-row label {
    font-weight: 600;
    font-size: 13px;
    color: #555;
}
.html-css-row textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
    resize: vertical;
    min-height: 80px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
    .widget-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .dashboard {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: none;
        padding: 20px;
    }

    .sidebar.collapsed {
        width: 100%;
        padding: 0;
        max-height: 0;
        border-bottom: none;
    }

    .main-content {
        max-height: none;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }

    .nav-links {
        gap: 15px;
        font-size: 12px;
    }

    .nav-item {
        padding-bottom: 10px;
    }

    .sidebar {
        padding: 15px;
    }

    .main-content {
        padding: 15px;
    }

    .banner-container .banner-content {
        padding: 20px;
    }
    .banner-container h1 {
        font-size: 22px;
    }

    .widget-grid {
        height: 400px;
    }
    .control-group {
        flex: 1 1 auto;
        min-width: 80px;
    }
    .widget-menu-toggle {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   SOCIAL LINKS - SIDEBAR Y BANNER
   ============================================ */

/* Social Links en sidebar */
.social-links-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.social-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.6);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s;
}
.social-input-row:hover {
    border-color: var(--primary-color);
}
.social-input-row i {
    width: 20px;
    font-size: 16px;
    color: var(--text-muted);
}
.social-input-row input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 0;
    font-size: 12px;
    outline: none;
    font-family: inherit;
}
.social-input-row input::placeholder {
    color: #bbb;
}

/* Iconos de redes en el banner (corregido: usar ID en lugar de clase) */
#socialIconsContainer {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    z-index: 10; /* Asegurar que esté por encima */
    background: var(--primary-color);
    backdrop-filter: blur(4px);
    padding: 8px 14px;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.2);
}

.social-icon-link {
    color: white;
    font-size: 20px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    text-decoration: none;
}
.social-icon-link:hover {
    transform: scale(1.15);
    background: rgba(255,255,255,0.25);
    color: var(--primary-light);
}

/* Toggle segunda cuadrícula */
.grid-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}
.grid-toggle-btn {
    padding: 6px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.grid-toggle-btn:hover {
    background: var(--primary-light);
}

/* Selector de grid en menú flotante */
.grid-selector-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid #eee;
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
}
.grid-selector-row select {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

/* Ajuste para el segundo grid */
#widget-grid-2 {
    margin-top: 20px;
}