.csm-predefined-blender {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.csm-blender-header {
    text-align: center;
    margin-bottom: 30px;
}

.csm-blender-title {
    font-size: 2em;
    color: #4a3728;
    margin: 0 0 10px 0;
}

.csm-blender-description {
    color: #666;
    font-size: 1.1em;
    margin: 0;
}

.csm-blender-loading {
    text-align: center;
    padding: 60px 20px;
}

.csm-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #8b6f47;
    border-radius: 50%;
    animation: csm-spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes csm-spin {
    to { transform: rotate(360deg); }
}

.csm-size-selector {
    background: linear-gradient(135deg, #f9f6f3 0%, #f0ebe5 100%);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
}

.csm-size-selector label {
    display: block;
    font-weight: 600;
    color: #4a3728;
    margin-bottom: 12px;
    font-size: 1.1em;
}

.csm-size-options {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.csm-size-btn {
    background: #fff;
    border: 2px solid #d4c4b0;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    color: #6b5344;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.csm-size-btn:hover {
    border-color: #8b6f47;
    background: #faf8f6;
}

.csm-size-btn.active {
    background: #8b6f47;
    border-color: #8b6f47;
    color: #fff;
}

.csm-roast-selector {
    background: linear-gradient(135deg, #f9f6f3 0%, #f0ebe5 100%);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
}

.csm-roast-selector label {
    display: block;
    font-weight: 600;
    color: #4a3728;
    margin-bottom: 12px;
    font-size: 1.1em;
}

.csm-roast-slider-wrap {
    max-width: 400px;
    margin: 0 auto;
    position: relative;
    padding-bottom: 30px;
}

.csm-roast-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #f5e6d3 0%, #d4a574 33%, #8b5a2b 66%, #3d2314 100%);
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.csm-roast-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #8b6f47;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.csm-roast-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.csm-roast-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #8b6f47;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
}

.csm-roast-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.85em;
    color: #6b5344;
}

.csm-roast-labels span {
    text-align: center;
    flex: 1;
    padding: 4px 2px;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.csm-roast-labels span:hover {
    background: rgba(139, 111, 71, 0.1);
}

.csm-roast-labels span.active {
    font-weight: 600;
    color: #4a3728;
    background: rgba(139, 111, 71, 0.15);
}

.csm-roast-display {
    margin-top: 12px;
}

.csm-roast-name {
    display: inline-block;
    background: #8b6f47;
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95em;
}

.csm-ingredients-section {
    margin-bottom: 30px;
}

.csm-section-title {
    font-size: 1.2em;
    color: #4a3728;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e8e0d8;
}

.csm-required-section,
.csm-optional-section {
    margin-bottom: 25px;
}

.csm-optional-available {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.csm-available-label {
    color: #888;
    font-size: 0.9em;
}

.csm-available-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.csm-optional-pill {
    background: #f5f0eb;
    border: 1px dashed #c4b5a5;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    color: #6b5344;
    cursor: pointer;
    transition: all 0.2s ease;
}

.csm-optional-pill:hover {
    background: #e8e0d8;
    border-style: solid;
}

.csm-no-optional {
    color: #999;
    font-style: italic;
    font-size: 0.9em;
}

.csm-ingredient-row {
    background: #fff;
    border: 1px solid #e8e0d8;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s ease;
}

.csm-ingredient-row:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.csm-ingredient-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.csm-lock-btn {
    background: transparent;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 4px 8px;
    margin-right: 8px;
    opacity: 0.5;
    transition: opacity 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.csm-lock-btn:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

.csm-lock-btn.locked {
    opacity: 1;
}

.csm-ingredient-row.csm-locked {
    background: linear-gradient(135deg, #f5f0eb 0%, #ebe5df 100%);
    border-color: #c9b89a;
}

.csm-ingredient-row.csm-locked .csm-ingredient-slider {
    opacity: 0.7;
}

.csm-ingredient-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
}

.csm-ingredient-icon {
    font-size: 1.5em;
}

.csm-ingredient-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.csm-ingredient-name {
    font-weight: 600;
    color: #4a3728;
    font-size: 1.1em;
}

.csm-ingredient-meta {
    color: #888;
    font-size: 0.85em;
}

.csm-ingredient-value {
    text-align: right;
    min-width: 100px;
}

.csm-ingredient-grams {
    font-size: 1.4em;
    font-weight: 700;
    color: #8b6f47;
    display: block;
}

.csm-ingredient-percent {
    color: #888;
    font-size: 0.85em;
}

.csm-remove-optional {
    background: none;
    border: none;
    color: #ccc;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0 0 0 10px;
    line-height: 1;
    transition: color 0.2s ease;
}

.csm-remove-optional:hover {
    color: #e74c3c;
}

.csm-slider-section {
    padding-top: 8px;
}

.csm-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.csm-slider-min,
.csm-slider-max {
    font-size: 0.8em;
    color: #999;
    min-width: 45px;
}

.csm-slider-min {
    text-align: right;
}

.csm-slider-max {
    text-align: left;
}

.csm-ingredient-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: #e8e0d8;
    border-radius: 4px;
    outline: none;
}

.csm-ingredient-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #8b6f47 0%, #6b5344 100%);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease;
}

.csm-ingredient-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.csm-ingredient-slider::-webkit-slider-thumb:active {
    transform: scale(1.15);
}

.csm-ingredient-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #8b6f47 0%, #6b5344 100%);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.csm-blend-summary {
    background: linear-gradient(135deg, #4a3728 0%, #6b5344 100%);
    padding: 25px;
    border-radius: 14px;
    color: #fff;
}

.csm-summary-header h3 {
    margin: 0 0 20px 0;
    font-size: 1.3em;
    font-weight: 600;
}

.csm-progress-section {
    margin-bottom: 20px;
}

.csm-progress-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.csm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8bc34a 0%, #4caf50 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
}

.csm-progress-fill.over {
    background: linear-gradient(90deg, #f44336 0%, #e53935 100%);
}

.csm-progress-text {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.1em;
}

.csm-current-total {
    font-weight: 700;
    font-size: 1.2em;
}

.csm-of {
    color: rgba(255, 255, 255, 0.7);
}

.csm-progress-percent {
    color: rgba(255, 255, 255, 0.7);
    margin-left: auto;
}

.csm-progress-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-top: 10px;
}

.csm-progress-message {
    margin: 0;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.8);
    flex: 1;
}

.csm-progress-message.error {
    color: #ffcdd2;
}

.csm-auto-adjust-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.csm-auto-adjust-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.csm-auto-adjust-btn:active {
    transform: scale(0.98);
}

.csm-price-section {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 15px;
    margin-bottom: 20px;
}

.csm-price-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.95em;
    color: rgba(255, 255, 255, 0.8);
}

