/* Pest Identifier Widget v1.0 */

.pest-id-widget {
    background: var(--block-bg, #f8fafc);
    border: 1px solid color-mix(in srgb, var(--text-main, #1e293b) 12%, transparent);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pest-id-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pest-id-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.pest-id-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-main, #1e293b);
    margin: 0;
    line-height: 1.3;
}

.pest-id-subtitle {
    font-size: 0.8rem;
    color: var(--text-main, #64748b);
    opacity: 0.7;
    margin: 0.125rem 0 0;
    line-height: 1.3;
}

/* Drop Zone */
.pest-dropzone {
    position: relative;
    border: 2px dashed color-mix(in srgb, var(--text-main, #94a3b8) 30%, transparent);
    border-radius: 0.75rem;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    overflow: hidden;
    outline: none;
}

.pest-dropzone:hover,
.pest-dropzone:focus-visible {
    border-color: var(--accent, #5D7B6F);
    background: color-mix(in srgb, var(--accent, #5D7B6F) 5%, transparent);
}

.pest-dropzone-active {
    border-color: var(--accent, #5D7B6F) !important;
    background: color-mix(in srgb, var(--accent, #5D7B6F) 8%, transparent) !important;
}

.pest-dropzone-content {
    text-align: center;
    padding: 1.5rem;
}

.pest-dropzone-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 0.75rem;
    color: var(--text-main, #94a3b8);
    opacity: 0.4;
}

.pest-dropzone-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main, #475569);
    margin: 0;
}

.pest-dropzone-hint {
    font-size: 0.75rem;
    color: var(--text-main, #94a3b8);
    opacity: 0.6;
    margin: 0.25rem 0 0;
}

/* Preview */
.pest-preview {
    width: 100%;
    height: 200px;
    object-fit: contain;
    border-radius: 0.5rem;
    background: #000;
}

.pest-clear-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 5;
}

.pest-clear-btn:hover {
    background: rgba(220, 38, 38, 0.85);
}

/* Actions Row */
.pest-actions-row {
    display: flex;
    gap: 0.5rem;
}

.pest-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main, #475569);
    background: var(--bg-main, #fff);
    border: 1px solid color-mix(in srgb, var(--text-main, #94a3b8) 25%, transparent);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
}

.pest-btn-secondary svg {
    width: 16px;
    height: 16px;
}

.pest-btn-secondary:hover {
    border-color: var(--accent, #5D7B6F);
    color: var(--accent, #5D7B6F);
}

/* Text Input */
.pest-text-wrap {
    position: relative;
}

.pest-textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.85rem;
    border: 1px solid color-mix(in srgb, var(--text-main, #94a3b8) 25%, transparent);
    border-radius: 0.5rem;
    background: var(--bg-main, #fff);
    color: var(--text-main, #1e293b);
    resize: vertical;
    min-height: 48px;
    max-height: 120px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.pest-textarea:focus {
    outline: none;
    border-color: var(--accent, #5D7B6F);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #5D7B6F) 12%, transparent);
}

.pest-textarea::placeholder {
    color: var(--text-main, #94a3b8);
    opacity: 0.5;
}

.pest-char-count {
    position: absolute;
    bottom: 6px;
    right: 10px;
    font-size: 0.65rem;
    color: var(--text-main, #94a3b8);
    opacity: 0.5;
    pointer-events: none;
}

/* Primary Button */
.pest-btn-primary {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-text, #fff);
    background: var(--accent, #5D7B6F);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: opacity 0.15s, transform 0.1s;
}

.pest-btn-primary:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.pest-btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.pest-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pest-spin 0.6s linear infinite;
}

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

/* Results */
.pest-result {
    animation: pest-fade-in 0.3s ease;
}

@keyframes pest-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.pest-result-error {
    padding: 0.75rem 1rem;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 0.5rem;
    color: #991b1b;
    font-size: 0.85rem;
}

.pest-result-refused {
    padding: 0.75rem 1rem;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 0.5rem;
    color: #92400e;
    font-size: 0.85rem;
}

/* Result Card */
.pest-result-card {
    background: var(--bg-main, #fff);
    border: 1px solid color-mix(in srgb, var(--text-main, #94a3b8) 15%, transparent);
    border-radius: 0.75rem;
    overflow: hidden;
}

.pest-urgency-banner {
    padding: 0.625rem 1rem;
    font-size: 0.8rem;
    text-align: center;
    border-bottom: 1px solid;
    letter-spacing: 0.02em;
}

.pest-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1rem 0.5rem;
}

.pest-result-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main, #1e293b);
    margin: 0;
    line-height: 1.3;
}

.pest-result-latin {
    font-size: 0.8rem;
    color: var(--text-main, #64748b);
    opacity: 0.7;
    margin: 0.125rem 0 0;
}

.pest-confidence-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-main, #64748b);
    opacity: 0.6;
    background: color-mix(in srgb, var(--text-main, #94a3b8) 8%, transparent);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    margin-top: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pest-risk-badge {
    flex-shrink: 0;
    padding: 0.25rem 0.625rem;
    font-size: 0.7rem;
    font-weight: 700;
    border: 1px solid;
    border-radius: 999px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.pest-summary {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main, #334155);
    line-height: 1.5;
    margin: 0;
    padding: 0 1rem 0.75rem;
    border-bottom: 1px solid color-mix(in srgb, var(--text-main, #94a3b8) 10%, transparent);
}

/* Sections */
.pest-section {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid color-mix(in srgb, var(--text-main, #94a3b8) 8%, transparent);
}

.pest-section:last-of-type {
    border-bottom: none;
}

.pest-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main, #1e293b);
    margin: 0 0 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pest-section-text {
    font-size: 0.875rem;
    color: var(--text-main, #475569);
    line-height: 1.65;
    margin: 0;
}

/* Steps & Prevention Lists */
.pest-step-list,
.pest-prevention-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.pest-step-item,
.pest-prevention-item {
    font-size: 0.85rem;
    color: var(--text-main, #475569);
    line-height: 1.5;
    padding: 0.375rem 0.5rem;
    background: color-mix(in srgb, var(--text-main, #94a3b8) 5%, transparent);
    border-radius: 0.375rem;
}

/* Pro Recommendation */
.pest-pro-section {
    padding: 0.75rem 1rem;
    background: color-mix(in srgb, var(--accent, #2b6cb0) 5%, transparent);
    border-top: 1px solid color-mix(in srgb, var(--accent, #2b6cb0) 15%, transparent);
}

.pest-pro-urgent {
    background: #fef2f2;
    border-top: 2px solid #f87171;
}

.pest-pro-urgent .pest-section-title {
    color: #991b1b;
}

.pest-cta-btn {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.625rem 1.25rem;
    background: var(--accent, #2b6cb0);
    color: var(--accent-text, #fff);
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.pest-cta-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.pest-cta-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent, #2b6cb0);
    text-decoration: none;
}

.pest-cta-link:hover {
    text-decoration: underline;
}

.pest-urgency-footer {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    border-top: 1px solid;
}

/* Widget Disclaimer */
.pest-disclaimer {
    font-size: 0.7rem;
    color: var(--text-main, #94a3b8);
    opacity: 0.5;
    line-height: 1.4;
    margin: 0;
    text-align: center;
}

/* Utility */
.pest-hidden {
    display: none !important;
}