/* --- NUEVO: Regla para que los bordes no sumen al ancho (Soluciona el desajuste) --- */
* {
    box-sizing: border-box;
}

/* Variables de Colores */
:root {
    --board-color: #fffac8; /* Amarillo claro típico de Post-it */
    --accent-color: #3f51b5; 
    --note-shadow: rgba(0, 0, 0, 0.3); 
    --handle-color: rgba(0, 0, 0, 0.1); 
    --icon-size: 24px; /* AJUSTE: Aumentado para el icono de reset/ayuda */
    --note-control-size: 20px; /* Tamaño estándar para los controles de nota (X, C, T) */
    --success-color: #4CAF50; 
    --danger-color: #F44336; 
    --note-icon-bg: rgba(0, 0, 0, 0.4); 
    --hover-delete-bg: #ff7777; 
    --hover-text-bg: #61a9ff; 
    --empty-text-color: #777; /* Color Gris para el mensaje vacío */
}

body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #333; 
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding-top: 30px; 
}

.app-container {
    width: 80vw; 
    max-width: 1400px;
    display: flex;
    flex-direction: column;
}

/* Contenedor para los botones (Header superior de la Nota Gigante) */
.app-header {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    height: 40px; 
    
    background-color: var(--handle-color);
    
    border: 10px solid var(--handle-color);
    border-bottom: none; 
    border-radius: 10px 10px 0 0;
    padding: 0 10px; 
    margin-bottom: 0; 
    
    gap: 10px; 
}

/* PARTE IZQUIERDA (70%) */
.header-left {
    flex-basis: 70%; 
    display: flex;
    align-items: center;
    gap: 15px; 
    overflow-x: auto; 
    white-space: nowrap; 
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.header-left::-webkit-scrollbar {
    display: none; 
}


/* PARTE DERECHA (30%) */
.header-right {
    flex-basis: 30%; 
    display: flex;
    align-items: center;
    justify-content: flex-end; 
    gap: 10px; 
}


/* Estilo del Botón de Añadir Nota/Tablero (mismo estilo) */
.add-button {
    padding: 5px 0px; 
    background: none; 
    border: none; 
    color: white; 
    
    cursor: pointer;
    font-size: 16px; 
    font-weight: bold; 
    transition: color 0.2s, transform 0.2s;
    
    width: auto; 
    height: auto; 
    line-height: normal;
}

.add-button:hover {
    color: var(--success-color); 
    transform: scale(1.05);
}

/* Estilo de los Selectores de Tablero (Tabs) */
.board-selector {
    display: flex;
    gap: 0px; 
}

.board-btn {
    padding: 5px 12px;
    background-color: rgba(255, 255, 255, 0.1); 
    border: none;
    color: white;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s, transform 0.1s;
    border-right: 1px solid rgba(0, 0, 0, 0.1); 
}

.board-btn:first-child {
    border-left: none; 
}

.board-btn:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.2);
}

.board-btn.active, .help-button.active {
    background-color: var(--accent-color); 
    color: white;
    box-shadow: 0 0 5px rgba(63, 81, 181, 0.5); 
    transform: scale(1.05); 
    z-index: 10;
    position: relative;
    border-right: 1px solid var(--accent-color);
}

/* --------------------------------- */
/* Botón de Ayuda (?) */
/* --------------------------------- */
.help-button {
    background: none;
    border: none;
    color: white; 
    font-size: 20px; 
    width: var(--icon-size); 
    height: var(--icon-size);
    margin: 2px 0; /* espacio vertical para que no queden pegados al borde */
    text-align: center;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s, transform 0.2s;
}

.help-button:hover:not(.active) {
    color: #ffd700; 
    transform: scale(1.1);
}