.csm-price-row.csm-price-total {
    font-size: 1.2em;
    font-weight: 700;
    color: #fff;
    padding-top: 10px;
    margin-top: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.csm-add-to-cart-btn {
    width: 100%;
    background: linear-gradient(135deg, #8bc34a 0%, #689f38 100%);
    border: none;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.csm-add-to-cart-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.csm-add-to-cart-btn:disabled {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
}

.csm-blender-error {
    text-align: center;
    padding: 60px 20px;
    color: #e74c3c;
}

@media (max-width: 600px) {
    .csm-predefined-blender {
        padding: 15px;
    }

    .csm-blender-title {
        font-size: 1.5em;
    }

    .csm-size-options {
        gap: 8px;
    }

    .csm-size-btn {
        padding: 10px 18px;
        min-width: 70px;
        font-size: 0.95em;
    }

    .csm-ingredient-header {
        flex-direction: column;
        gap: 10px;
    }

    .csm-ingredient-value {
        text-align: left;
        min-width: auto;
        display: flex;
        gap: 8px;
        align-items: baseline;
    }

    .csm-ingredient-slider::-webkit-slider-thumb {
        width: 36px;
        height: 36px;
    }

    .csm-ingredient-slider::-moz-range-thumb {
        width: 36px;
        height: 36px;
    }

    .csm-blend-summary {
        padding: 20px;
    }

    .csm-add-to-cart-btn {
        padding: 18px 24px;
        font-size: 1.15em;
    }
}

@media (max-width: 400px) {
    .csm-size-options {
        flex-direction: column;
    }

    .csm-size-btn {
        width: 100%;
    }

    .csm-ingredient-slider::-webkit-slider-thumb {
        width: 44px;
        height: 44px;
    }

    .csm-ingredient-slider::-moz-range-thumb {
        width: 44px;
        height: 44px;
    }
}

.csm-ai-predict-section {
    margin-bottom: 15px;
}

.csm-ai-predict-btn {
    width: 100%;
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.csm-ai-predict-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.4);
}

.csm-ai-predict-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.csm-ai-predict-btn .csm-ai-icon {
    font-size: 1.2em;
}

.csm-ai-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.csm-ai-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.csm-ai-modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: csm-modal-appear 0.3s ease-out;
}

@keyframes csm-modal-appear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.csm-ai-modal-header {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    color: #fff;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.csm-ai-modal-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.csm-ai-modal-header .csm-ai-icon {
    font-size: 1.3em;
}

.csm-ai-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 1.5em;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    line-height: 1;
}

.csm-ai-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.csm-ai-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.csm-ai-loading {
    text-align: center;
    padding: 40px 20px;
}

.csm-ai-loading p {
    margin: 0;
    color: #666;
    font-size: 1.1em;
}

.csm-ai-loading .csm-loading-spinner {
    margin: 0 auto 20px;
    border-top-color: #9c27b0;
}

.csm-ai-result {
    line-height: 1.7;
}

.csm-ai-prediction-text {
    color: #333;
    font-size: 1.05em;
}

.csm-ai-prediction-text p {
    margin: 0 0 1em 0;
}

.csm-ai-prediction-text p:last-child {
    margin-bottom: 0;
}

.csm-ai-prediction-text strong {
    color: #4a3728;
}

.csm-ai-error {
    text-align: center;
    padding: 30px 20px;
}

.csm-ai-error-message {
    color: #e74c3c;
    background: #ffeaea;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 0;
}

@media (max-width: 600px) {
    .csm-ai-modal {
        padding: 10px;
    }

    .csm-ai-modal-content {
        max-height: 90vh;
        border-radius: 12px;
    }

    .csm-ai-modal-header {
        padding: 16px 20px;
    }

    .csm-ai-modal-header h3 {
        font-size: 1.1em;
    }

    .csm-ai-modal-body {
        padding: 20px;
    }

    .csm-ai-prediction-text {
        font-size: 1em;
    }
}
