/* =============================================
   TRIANGLE CALCULATOR — triangle.css
   Tool-specific styles only.
   Common styles are in tool.css
   ============================================= */

.tri-calc { width: 100%; }

/* Angle unit toggle row */
.tri-angle-unit-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.tri-unit-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
}
.tri-unit-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.tri-unit-btn {
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    background: var(--white);
    color: var(--muted);
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.2s;
}
.tri-unit-btn.active { background: var(--navy); color: #fff; }
.tri-unit-btn:hover:not(.active) { background: var(--light); color: var(--navy); }
.tri-hint {
    font-size: 12px;
    color: var(--muted);
    font-style: italic;
}

/* Visual triangle wrap */
.tri-visual-wrap {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto 20px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-sizing: border-box;
}

/* Canvas */
.tri-canvas {
    display: block;
    width: 100%;
    height: auto;
    max-height: 260px;
}

/* Field positioning */
.tri-field {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Angle C — top center */
.tri-field-C {
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: column;
    align-items: center;
}

/* Side b — left */
.tri-field-b {
    top: 42%;
    left: 8px;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

/* Side a — right */
.tri-field-a {
    top: 42%;
    right: 8px;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

/* Angle A — bottom left */
.tri-field-A {
    bottom: 14px;
    left: 12px;
    flex-direction: column;
    align-items: center;
}

/* Side c — bottom center */
.tri-field-c {
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: column;
    align-items: center;
}

/* Angle B — bottom right */
.tri-field-B {
    bottom: 14px;
    right: 12px;
    flex-direction: column;
    align-items: center;
}

/* Vertex label */
.tri-vertex-label {
    font-size: 13px;
    font-weight: 800;
    color: var(--navy);
    width: 18px;
    height: 18px;
    background: var(--teal);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
}

/* Inputs */
.tri-side-input,
.tri-angle-input {
    width: 64px;
    padding: 5px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--font-mono);
    color: var(--text);
    background: var(--white);
    outline: none;
    text-align: center;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.tri-side-input:focus,
.tri-angle-input:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(0,201,167,0.15); }

.tri-side-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--teal);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.tri-unit-badge {
    font-size: 10px;
    color: var(--muted);
    font-weight: 600;
}

/* Actions */
.tri-actions { margin-top: 4px; justify-content: center; }

/* Result box */
.tri-result-box {
    margin-top: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.tri-result-header {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 10px 18px;
}

/* Type badges */
.tri-type-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px 8px;
    flex-wrap: wrap;
}
.tri-type-badge {
    padding: 4px 12px;
    background: var(--navy);
    color: #fff;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.tri-type-side { background: var(--teal); color: var(--navy); }
.tri-type-label { font-size: 14px; color: var(--text2); font-weight: 600; }

/* Result grid */
.tri-result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 8px 16px 16px;
}
.tri-res-card {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}
.tri-res-card.highlight {
    background: #f0fdf9;
    border-color: var(--teal);
}
.tri-res-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.tri-res-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--navy);
    font-family: var(--font-mono);
}
.tri-res-card.highlight .tri-res-value { color: var(--teal); font-size: 17px; }

/* Result canvas */
.tri-canvas-result-wrap {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}
.tri-canvas-result-wrap canvas {
    width: 100%;
    height: auto;
    border-radius: 8px;
    background: var(--light);
}

/* Error */
.tri-error {
    padding: 16px 20px;
    color: #dc2626;
    font-size: 14px;
    font-weight: 600;
    background: #fff5f5;
    border-left: 4px solid #dc2626;
    margin: 12px 16px;
    border-radius: 6px;
}

@media (max-width: 600px) {
    .tri-result-grid { grid-template-columns: repeat(2, 1fr); }
    .tri-side-input, .tri-angle-input { width: 52px; font-size: 11px; }
    .tri-visual-wrap { padding: 14px; }
}
