/* Plugin Eneagrama Marcos Oliva - Frontend CSS */

.emo-app {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #1a1a1a;
    max-width: 800px;
    margin: 30px auto;
    padding: 0 16px;
    box-sizing: border-box;
}

.emo-app *, .emo-app *::before, .emo-app *::after {
    box-sizing: border-box;
}

.emo-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px 28px;
    box-shadow: 0 4px 18px rgba(26, 58, 82, 0.08);
    border: 1px solid #e8ede9;
}

.emo-h1 {
    color: #2f3a34;
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.emo-h2 {
    color: #2f3a34;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px 0;
}

.emo-intro {
    color: #4a4a4a;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* Form */
.emo-field {
    margin-bottom: 20px;
}

.emo-label {
    display: block;
    font-weight: 600;
    color: #2f3a34;
    font-size: 14px;
    margin-bottom: 8px;
}

.emo-required {
    color: #d04545;
}

.emo-input,
.emo-select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #d8dde3;
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px; /* 16px en mobile evita zoom automático en iOS */
    background: #ffffff;
    color: #1a1a1a;
    transition: border-color 0.15s;
    line-height: 1.4;
    min-height: 48px; /* Suficiente alto para que el texto se vea completo */
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Flecha custom para selects (porque appearance:none la elimina) */
.emo-select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' width='12' height='8'%3E%3Cpath fill='%232f3a34' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 8px;
    padding-right: 38px;
    text-overflow: ellipsis;
}

/* Grid para los 3 selects de fecha (Día / Mes / Año) */
.emo-fecha-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 8px;
}

.emo-fecha-grid .emo-select {
    /* Cada select del grid usa el ancho de su columna */
    min-width: 0;
}

.emo-input:focus,
.emo-select:focus {
    outline: none;
    border-color: #2f3a34;
}

.emo-input.emo-error,
.emo-select.emo-error {
    border-color: #d04545;
}

.emo-error-msg {
    color: #d04545;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.emo-error-msg.visible {
    display: block;
}

.emo-radio-group {
    display: flex;
    gap: 24px;
    margin-top: 6px;
}

.emo-radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.emo-radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #2f3a34;
}

/* Botones */
.emo-btn {
    display: inline-block;
    padding: 12px 28px;
    background: #2f3a34;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
    text-decoration: none;
}

.emo-btn:hover {
    background: #415148;
}

.emo-btn:active {
    transform: translateY(1px);
}

.emo-btn:disabled {
    background: #b0b8c0;
    cursor: not-allowed;
}

.emo-btn-secondary {
    background: #ffffff;
    color: #2f3a34;
    border: 1.5px solid #2f3a34;
}

.emo-btn-secondary:hover {
    background: #e8ede9;
}

.emo-actions {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-top: 24px;
}

/* Barra de progreso */
.emo-progress {
    margin-bottom: 24px;
}

.emo-progress-text {
    font-size: 13px;
    color: #4a4a4a;
    margin-bottom: 6px;
    font-weight: 500;
}

.emo-progress-bar {
    width: 100%;
    height: 8px;
    background: #e8ede9;
    border-radius: 4px;
    overflow: hidden;
}

.emo-progress-fill {
    height: 100%;
    background: #2f3a34;
    transition: width 0.3s ease;
}

/* Afirmación (consigna 1) */
.emo-afirmacion-card {
    text-align: center;
    padding: 30px 20px;
}

.emo-afirmacion-num {
    font-size: 13px;
    color: #6a7280;
    font-weight: 500;
    margin-bottom: 12px;
}

.emo-afirmacion-texto {
    font-size: 22px;
    line-height: 1.4;
    color: #1a1a1a;
    font-weight: 500;
    margin: 24px 0;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emo-afirmacion-botones {
    display: flex;
    gap: 14px;
    justify-content: center;
    margin-top: 32px;
}

.emo-btn-respuesta {
    flex: 1;
    max-width: 200px;
    padding: 14px 20px;
}

.emo-btn-si {
    background: #2f3a34;
}

.emo-btn-no {
    background: #ffffff;
    color: #2f3a34;
    border: 1.5px solid #2f3a34;
}

/* Frases (consigna 2) */
.emo-frase-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    border: 1.5px solid #d8dde3;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.emo-frase-item:hover {
    border-color: #2f3a34;
    background: #fafcfd;
}

