/**
 * calcolatori.css — Styles for the genetic calculators
 * Consistent with GenHub landing page (indigo→teal gradient titles)
 */

/* ---- Page layout ---- */
.calc-page {
    min-height: 100vh;
    background: #f8fafc;
    font-family: 'Funnel Display', system-ui, -apple-system, sans-serif;
}

.calc-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 6rem 1.5rem 3rem;
}

.calc-container h1 {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.75rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.calc-container h1 .grad {
    color: transparent;
    background: linear-gradient(90deg, #6366f1, #14b8a6);
    -webkit-background-clip: text;
    background-clip: text;
}

.calc-container .subtitle {
    font-size: 1.05rem;
    color: #334155;
    margin-bottom: 2.5rem;
    max-width: 680px;
    line-height: 1.65;
}

/* ---- Wizard / Step indicator ---- */
.calc-steps {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    align-items: center;
}

.calc-steps .step {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #64748b;
}

.calc-steps .step.active {
    color: #0f172a;
    font-weight: 600;
}

.calc-steps .step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    background: #e2e8f0;
    color: #475569;
}

.calc-steps .step.active .step-num {
    background: linear-gradient(135deg, #6366f1, #14b8a6);
    color: #fff;
}

.calc-steps .step-divider {
    width: 30px;
    height: 2px;
    background: #e2e8f0;
    margin: 0 0.25rem;
}

/* ---- Pedigree TREE (COI calculator) ---- */
.pedigree-tree-wrap {
    background: #fff;
    border-radius: 1.25rem;
    padding: 1.5rem 1rem 2rem;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    border: 1px solid #e2e8f0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pedigree-tree {
    position: relative;
    min-width: 720px;
    margin: 0 auto;
    padding: 0.5rem 0;
}

.tree-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}

.tree-svg line,
.tree-svg path {
    stroke: #cbd5e1;
    stroke-width: 1.5;
    fill: none;
}

.tree-svg path.father-line { stroke: #6366f1; stroke-opacity: 0.35; }
.tree-svg path.mother-line { stroke: #14b8a6; stroke-opacity: 0.35; }

.tree-gen {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    margin-bottom: 2.75rem;
}

.tree-gen:last-child {
    margin-bottom: 0.5rem;
}

.tree-gen-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    margin-bottom: 0.6rem;
    text-align: center;
}

.tree-nodes {
    display: flex;
    justify-content: center;
    gap: 0;
    width: 100%;
    padding: 0 0.5rem;
}

.tree-node {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 140px;
    margin: 0 auto;
}

.tree-card {
    width: 100%;
    max-width: 120px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.5rem 0.4rem 0.45rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    position: relative;
}

.tree-card:hover {
    border-color: #a5b4fc;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.12);
    transform: translateY(-1px);
}

.tree-card.is-subject {
    max-width: 160px;
    border-color: #6366f1;
    background: linear-gradient(180deg, #eef2ff 0%, #fff 100%);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
}

.tree-card.is-father-side {
    border-top: 3px solid #6366f1;
}

.tree-card.is-mother-side {
    border-top: 3px solid #14b8a6;
}

.tree-card.is-linked {
    border-color: #f59e0b;
    background: linear-gradient(180deg, #fffbeb 0%, #fff 100%);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
}

.tree-card.is-linked::after {
    content: 'comune';
    position: absolute;
    top: -8px;
    right: -6px;
    background: #f59e0b;
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tree-role {
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.3rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-card.is-subject .tree-role {
    color: #4f46e5;
}

.tree-card.is-father-side .tree-role { color: #6366f1; }
.tree-card.is-mother-side .tree-role { color: #0d9488; }

.tree-card .node-input {
    width: 100%;
    padding: 0.35rem 0.4rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.4rem;
    font-size: 0.75rem;
    font-family: inherit;
    text-align: center;
    background: #f8fafc;
    color: #0f172a;
    box-sizing: border-box;
    transition: border-color 0.2s, background 0.2s;
}

.tree-card .node-input:focus {
    outline: none;
    border-color: #6366f1;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.tree-card .node-input::placeholder {
    color: #94a3b8;
    font-size: 0.7rem;
}

/* (combo "stesso di" rimossa — matching automatico per anello) */

.tree-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.25rem;
    font-size: 0.75rem;
    color: #475569;
}

.tree-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.tree-legend .swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.tree-legend .swatch.padre { background: #6366f1; }
.tree-legend .swatch.madre { background: #14b8a6; }
.tree-legend .swatch.link { background: #f59e0b; }

.calc-hint {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.5;
}

.calc-hint strong {
    color: #0f172a;
}

/* ---- Calculate button ---- */
.btn-calculate {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #6366f1, #14b8a6);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.85rem 2rem;
    border: none;
    border-radius: 2.5rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
    margin-top: 1.5rem;
}

.btn-calculate:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-calculate:active {
    transform: translateY(0);
}

/* ---- Result cards ---- */
.result-card {
    animation: fadeSlideIn 0.4s ease;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

#coi-result, #genetic-result {
    margin-top: 1.5rem;
}

/* ---- Hook card ---- */
.hook-card {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #eef2ff, #ecfdf5);
    border: 1.5px solid #6366f1;
    border-radius: 1rem;
    animation: fadeSlideIn 0.5s ease 0.15s both;
}

.hook-card h3 {
    color: #0f172a !important;
}

.hook-card li {
    color: #334155 !important;
}

.hook-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

/* ---- Locus cards (genetic calculator) ---- */
.locus-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1rem;
}

.locus-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.locus-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

.locus-card.sex-linked {
    border-left: 3px solid #8b5cf6;
}

.locus-card.autosomal {
    border-left: 3px solid #14b8a6;
}

.locus-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.locus-name {
    font-weight: 700;
    font-size: 1rem;
    color: #0f172a;
}

.locus-type-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-weight: 600;
    background: #f1f5f9;
    color: #334155;
}

.locus-body {
    font-size: 0.85rem;
}

.parent-selects {
    display: flex;
    gap: 1rem;
}

.parent-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.parent-col label {
    color: #475569 !important;
    font-weight: 600;
}

.allele-select {
    padding: 0.4rem 0.5rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.4rem;
    font-size: 0.8rem;
    font-family: inherit;
    background: #f8fafc;
    color: #0f172a;
    cursor: pointer;
}

.allele-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}

/* ---- Genetic results table ---- */
.genetic-results {
    background: #fff;
    border-radius: 1rem;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.genetic-results h4 {
    color: #0f172a !important;
}

.genetic-results table {
    border-radius: 0.5rem;
    overflow: hidden;
}

.genetic-results th {
    background: #f1f5f9;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
}

.genetic-results td {
    color: #1e293b;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .calc-container {
        padding: 5rem 1rem 2rem;
        max-width: 100%;
    }

    .calc-container h1 {
        font-size: 1.6rem;
    }

    .pedigree-tree {
        min-width: 640px;
    }

    .tree-card {
        max-width: 100px;
        padding: 0.4rem 0.3rem;
    }

    .tree-card.is-subject {
        max-width: 120px;
    }

    .tree-card .node-input {
        font-size: 0.7rem;
        padding: 0.3rem;
    }

    .tree-role {
        font-size: 0.55rem;
    }

    .tree-gen {
        margin-bottom: 2.25rem;
    }

    .locus-cards {
        grid-template-columns: 1fr;
    }

    .parent-selects {
        flex-direction: column;
    }
}


/* ---- SEO landing content under calculators ---- */
.calc-seo {
  margin-top: 3rem;
  padding: 1.75rem 1.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  max-width: 720px;
}
.calc-seo h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 0.75rem;
}
.calc-seo h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin: 1.25rem 0 0.5rem;
}
.calc-seo p, .calc-seo li {
  color: #475569;
  line-height: 1.65;
  font-size: 0.95rem;
}
.calc-seo ul {
  margin: 0.75rem 0 0;
  padding-left: 1.2rem;
}
.calc-seo-faq {
  border-top: 1px solid #e2e8f0;
  padding: 0.65rem 0;
}
.calc-seo-faq summary {
  cursor: pointer;
  font-weight: 600;
  color: #0f172a;
}
.calc-seo-faq p {
  margin: 0.5rem 0 0;
}
.calc-seo-related {
  margin-top: 1.25rem !important;
}
.calc-seo-related a {
  color: #4f46e5;
  text-decoration: underline;
}
