/* Mode tabs */
.tipo-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}

.tipo-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.1rem;
    border: 2px solid var(--border, #e2e8f0);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted, #64748b);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s, color 0.18s;
}

.tipo-tab:hover {
    border-color: var(--primary, #2563eb);
    color: var(--primary, #2563eb);
}

.tipo-tab.active {
    border-color: var(--primary, #2563eb);
    background: var(--primary, #2563eb);
    color: #fff;
}

.tipo-tab i {
    font-size: 0.8rem;
}

/* FORM GRID */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
}

.field-full {
    grid-column: 1 / -1;
}

/* Visual pH Scale */
.ph-scale-wrap {
    margin: 1.75rem 0 0.25rem;
}

.ph-scale-wrap h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    margin-bottom: 0.6rem;
    font-family: 'Montserrat', sans-serif;
}

.ph-scale-bar {
    position: relative;
    height: 28px;
    border-radius: 14px;
    background: linear-gradient(to right,
            #dc2626 0%,
            /* pH 0 */
            #f97316 8.33%,
            /* pH 1 */
            #fb923c 16.67%,
            /* pH 2 */
            #fbbf24 25%,
            /* pH 3 */
            #facc15 33.33%,
            /* pH 4 */
            #a3e635 41.67%,
            /* pH 5 */
            #4ade80 50%,
            /* pH 7 */
            #34d399 58.33%,
            /* pH 8 */
            #22d3ee 66.67%,
            /* pH 9 */
            #38bdf8 75%,
            /* pH 10 */
            #60a5fa 83.33%,
            /* pH 11 */
            #818cf8 91.67%,
            /* pH 12 */
            #a78bfa 100%
            /* pH 14 */
        );
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.ph-scale-marker {
    position: absolute;
    top: -6px;
    transform: translateX(-50%);
    width: 14px;
    height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    pointer-events: none;
    transition: left 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ph-scale-marker::before {
    content: '';
    width: 3px;
    height: 40px;
    background: #1e293b;
    border-radius: 2px;
}

.ph-scale-marker-label {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    background: #fff;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.ph-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    padding: 0 2px;
}

.ph-scale-zones {
    display: flex;
    justify-content: space-between;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
}

.ph-zone-acid {
    color: #dc2626;
}

.ph-zone-neutral {
    color: #16a34a;
}

.ph-zone-base {
    color: #7c3aed;
}

/* Clasification badge*/
.ph-classification {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    border-radius: 20px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    margin-top: 1rem;
}

.ph-class-acido-fuerte {
    background: #fee2e2;
    color: #991b1b;
}

.ph-class-acido {
    background: #ffedd5;
    color: #9a3412;
}

.ph-class-acido-debil {
    background: #fef9c3;
    color: #854d0e;
}

.ph-class-neutro {
    background: #dcfce7;
    color: #166534;
}

.ph-class-base-debil {
    background: #dbeafe;
    color: #1e40af;
}

.ph-class-base {
    background: #ede9fe;
    color: #5b21b6;
}

.ph-class-base-fuerte {
    background: #fae8ff;
    color: #701a75;
}

/* Table of common substances */
.ref-table-wrap {
    margin-top: 1.5rem;
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border, #e2e8f0);
}

.ref-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.ref-table-wrap thead {
    background: var(--primary, #2563eb);
    color: #fff;
}

.ref-table-wrap thead th {
    padding: 0.6rem 1rem;
    text-align: left;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    white-space: nowrap;
}

.ref-table-wrap tbody tr:nth-child(even) {
    background: var(--bg-alt, #f8fafc);
}

.ref-table-wrap tbody td {
    padding: 0.5rem 1rem;
    color: var(--text, #1e293b);
    border-bottom: 1px solid var(--border, #e2e8f0);
    vertical-align: middle;
}

.ref-table-wrap tbody tr:last-child td {
    border-bottom: none;
}

.ref-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.4rem;
    vertical-align: middle;
}

/* Result formulas */
.formula-used {
    margin-top: 1.25rem;
}

.formula-used .formula-box,
.seo-block .formula-box {
    background: var(--bg-formula, #f1f5f9);
    border-left: 4px solid var(--primary, #2563eb);
    border-radius: 0 8px 8px 0;
    padding: 0.75rem 1.1rem;
    margin: 0.75rem 0 1rem;
    overflow-x: auto;
}

.formula-used .formula-box code,
.seo-block .formula-box code {
    font-size: 0.95rem;
    color: var(--primary, #2563eb);
    font-weight: 600;
    white-space: nowrap;
}

.formula-legend {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.4rem 1rem;
}

.formula-legend li {
    font-size: 0.875rem;
    color: var(--text-muted, #64748b);
}

.formula-legend strong {
    color: var(--text, #1e293b);
}

/* Responsive */
@media (max-width: 600px) {
    .tipo-tabs {
        gap: 0.4rem;
    }

    .tipo-tab {
        flex: 1 1 auto;
        justify-content: center;
        font-size: 0.8rem;
        padding: 0.5rem 0.6rem;
    }

    .ph-scale-labels span:not(:first-child):not(:last-child):not(:nth-child(4)) {
        display: none;
    }

    .formula-legend {
        grid-template-columns: 1fr;
    }
}