/* Scoped styles for the toothpaste calculator to prevent conflicts */
#toothpaste-calculator-container {
    --tp-primary-color: #4a90e2;
    --tp-secondary-color: #50e3c2;
    --tp-bg-color: #f4f7f6;
    --tp-card-bg: #ffffff;
    --tp-text-dark: #333333;
    --tp-text-light: #6c757d;
    --tp-border-color: #dee2e6;
    --tp-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    --tp-border-radius: 15px;
    
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--tp-bg-color);
    padding: 25px;
    border-radius: var(--tp-border-radius);
    box-shadow: var(--tp-shadow);
    margin: 20px auto;
    max-width: 900px;
    color: var(--tp-text-dark);
    overflow: hidden;
    border: 1px solid #e7eaf3;
}

.tp-calc-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--tp-border-color);
    padding-bottom: 20px;
}

.tp-calc-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--tp-primary-color);
    margin: 0 0 10px 0;
}

.tp-calc-header p {
    font-size: 16px;
    color: var(--tp-text-light);
    margin: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.tp-calc-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.tp-calc-inputs {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.tp-form-group {
    display: flex;
    flex-direction: column;
}

.tp-form-group label {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--tp-text-dark);
}

.tp-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tp-radio-group label {
    flex: 1;
    min-width: 100px;
}

.tp-radio-group input[type="radio"] {
    display: none;
}

.tp-radio-group .tp-radio-label {
    display: block;
    padding: 12px 15px;
    border: 1px solid var(--tp-border-color);
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    background-color: #fff;
}

.tp-radio-group input[type="radio"]:checked + .tp-radio-label {
    background-color: var(--tp-primary-color);
    color: white;
    border-color: var(--tp-primary-color);
    box-shadow: 0 4px 10px rgba(74, 144, 226, 0.3);
    transform: translateY(-2px);
}

#tp-needs {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    border-radius: 8px;
    border: 1px solid var(--tp-border-color);
    background-color: #fff;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M5%208l5%205%205-5z%22%20fill%3D%22%236c757d%22/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    cursor: pointer;
}

.tp-calc-results {
    background: linear-gradient(135deg, #eef7ff, #f2fefb);
    border-radius: var(--tp-border-radius);
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 400px;
    justify-content: center;
}

.tp-toothbrush-visualizer {
    position: relative;
    width: 250px;
    height: 50px;
    margin-bottom: 30px;
}

.tp-toothbrush-handle {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    height: 20px;
    background: var(--tp-primary-color);
    border-radius: 10px 0 0 10px;
}

.tp-toothbrush-head {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 90px;
    height: 35px;
    background: #fff;
    border-radius: 5px 15px 15px 5px;
    border: 2px solid var(--tp-primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tp-bristles {
    width: 80%;
    height: 70%;
    background-image: linear-gradient(to right, var(--tp-secondary-color) 2px, transparent 2px), linear-gradient(to right, var(--tp-secondary-color) 2px, transparent 2px);
    background-size: 6px 100%;
    opacity: 0.3;
}

.tp-paste {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, var(--tp-secondary-color), #3dd4b5);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    z-index: 10;
}

.tp-paste.smear {
    width: 20px;
    height: 8px;
    border-radius: 4px;
    left: 75%;
}

.tp-paste.pea {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    left: 68%;
}

.tp-paste.ribbon {
    width: 65px;
    height: 12px;
    border-radius: 6px;
    left: 45%;
}

.tp-result-text-container {
    text-align: center;
}

#tp-amount-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--tp-primary-color);
    margin: 0 0 10px 0;
    transition: all 0.3s ease;
}

#tp-recommendation-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--tp-text-light);
    min-height: 80px; /* Prevents layout shifts */
    transition: all 0.3s ease;
}

/* Responsive Design */
@media (max-width: 800px) {
    .tp-calc-main {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .tp-calc-results {
        min-height: 350px;
    }
}

@media (max-width: 480px) {
    #toothpaste-calculator-container {
        padding: 15px;
    }
    .tp-calc-header h2 {
        font-size: 24px;
    }
    .tp-radio-group {
        flex-direction: column;
        align-items: stretch;
    }
     .tp-radio-group label {
        flex: auto;
     }
}