/* ================================================
   TABLA PERSONAL - APP STYLES
   ================================================ */

.tp-app {
    --tp-rosa: #ec4899;
    --tp-rosa-oscuro: #be185d;
    --tp-gradiente: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
    --tp-sombra: 0 10px 30px rgba(236, 72, 153, 0.15);
    --tp-radio: 16px;
    --tp-transicion: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    position: relative;
    overflow: hidden;
}

/* ================================================
   FASE FORMULARIO
   ================================================ */

.tp-fase {
    animation: tpFadeIn 0.6s ease;
}

@keyframes tpFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.tp-form-contenido {
    text-align: center;
    padding: 2.5rem 1rem;
}

.tp-icono-oraculo {
    font-size: 4rem;
    position: relative;
    display: inline-block;
    margin-bottom: 1.5rem;
    animation: tpPulso 3s ease-in-out infinite;
}

@keyframes tpPulso {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.1); filter: brightness(1.3) drop-shadow(0 0 20px rgba(236, 72, 153, 0.5)); }
}

.tp-destello {
    position: absolute;
    font-size: 1rem;
    opacity: 0;
    animation: tpDestello 3s ease-in-out infinite;
    pointer-events: none;
}

.tp-destello::before { content: '\2726'; }
.tp-d2::before { content: '\2756'; }
.tp-d3::before { content: '\2727'; }

.tp-d1 { animation-delay: -0.5s; top: -10px; left: 10px; }
.tp-d2 { animation-delay: -1.5s; top: -5px; right: 15px; }
.tp-d3 { animation-delay: -2.5s; bottom: 5px; left: 25px; }

@keyframes tpDestello {
    0%, 100% { opacity: 0; transform: translateY(0) scale(0.5); }
    50% { opacity: 0.8; transform: translateY(-20px) scale(1); }
}

.tp-titulo-form {
    color: #fff;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: var(--tp-gradiente);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tp-subtitulo-form {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2rem;
    font-size: 1rem;
}

.tp-form-nombre {
    max-width: 600px;
    margin: 0 auto 1.5rem;
    text-align: left;
}

.tp-label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.tp-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(236, 72, 153, 0.3);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--tp-transicion);
    box-sizing: border-box;
}

.tp-input:focus {
    outline: none;
    border-color: var(--tp-rosa);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15);
    background-color: rgba(255, 255, 255, 0.08);
}

.tp-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.tp-form-campos {
    display: flex;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto 1.5rem;
    align-items: flex-start;
}

.tp-campo {
    text-align: left;
    flex: 1;
    margin-bottom: 0;
}

.tp-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(236, 72, 153, 0.3);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--tp-transicion);
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23ec4899' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.tp-select:focus {
    outline: none;
    border-color: var(--tp-rosa);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15);
    background-color: rgba(255, 255, 255, 0.08);
}

.tp-select option {
    background: #1a1a2e;
    color: #fff;
}

.tp-btn-calcular {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--tp-gradiente);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.9rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--tp-transicion);
    margin-top: 1rem;
    font-family: inherit;
}

.tp-btn-calcular:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.3);
}

.tp-instruccion {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    margin-top: 1.5rem;
}

/* ================================================
   LOADING
   ================================================ */

.tp-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.tp-loading-orbita {
    width: 90px;
    height: 90px;
    position: relative;
    margin-bottom: 1.5rem;
}

.tp-orbita-centro {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    animation: tpGiroPulso 2s ease-in-out infinite;
}

@keyframes tpGiroPulso {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); filter: drop-shadow(0 0 15px rgba(236, 72, 153, 0.6)); }
}

.tp-orbita-arc {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 80px;
    height: 80px;
    border: 2px dashed rgba(236, 72, 153, 0.25);
    border-radius: 50%;
    animation: tpArcGiro 8s linear infinite;
}

@keyframes tpArcGiro {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.tp-loading-texto {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    animation: tpPulsoTexto 1.5s ease-in-out infinite;
}

@keyframes tpPulsoTexto {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ================================================
   FASE RESULTADO
   ================================================ */

.tp-resultado-contenido {
    padding: 2rem 1rem;
}

.tp-resultado-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(236, 72, 153, 0.2);
}

.tp-nombre-badge {
    display: inline-block;
    font-size: 1.1rem;
    color: #fff;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.tp-fecha-badge {
    display: inline-block;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(236, 72, 153, 0.1);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(236, 72, 153, 0.2);
}

.tp-seccion {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(236, 72, 153, 0.1);
    border-radius: var(--tp-radio);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    animation: tpSlideIn 0.6s ease both;
}

.tp-seccion:nth-child(1) { animation-delay: 0s; }
.tp-seccion:nth-child(2) { animation-delay: 0.1s; }
.tp-seccion:nth-child(3) { animation-delay: 0.2s; }
.tp-seccion:nth-child(4) { animation-delay: 0.3s; }

@keyframes tpSlideIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.tp-seccion-titulo {
    color: var(--tp-rosa);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* ================================================
   RESUMEN GRID
   ================================================ */

.tp-resumen-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.tp-resumen-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid;
    border-radius: 14px;
    padding: 1.5rem 0.8rem;
    text-align: center;
    transition: var(--tp-transicion);
}

.tp-resumen-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-3px);
}