.emo-frase-item.selected {
    border-color: #2f3a34;
    background: #e8ede9;
}

.emo-frase-rank {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    border: 1.5px solid #d8dde3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #6a7280;
    font-size: 16px;
}

.emo-frase-item.selected .emo-frase-rank {
    background: #2f3a34;
    color: #ffffff;
    border-color: #2f3a34;
}

.emo-frase-texto {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: #1a1a1a;
    align-self: center;
}

/* Verbos (consigna 3) */
.emo-verbos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.emo-verbo-item {
    padding: 18px 12px;
    border: 1.5px solid #d8dde3;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    color: #1a1a1a;
    transition: all 0.15s;
    position: relative;
    background: #ffffff;
}

.emo-verbo-item:hover {
    border-color: #2f3a34;
}

.emo-verbo-item.mas {
    border-color: #2f3a34;
    background: #2f3a34;
    color: #ffffff;
}

.emo-verbo-item.menos {
    border-color: #d04545;
    background: #fff0f0;
    color: #d04545;
}

.emo-verbo-marker {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.emo-verbo-instrucciones {
    background: #fafcfd;
    border-left: 4px solid #2f3a34;
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    color: #4a4a4a;
    margin-bottom: 18px;
}

/* Resultado */
.emo-resultado-svg {
    text-align: center;
    margin: 20px 0;
}

.emo-resultado-svg svg {
    max-width: 420px;
    width: 100%;
    height: auto;
}

.emo-resultado-tabla {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 18px;
    font-size: 14px;
}

.emo-resultado-tabla td {
    border: 1px solid #2f3a34;
    padding: 8px 12px;
    vertical-align: middle;
}

.emo-resultado-tabla .label {
    background: #e8ede9;
    font-weight: 700;
    color: #2f3a34;
    width: 30%;
}

/* Grid de 2 columnas para resumen + ranking en escritorio */
.emo-resultado-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 16px;
}

.emo-resultado-col h2.emo-h2 {
    margin-top: 0;
}

/* Ranking */
.emo-ranking td {
    padding: 8px 10px;
}

.emo-ranking .emo-pos {
    background: #e8ede9;
    font-weight: 700;
    color: #2f3a34;
    width: 50px;
    text-align: center;
}

.emo-ranking .emo-puntaje {
    font-weight: 700;
    text-align: right;
    width: 60px;
}

.emo-ranking .emo-fila-dominante {
    background: #fafcfd;
}

.emo-ranking .emo-fila-dominante td {
    font-weight: 700;
    color: #2f3a34;
}

.emo-resultado-acciones {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* Loader */
.emo-loader {
    text-align: center;
    padding: 40px 20px;
    color: #6a7280;
}

.emo-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #e8ede9;
    border-top-color: #2f3a34;
    border-radius: 50%;
    animation: emo-spin 0.8s linear infinite;
}

@keyframes emo-spin {
    to { transform: rotate(360deg); }
}

/* Mobile */
@media (max-width: 600px) {
    .emo-card {
        padding: 22px 18px;
        border-radius: 8px;
    }

    .emo-h1 {
        font-size: 20px;
    }

    .emo-afirmacion-texto {
        font-size: 18px;
    }

    .emo-verbos-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .emo-actions {
        flex-direction: column-reverse;
    }

    .emo-actions .emo-btn {
        width: 100%;
    }

    .emo-afirmacion-botones {
        flex-direction: column;
    }

    .emo-btn-respuesta {
        max-width: 100%;
    }

    .emo-resultado-grid {
        grid-template-columns: 1fr;
    }

    .emo-fecha-grid {
        gap: 6px;
    }

    .emo-fecha-grid .emo-select {
        padding-left: 10px;
        padding-right: 28px;
        background-position: right 8px center;
    }
}
