/* ============================================================
   ToolHub — Stili UI dei tool
   ============================================================ */

/* ============ FORM CONTROLS ============ */
.tool-form {
    display: grid;
    gap: 16px;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}
.form-field {
    display: flex; flex-direction: column;
    gap: 6px;
}
.form-field label {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-soft);
}
.form-field input,
.form-field select,
.form-field textarea {
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
    background: var(--surface);
}
.form-field textarea {
    font-family: var(--mono);
    min-height: 180px;
    resize: vertical;
    line-height: 1.5;
}
.form-field .hint {
    font-size: 0.78rem;
    color: var(--muted);
}

/* Checkbox row */
.check-row {
    display: flex; flex-wrap: wrap;
    gap: 12px 18px;
    padding: 6px 0;
}
.check-item {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.9rem;
    color: var(--text-soft);
    cursor: pointer;
}
.check-item input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* Range slider */
.range-row {
    display: flex; align-items: center; gap: 12px;
}
.range-row input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
}
.range-row .range-val {
    min-width: 42px;
    text-align: center;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.9rem;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-row {
    display: flex; gap: 10px; flex-wrap: wrap;
}

/* ============ OUTPUT / RESULT ============ */
.result-box {
    margin-top: 20px;
    padding: 20px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.result-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin-bottom: 8px;
}
.result-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    word-break: break-all;
    font-family: var(--mono);
}
.result-value.big {
    font-size: 2.4rem;
}
.result-meta {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-soft);
}

.output-code {
    margin-top: 18px;
    background: #0f1320;
    color: #e6eaf5;
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: var(--mono);
    font-size: 0.88rem;
    line-height: 1.55;
    overflow-x: auto;
    white-space: pre;
    max-height: 400px;
    overflow-y: auto;
}
[data-theme="dark"] .output-code {
    background: #0a0e1a;
    border: 1px solid var(--border);
}

.copy-btn {
    margin-top: 10px;
    font-size: 0.85rem;
    padding: 8px 16px;
}

/* ============ STRENGTH METER (password) ============ */
.strength {
    margin-top: 14px;
}
.strength-bar {
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 6px;
}
.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    transition: width .3s, background .3s;
}
.strength-text {
    font-size: 0.85rem;
    font-weight: 600;
}

/* ============ QR DISPLAY ============ */
.qr-display {
    margin-top: 20px;
    text-align: center;
}
.qr-display img,
.qr-display canvas {
    background: #fff;
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    max-width: 100%;
}
.qr-empty {
    color: var(--muted);
    padding: 40px;
    text-align: center;
    background: var(--surface-2);
    border-radius: var(--radius);
}

/* ============ BMI SCALE ============ */
.bmi-scale {
    margin-top: 18px;
}
.bmi-bar {
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(to right,
        #3b82f6 0% 25%,
        #16a34a 25% 50%,
        #fbbf24 50% 75%,
        #dc2626 75% 100%);
    position: relative;
}
.bmi-marker {
    position: absolute;
    top: -4px;
    width: 4px;
    height: 22px;
    background: var(--text);
    border-radius: 2px;
    transform: translateX(-50%);
    transition: left .3s;
}
.bmi-legend {
    display: flex; justify-content: space-between;
    font-size: 0.72rem;
    margin-top: 6px;
    color: var(--muted);
}

/* ============ ALERT / ERROR ============ */
.alert {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    display: none;
}
.alert.show { display: block; }
.alert-error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}
[data-theme="dark"] .alert-error {
    background: rgba(220,38,38,0.15);
    border-color: rgba(220,38,38,0.3);
}
.alert-success {
    background: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
}
[data-theme="dark"] .alert-success {
    background: rgba(22,163,74,0.15);
    border-color: rgba(22,163,74,0.3);
}

/* ============ STATS CARDS ============ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 18px;
}
.stat-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}
.stat-card .label {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-card .value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    margin-top: 4px;
}
