/**
 * Alfabeto Móvil Interactivo - Estilos Personalizados
 * Previene selección de texto y mejora la experiencia drag & drop
 */

/* ============================================
   FUENTES PERSONALIZADAS
   ============================================ */

/* Fuente cursiva/ligada para letra manuscrita */
.font-cursive {
    font-family: 'Patrick Hand', 'Caveat', cursive !important;
    font-weight: 700 !important;
    letter-spacing: 1px;
    font-size: 2.5rem !important; /* Tamaño ligeramente mayor para cursiva */
}

/* ============================================
   PREVENCIÓN DE SELECCIÓN DE TEXTO
   ============================================ */

.letter-tile,
.workspace-letter {
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE/Edge */
    user-select: none; /* Estándar */

    -webkit-touch-callout: none; /* iOS Safari */
    -webkit-tap-highlight-color: transparent; /* Quitar highlight en móviles */
}

/* Prevenir selección accidental durante drag */
body.dragging {
    cursor: grabbing !important;
    user-select: none;
}

/* ============================================
   MEJORAS VISUALES PARA DRAG & DROP
   ============================================ */

.letter-tile {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.letter-tile:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.letter-tile:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.workspace-letter {
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.workspace-letter:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.workspace-letter:active {
    cursor: grabbing;
    opacity: 0.7;
}

/* ============================================
   ZONA DE TRABAJO
   ============================================ */

#workspace {
    position: relative;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Líneas de renglón sutiles (opcional) */
#workspace::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: repeating-linear-gradient(
        transparent,
        transparent 79px,
        rgba(148, 163, 184, 0.1) 79px,
        rgba(148, 163, 184, 0.1) 80px
    );
    pointer-events: none;
}

/* Mensaje vacío */
#empty-message {
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#empty-message.hidden {
    opacity: 0;
}

/* ============================================
   ANIMACIONES
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.workspace-letter {
    animation: fadeIn 0.3s ease;
}

/* ============================================
   MODAL
   ============================================ */

#notebook-modal {
    animation: fadeIn 0.3s ease;
}

#notebook-modal > div {
    animation: fadeIn 0.4s ease;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

#toast-container > div {
    animation: slideInRight 0.3s ease;
}

/* ============================================
   RESPONSIVIDAD
   ============================================ */

@media (max-width: 768px) {
    .letter-tile,
    .workspace-letter {
        width: 3rem;
        height: 3rem;
        font-size: 1.5rem;
    }

    #workspace {
        min-height: 200px;
    }

    #letter-bank {
        gap: 0.5rem;
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .letter-tile,
    .workspace-letter {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.25rem;
    }

    #empty-message {
        font-size: 1rem;
        padding: 1rem;
    }
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */

/* Focus visible para navegación por teclado */
.letter-tile:focus,
.workspace-letter:focus,
button:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

/* Reducir movimiento para usuarios con preferencias de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   MEJORAS PARA IMPRESIÓN
   ============================================ */

@media print {
    #letter-bank,
    button,
    #toast-container,
    #notebook-modal {
        display: none !important;
    }

    #workspace {
        border: 2px solid #000;
        min-height: auto;
    }

    .workspace-letter {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* ============================================
   SCROLLBAR PERSONALIZADO
   ============================================ */

#letter-bank::-webkit-scrollbar,
#notebook-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#letter-bank::-webkit-scrollbar-track,
#notebook-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

#letter-bank::-webkit-scrollbar-thumb,
#notebook-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

#letter-bank::-webkit-scrollbar-thumb:hover,
#notebook-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
