/* ================================================
   GEMATRIA - APP STYLES
   ================================================ */

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

    position: relative;
    overflow: hidden;
}

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

.gm-fase {
    animation: gmFadeIn 0.6s ease;
}

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

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

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

@keyframes gmBrillar {
    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)); }
}

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

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

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

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

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

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

.gm-form-input {
    max-width: 500px;
    margin: 0 auto 1.5rem;
}

.gm-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(236, 72, 153, 0.3);
    border-radius: 50px;
    padding: 1rem 1.5rem;
    color: #fff;
    font-family: inherit;
    font-size: 1.1rem;
    text-align: center;
    transition: var(--gm-transicion);
    box-sizing: border-box;
}

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

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

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

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

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

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

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

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

.gm-orbita-letra {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 45px;
    height: 45px;
    background: var(--gm-gradiente);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: #fff;
    animation: gmPulsoNum 2s ease-in-out infinite;
}

@keyframes gmPulsoNum {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.15); }
}

.gm-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: gmArcGiro 8s linear infinite;
}

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

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

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

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

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

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

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

.gm-valor-grande {
    margin-bottom: 0.3rem;
}

.gm-num-grande-num {
    font-size: 5rem;
    font-weight: 800;
    background: var(--gm-gradiente);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.gm-valor-nombre {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.3rem;
}

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

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

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

.gm-titulo-desglose { color: var(--gm-rosa); }
.gm-titulo-arquetipos { color: var(--gm-violeta); }
.gm-titulo-significado { color: #f59e0b; }

.gm-card-desc {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.8;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

/* Letter breakdown */
.gm-desglose-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.gm-letra-item {
    width: 55px;
    text-align: center;
    border-radius: 10px;
    padding: 0.5rem 0.3rem;
}

.gm-letra-char {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

.gm-letra-valor {
    font-size: 1rem;
    font-weight: 800;
}

.gm-letra-tipo {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

.gm-desglose-leyenda {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.gm-leyenda-vocal {
    color: #ec4899;
}

.gm-leyenda-consonante {
    color: #8b5cf6;
}

.gm-leyenda-total {
    color: #f59e0b;
}

/* Archetypes */
.gm-arquetipos-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.gm-arquetipo-item {
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1.2rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.gm-arquetipo-icono {
    font-size: 2rem;
    margin-bottom: 0.3rem;
}

.gm-arquetipo-numero {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.3rem;
}

.gm-arquetipo-nombre {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.gm-arquetipo-sub {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.gm-arquetipo-desc {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.gm-arquetipo-significado {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
}

/* Value display */
.gm-valor-display {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 0.5rem;
}

.gm-valor-total,
.gm-valor-reducido {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
}

.gm-valor-total strong,
.gm-valor-reducido strong {
    color: #f59e0b;
}

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

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

/* New consultation button */
.gm-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(--gm-transicion);
    font-family: inherit;
}

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

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

.gm-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(139, 92, 246, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(190, 24, 93, 0.03) 0%, transparent 50%);
    animation: gmFondo 25s linear infinite;
    pointer-events: none;
    z-index: 0;
}

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

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

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

@media (max-width: 768px) {
    .gm-titulo-form { font-size: 1.6rem; }
    .gm-icono-oraculo { font-size: 3rem; }
    .gm-arquetipos-grid { grid-template-columns: 1fr; }
    .gm-desglose-grid { gap: 0.3rem; }
    .gm-letra-item { width: 48px; }
}

@media (max-width: 480px) {
    .gm-form-contenido { padding: 1.5rem 0.5rem; }
    .gm-titulo-form { font-size: 1.4rem; }
    .gm-subtitulo-form { font-size: 0.85rem; }
    .gm-resultado-contenido { padding: 1.5rem 0.5rem; }
    .gm-seccion { padding: 1.2rem; }
    .gm-btn-nueva { padding: 0.8rem 1.5rem; font-size: 0.9rem; }
    .gm-btn-calcular { padding: 0.8rem 1.8rem; font-size: 0.9rem; }
    .gm-num-grande-num { font-size: 3.5rem; }
    .gm-input { font-size: 1rem; padding: 0.8rem 1.2rem; }
    .gm-letra-item { width: 42px; }
    .gm-desglose-leyenda { flex-direction: column; align-items: center; gap: 0.5rem; }
    .gm-valor-display { flex-direction: column; gap: 0.5rem; }
}

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

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

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

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