* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; padding: 20px; }
.navbar { background: #2c3e50; color: white; padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-radius: 8px; }
.nav-links a { color: white; text-decoration: none; margin-left: 1rem; padding: 0.5rem 1rem; border-radius: 4px; }
.nav-links a.active { background: #34495e; }
.container { max-width: 1200px; margin: 0 auto; }
.card { background: white; padding: 20px; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.form-row { display: flex; gap: 10px; margin-bottom: 10px; }
.form-row input, .form-row select { flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 4px; }
.btn-primary { background: #3498db; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; }
.btn-danger { background: #e74c3c; color: white; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px; text-align: left; border-bottom: 1px solid #ddd; }
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 15px 0; }
.provider-card { border: 1px solid #ddd; padding: 10px; border-radius: 4px; display: flex; flex-direction: column; gap: 5px; }
.chat-box { min-height: 400px; display: flex; flex-direction: column; }
.messages { flex: 1; overflow-y: auto; margin-bottom: 15px; }
.message { padding: 10px; margin-bottom: 10px; border-radius: 4px; }
.message.user { background: #3498db; color: white; }
.message.assistant { background: #ecf0f1; }
.input-area { display: flex; gap: 10px; }
.input-area textarea { flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 4px; resize: none; }
.input-area button { padding: 10px 20px; background: #27ae60; color: white; border: none; border-radius: 4px; cursor: pointer; }
.badge-success { background: #27ae60; color: white; padding: 5px 10px; border-radius: 4px; display: inline-block; margin-bottom: 10px; }
.badge-info { background: #3498db; color: white; padding: 5px 10px; border-radius: 4px; display: inline-block; margin-bottom: 10px; }
.quorum-response { border-left: 3px solid #3498db; padding-left: 10px; margin: 10px 0; }

/* ============================================
   MARKDOWN CONTENT STYLES
   ============================================ */

.llm-content, .message-content {
    line-height: 1.7;
    color: #2c3e50;
    font-size: 0.95em;
}

/* Headings */
.llm-content h1, .llm-content h2, .llm-content h3, .llm-content h4 {
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    color: #1a252f;
    font-weight: 700;
    line-height: 1.3;
}

.llm-content h1 { font-size: 1.8em; border-bottom: 2px solid #e0e0e0; padding-bottom: 0.3em; }
.llm-content h2 { font-size: 1.5em; border-bottom: 1px solid #e0e0e0; padding-bottom: 0.3em; }
.llm-content h3 { font-size: 1.2em; }
.llm-content h4 { font-size: 1em; }

/* Paragraphs */
.llm-content p {
    margin: 0.8em 0;
}

/* Lists */
.llm-content ul, .llm-content ol {
    margin: 0.8em 0;
    padding-left: 2em;
}

.llm-content li {
    margin: 0.4em 0;
    line-height: 1.6;
}

.llm-content ul { list-style-type: disc; }
.llm-content ol { list-style-type: decimal; }

/* Bold and Italic */
.llm-content strong {
    font-weight: 700;
    color: #1a252f;
}

.llm-content em {
    font-style: italic;
    color: #555;
}

/* Code */
.llm-content pre {
    background-color: #f6f8fa;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1em 0;
    border: 1px solid #e1e4e8;
}

.llm-content pre code {
    background: none;
    padding: 0;
    font-size: 0.85em;
    line-height: 1.45;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.llm-content code {
    background-color: rgba(27,31,35,0.05);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.llm-content pre code {
    background: none;
    color: inherit;
}

/* Blockquotes */
.llm-content blockquote {
    border-left: 3px solid #ddd;
    padding-left: 1em;
    margin: 1em 0;
    color: #555;
    background-color: #fafbfc;
    padding: 1em;
    border-radius: 0 4px 4px 0;
}

/* Tables */
.llm-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
    overflow-x: auto;
    display: block;
}

.llm-content th, .llm-content td {
    border: 1px solid #dfe2e5;
    padding: 10px 14px;
    text-align: left;
}

.llm-content th {
    background-color: #f6f8fa;
    font-weight: 600;
}

.llm-content tr:nth-child(even) {
    background-color: #fbfcfd;
}

/* Horizontal Rule */
.llm-content hr {
    border: none;
    border-top: 1px solid #e1e4e8;
    margin: 2em 0;
}

/* Links */
.llm-content a {
    color: #007bff;
    text-decoration: none;
}

.llm-content a:hover {
    text-decoration: underline;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .llm-content {
        font-size: 0.9em;
    }

    .llm-content pre {
        padding: 12px;
        font-size: 0.8em;
    }

    .llm-content table {
        font-size: 0.85em;
    }
}

/* ============================================
   QUORUM RESPONSE IMPROVEMENTS
   ============================================ */

.quorum-response {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.quorum-response strong {
    color: #007bff;
    display: block;
    margin-bottom: 12px;
    font-size: 1.1em;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 8px;
}

.quorum-response .llm-content {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* ============================================
   FIX: LEFT PADDING AND BORDERS
   ============================================ */

/* Add left padding for orchestrator content */
.message.assistant .message-content,
.llm-content {
    padding-left: 10px;
    padding-right: 10px;
}

/* Remove blue border from blockquote completely */
.llm-content blockquote {
    border-left: none !important;
    background-color: #f8f9fa !important;
    padding: 12px 16px !important;
    margin: 1em 0 !important;
}

/* Fix padding for lists inside blockquote */
.llm-content blockquote ul,
.llm-content blockquote ol {
    padding-left: 1.5em !important;
    margin-left: 0 !important;
}

/* Improve quorum response cards appearance */
.quorum-response {
    border-left: 4px solid #007bff !important;
    padding-left: 16px !important;
}

/* Remove duplicate borders */
.quorum-response .llm-content blockquote {
    border-left: none !important;
}

/* Site Footer - Centered */
.site-footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    border-top: 1px solid #e1e5eb;
    background-color: #f8f9fa;
}

.site-footer p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

/* Nav Logout Link */
.nav-logout {
    color: #fff;
    text-decoration: none;
    margin-left: 20px;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.nav-logout:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   Hover Effects for Provider Cards
   Added: v5.0 UI Improvements
   ============================================ */

/* Provider card hover effect */
.provider-card,
.card-hover-effect {
    transition: all 0.2s ease-in-out;
}

.provider-card:hover,
.card-hover-effect:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
    border-color: #6366F1;
}

/* Provider card selected state */
.provider-card.selected,
.provider-card.active {
    border: 2px solid #10B981;
    background-color: #ECFDF5;
    position: relative;
}

/* Checkmark for selected cards */
.provider-card.selected::after,
.provider-card.active::after {
    content: "✓";
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 20px;
    color: #10B981;
    font-weight: bold;
}

/* Button hover effects */
.btn-hover-effect {
    transition: all 0.2s ease;
}

.btn-hover-effect:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Quick action cards hover */
.quick-action-item {
    transition: all 0.2s ease;
}

.quick-action-item:hover {
    transform: translateY(-2px);
}

/* General card hover for consistency */
.card,
.bg-white.rounded-lg.shadow {
    transition: box-shadow 0.2s ease;
}

.card:hover,
.bg-white.rounded-lg.shadow:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Selected Provider Card - OVERRIDE
   More specific selectors with !important
   ============================================ */

label.provider-card.selected {
    border: 2px solid #10B981 !important;
    background-color: #ECFDF5 !important;
    position: relative !important;
}

label.provider-card.selected::after {
    content: "✓" !important;
    position: absolute !important;
    top: 8px !important;
    right: 12px !important;
    font-size: 20px !important;
    color: #10B981 !important;
    font-weight: bold !important;
    display: block !important;
}

/* TEST STYLE - SHOULD BE VERY VISIBLE */
.provider-card[style*="border-color"] {
    outline: 5px solid #FF0000 !important;
}

/* ============================================
   FINAL FIX - Provider Selected State
   Maximum specificity - cannot be overridden
   ============================================ */

div.provider-grid label.provider-card.provider-selected {
    border: 3px solid #10B981 !important;
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%) !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3) !important;
    position: relative !important;
    z-index: 10 !important;
}

div.provider-grid label.provider-card.provider-selected::before {
    content: "✓" !important;
    position: absolute !important;
    top: -5px !important;
    right: -5px !important;
    background: #10B981 !important;
    color: white !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: bold !important;
    z-index: 20 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

/* ============================================
   Provider Selected State - FINAL FIX
   Uses element selector for maximum specificity
   ============================================ */

label.provider-card.provider-selected {
    border: 3px solid #10B981 !important;
    background: #ECFDF5 !important;
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%) !important;
    position: relative !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}

label.provider-card.provider-selected:hover {
    border-color: #059669 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3) !important;
}

label.provider-card:has(input[type="checkbox"]:checked) {
    border: 3px solid #10B981 !important;
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%) !important;
    position: relative !important;
}


@keyframes skeleton-shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: 200px 0; }
}

.skeleton-card {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 8px;
    padding: 16px;
    height: 120px;
}

.skeleton-title {
    height: 20px;
    width: 70%;
    background: linear-gradient(90deg, #d0d0d0 25%, #c0c0c0 50%, #d0d0d0 75%);
    background-size: 200px 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 12px;
}

.skeleton-text {
    height: 14px;
    width: 90%;
    background: linear-gradient(90deg, #d0d0d0 25%, #c0c0c0 50%, #d0d0d0 75%);
    background-size: 200px 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-text.short {
    width: 50%;
}
