/* Ranger 3D Retract Calibrator — estilos padronizados */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    color: #333;
    line-height: 1.5;
    min-height: 100vh;
    padding: 15px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 24px;
    padding: 15px;
}

header h1 {
    margin: 0 0 8px;
    font-size: 2rem;
    background: linear-gradient(90deg, #e94560, #c73e54);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    margin: 0;
    color: #666;
    font-size: 1rem;
}

form {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 24px;
    border: 1px solid #e0e0e0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

fieldset {
    border: 1px solid #dbe3ea;
    border-radius: 8px;
    padding: 16px;
    margin: 0;
}

legend {
    font-weight: 700;
    color: #e94560;
    padding: 0 8px;
}

label {
    display: block;
    margin-top: 12px;
    font-size: 0.95rem;
    color: #333;
}

label:first-child {
    margin-top: 0;
}

.radio-group,
.check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    margin-right: 12px;
    cursor: pointer;
    font-weight: 500;
}

.radio-group input,
.check input {
    margin: 0;
    cursor: pointer;
}

.val {
    float: right;
    font-weight: 700;
    color: #e94560;
}

input[type="number"],
input[type="range"],
select {
    width: 100%;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid #cbd5df;
    border-radius: 6px;
    font-size: 0.95rem;
    background: #fafbfc;
}

input[type="range"] {
    padding: 0;
}

input:focus {
    outline: none;
    border-color: #e94560;
    background: #fff;
}

.hidden {
    display: none !important;
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.preview {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #e1e7ec;
}

.preview h2 {
    margin: 0 0 16px;
    font-size: 1.2rem;
    color: #e94560;
}

.labels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
}

.labels div {
    background: #fff0f2;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    font-size: 0.9rem;
    border: 1px solid #f8d7da;
}

.labels span {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 4px;
}

.labels b {
    display: block;
    font-size: 1.1rem;
    color: #e94560;
}

.actions {
    margin-top: 28px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

button {
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary {
    background: #e94560;
    color: #fff;
}

.btn-primary:hover {
    background: #c73e54;
}

.btn-secondary {
    background: #e1e7ec;
    color: #333;
}

.btn-secondary:hover {
    background: #d1d9e0;
}

button:active {
    transform: translateY(1px);
}

footer {
    text-align: center;
    margin-top: 24px;
    color: #666;
    font-size: 0.9rem;
}

footer a {
    color: #e94560;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* ---------- Pré-visualização 3D ---------- */
.preview-3d {
    margin-top: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
    padding: 20px;
}

.preview-3d h2 {
    margin: 0 0 16px;
    font-size: 1.2rem;
    color: #e94560;
}

#previewCanvasWrap {
    position: relative;
    width: 100%;
    height: 500px;
    background: #111;
    border-radius: 8px;
    overflow: hidden;
}

#previewStats {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.6);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #ccc;
    pointer-events: none;
    z-index: 2;
}

.preview-legend {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.75);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #eee;
    z-index: 2;
}

.preview-legend .legend-title { margin-bottom: 6px; color: #fff; }

.speed-gradient {
    width: 160px;
    height: 12px;
    border-radius: 2px;
    background: linear-gradient(90deg, #4444ff, #00ffff, #44ff44, #ffff00, #ff4444);
    margin-bottom: 4px;
}

.speed-labels { display: flex; justify-content: space-between; font-size: 0.65rem; color: #aaa; }

.preview-actions {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    .container {
        padding: 12px;
    }

    form {
        padding: 16px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .radio-group,
    .check {
        display: flex;
        margin-right: 0;
    }
}
