body { position: relative !important; }

#little-notes-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 999999;
}

/* ==========================================================================
   SISTEMA BASE DE LAS NOTAS ADHESIVAS (ESTRUCTURA Y ESTADOS)
   ========================================================================= */

/* Estado Base General (Común para todos los temas) */
.little-note-adhesiva {
    position: absolute;
    width: 220px;
    min-height: 90px;
    padding: 18px 12px 12px 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.18);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    transform: translate(-50%, -10px) rotate(-1deg);
    z-index: 99999;
    transition: transform 0.15s ease, box-shadow 0.15s ease, width 0.2s ease, min-height 0.2s ease, padding 0.2s ease;
}

/* Efecto Hover general (Abierta) */
.little-note-adhesiva:not(.is-collapsed):hover { 
    transform: translate(-50%, -10px) rotate(0deg) scale(1.03); 
    box-shadow: 0 6px 14px rgba(0,0,0,0.22);
    z-index: 999999;
}

/* Estado Plegado General (Círculo Base) */
.little-note-adhesiva.is-collapsed {
    width: 24px;
    min-height: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff !important;
    box-shadow: 0 0 0 2px #ffffff, 0 2px 6px rgba(0,0,0,0.3);
    transform: translate(-50%, -10px) rotate(0deg);
    overflow: hidden;
}

.little-note-adhesiva.is-admin-only.is-collapsed {
    border-left: 2px solid #ffffff !important;
}

/* Efecto Hover general (Plegada) */
.little-note-adhesiva.is-collapsed:hover {
    transform: translate(-50%, -10px) scale(1.2);
    box-shadow: 0 0 0 2px #ffffff, 0 4px 10px rgba(0,0,0,0.4);
    z-index: 999999;
}

/* Ocultar elementos internos al colapsar */
.little-note-adhesiva.is-collapsed .little-note-texto,
.little-note-adhesiva.is-collapsed .little-note-cerrar {
    display: none !important;
}

/* Centrar Pin central al colapsar */
.little-note-adhesiva.is-collapsed .little-note-pin {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

/* ==========================================================================
   PALETAS DE COLORES Y TEMAS DE DISEÑO (NUEVO V1.2.0 - PALETA SELECCIONABLE)
   ========================================================================= */

/* --- TEMA 1: CLASSIC YELLOW (Por Defecto) --- */
#little-notes-canvas.ln-theme-classic .little-note-adhesiva {
    background: #fef5c1;
    color: #2c3e50;
    border-left: 5px solid #fade59;
}
#little-notes-canvas.ln-theme-classic .little-note-adhesiva.is-admin-only {
    background: #fff3e0;
    border-left: 4px solid #f57c00;
}
#little-notes-canvas.ln-theme-classic .little-note-adhesiva.is-collapsed { background: #fade59 !important; }
#little-notes-canvas.ln-theme-classic .little-note-adhesiva.is-admin-only.is-collapsed { background: #f57c00 !important; }

/* --- TEMA 2: MODERN BLUE --- */
#little-notes-canvas.ln-theme-modern-blue .little-note-adhesiva {
    background: #e0f2fe; /* Azul cian muy suave */
    color: #0369a1;      /* Azul oscuro metálico para el texto */
    border-left: 5px solid #38bdf8; /* Borde azul vivo */
}
#little-notes-canvas.ln-theme-modern-blue .little-note-adhesiva.is-admin-only {
    background: #f0fdf4; /* Verde menta muy suave para diferenciar el admin */
    border-left: 4px solid #22c55e; /* Borde verde */
}
#little-notes-canvas.ln-theme-modern-blue .little-note-adhesiva.is-collapsed { background: #38bdf8 !important; }
#little-notes-canvas.ln-theme-modern-blue .little-note-adhesiva.is-admin-only.is-collapsed { background: #22c55e !important; }

/* --- TEMA 3: MINIMAL DARK --- */
#little-notes-canvas.ln-theme-minimal-dark .little-note-adhesiva {
    background: #1e293b; /* Gris oscuro grafito */
    color: #f8fafc;      /* Texto blanco puro/antirreflectante */
    border-left: 5px solid #94a3b8; /* Borde gris claro */
}
#little-notes-canvas.ln-theme-minimal-dark .little-note-adhesiva.is-admin-only {
    background: #0f172a; /* Negro pizarra profundo para admin */
    border-left: 4px solid #f43f5e; /* Borde rosa/fucsia de advertencia seria */
}
#little-notes-canvas.ln-theme-minimal-dark .little-note-adhesiva.is-collapsed { background: #94a3b8 !important; }
#little-notes-canvas.ln-theme-minimal-dark .little-note-adhesiva.is-admin-only.is-collapsed { background: #f43f5e !important; }


/* ==========================================================================
   ELEMENTOS INTERNOS (PINES, BOTONES Y TEXTOS)
   ========================================================================= */

.little-note-texto a {
    color: inherit !important;
    text-decoration: underline !important;
    word-break: break-all;
}

/* El Pin Superior (Públicas: Rojo clásico) */
.little-note-pin {
    position: absolute;
    top: -8px;
    left: 50%;
    width: 14px;
    height: 14px;
    background: #e74c3c;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
    transform: translateX(-50%);
    transition: transform 0.1s ease;
}

/* El pin de las notas privadas pasa a ser Antracita/Gris Oscuro */
.little-note-adhesiva.is-admin-only .little-note-pin {
    background: #34495e !important;
}

/* Interactividad del Pin Abierto */
.little-note-adhesiva:not(.is-collapsed) .little-note-pin { cursor: pointer; }
.little-note-adhesiva:not(.is-collapsed) .little-note-pin:hover { transform: translateX(-50%) scale(1.2); }

/* Aspa de Cierre */
.little-note-cerrar {
    position: absolute;
    top: 2px;
    right: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: #7f8c8d;
    user-select: none;
    line-height: 1;
}
.little-note-cerrar:hover { color: #c0392b; }

.little-note-texto {
    word-wrap: break-word;
    white-space: pre-wrap;
    margin-top: 4px;
}

/* ==========================================================================
   LITTLE NOTES - MODAL DE CREACIÓN Y RESPONSIVE
   ========================================================================= */
#little-notes-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
}

.ln-modal-content {
    background: #ffffff;
    padding: 24px;
    border-radius: 6px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.ln-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 22px;
    cursor: pointer;
    color: #666666;
    font-weight: bold;
}
.ln-modal-close:hover { color: #000000; }

.ln-modal-content h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #23282d;
    font-weight: 600;
}

#ln-modal-text {
    width: 100%;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 12px;
    resize: vertical;
    font-size: 14px;
    box-sizing: border-box;
}
#ln-modal-text:focus {
    border-color: #2271b1;
    outline: 2px solid transparent;
    box-shadow: 0 0 0 2px #2271b1;
}

.ln-modal-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #1d2327;
    margin-bottom: 16px;
    cursor: pointer;
}
.ln-modal-checkbox input { margin: 0; cursor: pointer; }

.ln-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@media screen and (max-width: 768px) {
    #little-notes-canvas { display: none !important; visibility: hidden !important; pointer-events: none !important; }
    .little-note-adhesiva { display: none !important; visibility: hidden !important; }
}