/* Response Visualizer Styles */

.api-response-visualization {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #333;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 0;
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid #e4e9f0;
}

/* Response Summary Section */
.response-summary {
    background-color: #f9f9fb;
    padding: 20px;
    border-bottom: 1px solid #e4e9f0;
}

.summary-content {
    max-width: 1200px;
    margin: 0 auto;
}

.critical-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.critical-field {
    background-color: white;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    border-left: 3px solid #e4e9f0;
}

.critical-field:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.critical-field.positive {
    border-left-color: #10b981;
}

.critical-field.negative {
    border-left-color: #ef4444;
}

.critical-field.neutral {
    border-left-color: #f59e0b;
}

.field-label {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.field-value {
    font-size: 16px;
    font-weight: 600;
}

.field-value.positive {
    color: #10b981;
}

.field-value.negative {
    color: #ef4444;
}

/* Field Groups */
.field-group {
    padding: 0;
    border-bottom: 1px solid #e4e9f0;
}

.field-group:last-child {
    border-bottom: none;
}

.group-title {
    font-size: 14px;
    font-weight: 600;
    padding: 12px 20px;
    margin: 0;
    background-color: #f9f9fb;
    color: #374151;
    border-bottom: 1px solid #e4e9f0;
    user-select: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.group-title::after {
    content: "▼";
    font-size: 10px;
    color: #9ca3af;
}

.group-title.collapsed::after {
    content: "▶";
}

.group-content {
    padding: 0;
}

/* Field Rows */
.field-row {
    display: flex;
    border-bottom: 1px solid #f3f4f6;
    padding: 12px 20px;
}

.field-row:last-child {
    border-bottom: none;
}

.field-row:hover {
    background-color: #f9fafb;
}

.field-name {
    flex: 0 0 200px;
    font-weight: 500;
    color: #4b5563;
    padding-right: 20px;
}

.field-value {
    flex: 1;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Nested objects and arrays */
.nested-object {
    padding: 8px 0;
    border-radius: 4px;
}

.array-items {
    margin: 0;
    padding-left: 20px;
}

details {
    padding: 8px;
    background-color: #f9fafb;
    border-radius: 4px;
    margin: 4px 0;
}

summary {
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    color: #4b5563;
}

summary:hover {
    color: #1f2937;
}

/* Error display */
.api-response-visualization.error {
    padding: 20px;
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.error-message {
    font-weight: 500;
}

/* Intent-specific styling */
.intent-phone-social-details .response-summary {
    background-color: #f0f9ff;
}

.intent-digital-footprint .response-summary {
    background-color: #f0fdfa;
}

.intent-check-whatsapp .response-summary {
    background-color: #ecfdf5;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .field-row {
        flex-direction: column;
    }
    
    .field-name {
        flex: 0 0 auto;
        margin-bottom: 6px;
    }
    
    .critical-fields {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* Details element styling */
details {
    margin-bottom: 5px;
}

details > summary {
    list-style-type: none;
    position: relative;
    padding-left: 20px;
}

details > summary::before {
    content: "▶";
    position: absolute;
    left: 0;
    transform: rotate(0);
    transition: transform 0.2s;
}

details[open] > summary::before {
    transform: rotate(90deg);
}

/* Animation for expandable content */
details > * {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Links styling */
.field-value a {
    color: #3b82f6;
    text-decoration: none;
}

.field-value a:hover {
    text-decoration: underline;
}

/* Empty placeholder styling */
.field-value em {
    color: #9ca3af;
    font-style: italic;
}