/* Animación de parpadeo para indicar novedades en el tablero de ayuda */
@keyframes help-blink {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.25; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

.help-button.blink {
    animation: help-blink 1.2s ease-in-out infinite;
}

/* --------------------------------- */
/* Botón de Resetear (↻) */
/* --------------------------------- */
.reset-button {
    background: none;
    border: none;
    color: white; 
    
    font-size: 20px; 
    width: var(--icon-size);
    height: var(--icon-size);
    line-height: var(--icon-size);
    text-align: center;
    
    cursor: pointer;
    padding: 0;
    transition: color 0.2s, transform 0.2s;
}

.reset-button:hover {
    color: var(--danger-color); 
    transform: rotate(30deg) scale(1.1);
}

.reset-button[disabled] {
    opacity: 0.5;
    cursor: default;
    transform: none;
}


/* Botón de Eliminar Tablero (X) */
.delete-board-btn {
    background: none;
    border: none;
    color: #F44336; 
    font-size: 20px; 
    width: var(--note-control-size);
    height: var(--note-control-size);
    line-height: var(--note-control-size);
    text-align: center;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s, transform 0.2s;
}

.delete-board-btn:hover {
    color: #FF0000; 
    transform: scale(1.1);
}


/* Estilo del Contenedor Principal (Note Board) */
.note-board {
    width: 100%;
    height: 80vh; 
    
    background-color: var(--board-color);
    
    border: 10px solid var(--handle-color);
    border-top: none; 
    border-radius: 0 0 10px 10px; 
    box-shadow: 10px 10px 30px var(--note-shadow); 
    
    position: relative; 
    overflow: hidden;
    
    display: flex;
    justify-content: center; 
    align-items: center; 
}


/* Estilo del Mensaje de Tablero Vacío */
.empty-state-message {
    text-align: center;
    color: var(--empty-text-color); 
    z-index: 5; 
}


/* Clase Global para Deshabilitar Selección */
.unselectable {
    user-select: none; 
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}


/* Estilo de la Nota Adhesiva (Contenedor principal) */
.note {
    width: 150px; 
    height: 150px; 
    position: absolute;
    box-shadow: 2px 2px 10px var(--note-shadow); 
    border-radius: 5px;
    cursor: default;
    transition: box-shadow 0.2s;
    transform: rotate(calc(-1deg + (random() * 2deg))); 
    display: flex; 
    flex-direction: column;
    resize: both; 
    overflow: auto; 
    min-width: 150px; 
    min-height: 150px; 
}

.note:active {
    box-shadow: 5px 5px 15px var(--note-shadow); 
    z-index: 1000; 
}

/* Estilos para notas bloqueadas (Tablero de Ayuda) */
.note-locked {
    resize: none !important; 
    cursor: default !important;
    box-shadow: 0 0 10px #3f51b1 !important; 
}
.note-locked .note-header-handle {
    cursor: default;
}

/* Contenedor para los controles derechos (maximize + delete) dentro del header */
.right-controls {
    display: flex;
    align-items: center;
    gap: 5px; /* igual que .options-menu */
    margin-left: auto; /* empuja los controles hacia la derecha dentro del header */
    opacity: 0;
    transition: opacity 0.2s;
}

.note:hover .right-controls {
    opacity: 1;
}

/* Botón de maximizar/restaurar (junto al eliminar) */
.maximize-btn {
    background-color: var(--note-icon-bg);
    border-radius: 50%;
    width: var(--note-control-size);
    height: var(--note-control-size);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    border: none;
    font-size: 12px;
    font-weight: bold;
    color: white;
    margin-right: 0;
    opacity: 0; /* aparece al hover como delete */
    line-height: 1; /* asegurar centrado vertical */
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.note:hover .maximize-btn {
    opacity: 1;
}

/* Estado maximizado: ocupa todo el tablero */
.note-maximized {
    /* Dejar un pequeño margen (respirar) cuando la nota está maximizada */
    left: 10px !important;
    top: 10px !important;
    width: calc(100% - 20px) !important;
    height: calc(100% - 20px) !important;
    resize: none !important;
    transform: none !important; /* quitar rotacion al maximizar */
    box-shadow: 0 0 30px rgba(0,0,0,0.4) !important;
}

/* Ocultar el botón de eliminar cuando la nota está maximizada */
.note-maximized .delete-btn {
    display: none !important;
}

/* ----------------------------------- */
/* Estilo de los Controles de Nota */
/* ----------------------------------- */

/* 1. Barra superior para arrastrar */
.note-header-handle {
    position: relative;
    /* AJUSTE: Aumento del padding superior/inferior para dar más margen */
    padding: 3px 5px; 
    min-height: 25px; /* Altura mínima para asegurar espacio */
    background-color: var(--handle-color);
    cursor: grab;
    width: 100%;
    
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.note:hover .note-header-handle {
    background-color: rgba(0, 0, 0, 0.2); 
}

/* 2. Menú de Opciones (Color y Texto) */
.options-menu {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
    align-items: center;
}

.note:hover .options-menu {
    opacity: 1;
}

/* 2.1 Botones de control (C y T) */
.color-picker-btn, .text-color-btn {
    border-radius: 50%;
    width: var(--note-control-size);
    height: var(--note-control-size);
    cursor: pointer;
    /* AJUSTE: Hover más sutil y transición aplicada */
    transition: background-color 0.2s, transform 0.2s; 
    background-color: var(--note-icon-bg); 
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    border: none;
    margin: 0;
    margin-top: 4px;
    margin-bottom: 2px;
    
    font-size: 10px; 
    font-weight: bold;
    color: white; 
}

/* Botón de Eliminar (X) */
.delete-btn {
    background-color: var(--note-icon-bg); 
    
    border-radius: 50%;
    width: var(--note-control-size);
    height: var(--note-control-size);
    cursor: pointer;
    /* AJUSTE: Hover más sutil y transición aplicada */
    transition: background-color 0.2s, transform 0.2s; 
    
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    border: none;

    font-size: 12px;
    font-weight: bold;
    color: white; 
    
    opacity: 0;
}

.note:hover .delete-btn {
    opacity: 1;
}

/* Estilos de Hover (Botones de Nota: C, T, X) */
.delete-btn:hover,
.text-color-btn:hover,
.color-picker-btn:hover {
    transform: translateY(-1px); 
}

.delete-btn:hover {
    background-color: var(--hover-delete-bg);
}

.text-color-btn:hover {
    background-color: var(--hover-text-bg);
}

.color-picker-btn:hover {
    background-color: #f7a300; 
}

/* Hover para el botón maximizar: verde claro y el mismo pequeño levantamiento */
.maximize-btn:hover {
    transform: translateY(-1px);
    background-color: #c4f0c4; /* verde claro */
}

/* El input nativo debe estar oculto */
.color-picker-input {
    display: none;
}

/* Área de Texto de la Nota */
.note-content {
    flex-grow: 1; 
    padding: 10px 15px 15px 15px; 
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    resize: none; 
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box; 
    cursor: default; 
}

/* Toolbar de formato que aparece cuando la nota está maximizada */
.format-toolbar {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 4px;
    display: none; /* se muestra solo cuando corresponde */
    gap: 6px;
    z-index: 1200;
}

.format-btn {
    background-color: var(--note-icon-bg);
    border-radius: 4px;
    width: var(--note-control-size);
    height: var(--note-control-size);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
}

.format-btn:hover {
    transform: translateY(-1px);
    background-color: #c4f0c4; /* tono similar al maximize hover */
}