.tp-resumen-icono {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.tp-resumen-num {
    display: inline-block;
    font-size: 2.5rem;
    font-weight: 800;
    width: 60px;
    height: 60px;
    line-height: 60px;
    border-radius: 50%;
    margin-bottom: 0.5rem;
}

.tp-resumen-nombre {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-weight: 600;
}

/* ================================================
   DESGLOSE NOMBRE
   ================================================ */

.tp-desglose-letras {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.tp-letra {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40px;
    border-radius: 10px;
    padding: 0.4rem 0;
    transition: var(--tp-transicion);
}

.tp-letra:hover {
    transform: translateY(-3px);
}

.tp-letra-char {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
}

.tp-letra-valor {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.7;
}

.tp-letra-vocal {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: #c4b5fd;
}

.tp-letra-consonante {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #fcd34d;
}

.tp-sumas-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.tp-suma-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    flex: 1;
    min-width: 160px;
}

.tp-suma-vocal {
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.tp-suma-consonante {
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.tp-suma-total {
    border: 1px solid rgba(236, 72, 153, 0.2);
}

.tp-suma-label {
    display: block;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.tp-suma-valor {
    display: block;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
}

/* ================================================
   DETALLES GRID
   ================================================ */

.tp-detalles-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.tp-detalle-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid;
    border-radius: 14px;
    overflow: hidden;
    transition: var(--tp-transicion);
}

.tp-detalle-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tp-detalle-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 1.2rem;
}

.tp-detalle-icono {
    font-size: 1.5rem;
}

.tp-detalle-num {
    font-size: 1.8rem;
    font-weight: 800;
}

.tp-detalle-nombre {
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
}

.tp-detalle-desc {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.8;
    font-size: 0.95rem;
    padding: 0 1.2rem 1rem;
    margin: 0;
}

.tp-detalle-esencia {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    padding: 0 1.2rem 0.8rem;
    margin: 0;
    font-style: italic;
}

.tp-detalle-rasgos {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1.2rem 1.2rem;
}

.tp-detalle-badge {
    font-size: 0.8rem;
    padding: 5px 12px;
    border-radius: 20px;
}

/* ================================================
   CONSEJO
   ================================================ */

.tp-consejo-general {
    background: rgba(236, 72, 153, 0.05);
    border: 1px solid rgba(236, 72, 153, 0.15);
    border-radius: var(--tp-radio);
    padding: 1.5rem;
    animation: tpSlideIn 0.6s ease both;
}

.tp-consejo-texto {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.8;
    font-size: 1rem;
}

/* ================================================
   NUEVA CONSULTA
   ================================================ */

.tp-btn-nueva {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 2px solid rgba(236, 72, 153, 0.3);
    border-radius: 50px;
    padding: 0.9rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--tp-transicion);
    font-family: inherit;
}

.tp-btn-nueva:hover {
    background: rgba(236, 72, 153, 0.15);
    border-color: var(--tp-rosa);
    transform: translateY(-2px);
}

/* ================================================
   PARTICULAS DE FONDO
   ================================================ */

.tp-app::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(236, 72, 153, 0.06) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(190, 24, 93, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(244, 114, 182, 0.03) 0%, transparent 50%);
    animation: tpFondo 25s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes tpFondo {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.tp-fase { position: relative; z-index: 1; }
.tp-loading { position: relative; z-index: 1; }

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

@media (max-width: 768px) {
    .tp-titulo-form { font-size: 1.6rem; }
    .tp-icono-oraculo { font-size: 3rem; }
    .tp-form-campos { flex-direction: column; }
    .tp-resumen-grid { grid-template-columns: repeat(3, 1fr); }
    .tp-resumen-grid .tp-resumen-item:nth-child(4),
    .tp-resumen-grid .tp-resumen-item:nth-child(5) {
        /* Last 2 items center in 3-col grid */
    }
}

@media (max-width: 480px) {
    .tp-form-contenido { padding: 1.5rem 0.5rem; }
    .tp-titulo-form { font-size: 1.4rem; }
    .tp-subtitulo-form { font-size: 0.85rem; }
    .tp-resultado-contenido { padding: 1.5rem 0.5rem; }
    .tp-seccion { padding: 1.2rem; }
    .tp-btn-nueva { padding: 0.8rem 1.5rem; font-size: 0.9rem; }
    .tp-btn-calcular { padding: 0.8rem 1.8rem; font-size: 0.9rem; }
    .tp-resumen-grid { grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
    .tp-resumen-num { font-size: 2rem; width: 50px; height: 50px; line-height: 50px; }
    .tp-resumen-icono { font-size: 1.4rem; }
    .tp-resumen-nombre { font-size: 0.75rem; }
    .tp-sumas-row { flex-direction: column; }
    .tp-desglose-letras { gap: 0.3rem; }
    .tp-letra { width: 34px; }
}

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

@media (prefers-reduced-motion: reduce) {
    .tp-app::before { animation: none; }
    .tp-icono-oraculo { animation: none; }
    .tp-destello { animation: none; display: none; }
    .tp-loading-orbita { animation: none; }
    .tp-loading-texto { animation: none; opacity: 1; }
    .tp-seccion { animation: none; opacity: 1; transform: none; }
    * { transition-duration: 0.05ms !important; animation-duration: 0.05ms !important; }
}

@media (prefers-contrast: high) {
    .tp-seccion { border: 2px solid rgba(255, 255, 255, 0.4); }
    .tp-select { border: 2px solid rgba(255, 255, 255, 0.4); }
    .tp-input { border: 2px solid rgba(255, 255, 255, 0.4); }
}

@media print {
    .tp-app::before { display: none; }
    .tp-btn-nueva { display: none; }
    .tp-seccion { break-inside: avoid; }
}