:root {
    --primary: #f59e0b;
    --primary-hover: #d97706;
    --bg-color: #18181b;
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
    --border-color: #3f3f46;
    --accent-bg: #27272a;
    --error: #ef4444;
    --success: #10b981;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: #09090b;
    /* Background just for viewing standalone */
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.calculator-widget {
    background: var(--bg-color);
    width: 100%;
    max-width: 800px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, #27272a, #18181b);
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.header p {
    font-size: 0.95rem;
    opacity: 0.9;
}

.upload-section {
    padding: 2rem;
    text-align: center;
}

.file-input {
    display: none;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 2.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--accent-bg);
}

.upload-label:hover {
    border-color: var(--primary);
    background: rgba(245, 158, 11, 0.1);
}

.upload-label svg {
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-text {
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.upload-subtext {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.error-msg {
    margin: 0 2rem;
    padding: 1rem;
    background: #fef2f2;
    color: var(--error);
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    border: 1px solid #fecaca;
}

.hidden {
    display: none !important;
}

.calc-body {
    display: flex;
    flex-direction: column;
    padding: 0 2rem 2rem;
    gap: 2rem;
}

.calc-top-row {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 640px) {
    .calc-top-row {
        flex-direction: row;
    }

    .form-inputs-row {
        display: flex;
        gap: 1rem;
    }

    .form-inputs-row>* {
        flex: 1;
    }
}

.preview-container {
    flex: 1;
    min-height: 300px;
    background: var(--accent-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

#stl-viewer {
    width: 100%;
    height: 100%;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: var(--primary);
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.controls-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.95rem;
}

.scale-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.range-slider {
    flex: 1;
    accent-color: var(--primary);
}

.number-input,
.select-input {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
    font-family: inherit;
    background: var(--bg-color);
    color: var(--text-main);
}

.select-input {
    width: auto;
    flex: 1;
}

.results-card {
    background: var(--accent-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.result-value {
    font-weight: 600;
    color: var(--text-main);
}

.price-card {
    background: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.price-label {
    color: var(--primary);
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.price-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.price-disclaimer {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.quote-form-container {
    background: var(--accent-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
}

.quote-heading {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    text-align: center;
    margin-bottom: 0.5rem;
}

#quote-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    background: var(--bg-color);
    color: var(--text-main);
}

.form-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.submit-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.submit-btn:hover {
    background: var(--primary-hover);
}

.submit-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

.full-width {
    width: 100%;
}

.form-status {
    text-align: center;
    font-size: 0.9rem;
    padding: 0.75rem;
    border-radius: 6px;
}

.form-status.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.form-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}