/* Main layout styles */
html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-y: scroll;  /* Force scrollbar visibility */
    overflow-x: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: rgb(17,18,22);
    color: #e0e0e0;
}

body {
    margin: 0;
    padding: 120px 20px 20px 20px;  /* Consistent padding */
    min-height: 100%;  /* Allow growth */
    height: auto;       /* Don't constrain */
}

.container {
    display: flex;
    gap: 20px;
    max-width: 1600px;
    margin: 20px auto 0 auto;
    min-height: calc(100vh - 180px);  /* Use min-height */
    overflow: visible;                 /* Natural flow */
}

/* Ensure panels have proper flex behavior */

.issue-panel,
.evaluation-panel {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border: 1px solid #404040;
    min-height: calc(100vh - 140px); /* Fixed viewport height with scrolling */
    max-height: calc(100vh - 140px);
    overflow-y: auto;    /* Individual panel scrolling */
    flex: 1; /* Equal width panels */
    min-width: 0; /* Allow shrinking */
    overscroll-behavior: contain;
}

/* Specific styling for evaluation panel */
.evaluation-panel {
    display: flex;
    flex-direction: column;
}

.evaluation-content {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* JSON Formatter Styles */
.json-formatter {
    font-family: monospace;
    font-size: 14px;
    line-height: 1.5;
    background-color: #2a2a2a;
    border-radius: 4px;
    padding: 10px;
    overflow: auto;
    max-height: 500px;
    white-space: pre-wrap;
    word-break: break-word;
}

.json-formatter .json-key {
    color: #881391;
    font-weight: bold;
}

.json-formatter .json-string {
    color: #1a1aa6;
}

.json-formatter .json-number {
    color: #1e7f0c;
}

.json-formatter .json-boolean {
    color: #0000ff;
}

.json-formatter .json-null {
    color: #808080;
}

/* Closing brackets and braces */
.json-closing-bracket, .json-closing-brace, .json-closing {
    margin-left: 20px;
    display: flex;
    vertical-align: bottom;
}

/* Collapsible JSON styles */
.collapsible {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.collapsible::before {
    content: "▼";
    display: inline-block;
    margin-right: 5px;
    font-size: 10px;
    transition: transform 0.2s;
}

.collapsible.collapsed::before {
    transform: rotate(-90deg);
}

.collapsible.collapsed::after {
    content: "...";
    color: #888;
    margin: 0 2px;
}

.json-content {
    margin-left: 20px;
    transition: height 0.2s ease-out;
    width: 100%;
    display: block;
}

.json-content.hidden {
    display: none;
}

/* JSON array and object item styles */
.json-array-item, .json-property {
    position: relative;
    margin: 2px 0;
}

.json-comma {
    margin-left: 2px;
    display: inline-block;
    vertical-align: bottom;
    
}

/* JSON item container */
.json-item {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: flex-start;
    position: relative;
}

/* Key styling */
.json-key {
    color: #881391;
    font-weight: bold;
}

/* Left panel - Issue display */
.issue-panel {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid #404040;
    background-color: #2d2d2d;
    color: #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border: 1px solid #404040;
}

.issue-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #404040;
}

.issue-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #ffffff;
}

.issue-meta {
    display: flex;
    justify-content: space-between;
    color: #b0b0b0;
    font-size: 14px;
}

.issue-content {
    line-height: 1.6;
    color: #e0e0e0;
}

.issue-description {
    margin-bottom: 20px;
}

.issue-description-text {
    padding: 10px;
    background-color: #2d2d2d;
    border-radius: 5px;
    border: 1px solid #404040;
    color: #e0e0e0;
}

.issue-description-text pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.issue-comments {
    margin-top: 20px;
}

.comment {
    padding: 10px;
    margin-bottom: 10px;
    background-color: #2d2d2d;
    border-radius: 5px;
    border: 1px solid #404040;
    color: #e0e0e0;
}

.comment-author {
    font-weight: bold;
    margin-bottom: 5px;
}

.comment-date {
    font-size: 12px;
    color: #888;
}

.comment-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.issue-attributes {
    padding: 10px;
    margin-bottom: 20px;
    background-color: #2d2d2d;
    border-radius: 5px;
    border: 1px solid #404040;
    color: #e0e0e0;
}

.issue-selector {
    margin-bottom: 20px;
    padding: 10px;
    border-radius: 5px;
    background-color: #2d2d2d;
    border: 1px solid #404040;
    color: #e0e0e0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.issue-selector:hover {
    background-color: #2d2d2d;
    border-color: #505050;
}

.issue-selector select {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #505050;
    background-color: #3a3a3a;
    color: #e0e0e0;
    cursor: pointer;
}

/* Right panel - Chat interface */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #2d2d2d;
    color: #e0e0e0;
}

.chat-header {
    padding: 15px;
    background-color: #3a3a3a;
    border-bottom: 1px solid #404040;
    color: #ffffff;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #2d2d2d;
    color: #e0e0e0;
}

.message {
    margin-bottom: 15px;
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    line-height: 1.4;
}

.user-message {
    background-color: #007bff;
    color: #ffffff;
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

.ai-message {
    background-color: #3a3a3a;
    color: #e0e0e0;
    margin-right: auto;
    border-bottom-left-radius: 5px;
    border: 1px solid #505050;
}

.chat-input {
    display: flex;
    padding: 15px;
    border-top: 1px solid #404040;
    background-color: #2d2d2d;
}

.chat-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #505050;
    border-radius: 20px;
    margin-right: 10px;
    background-color: #3a3a3a;
    color: #e0e0e0;
}

.chat-input input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.chat-input button {
    padding: 10px 20px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

.chat-input button:hover {
    background-color: #0b7dda;
}

/* Typing Indicator */
.typing-indicator {
    background-color: #3a3a3a;
    border: 1px solid #505050;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    padding: 15px 20px;
    display: none;
    margin-bottom: 15px;
    max-width: 80%;
    margin-right: auto;
    position: relative;
    color: #e0e0e0;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #b0b0b0;
    display: inline-block;
    border-radius: 50%;
    margin-right: 5px;
    animation: typing-dot 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
    margin-right: 0;
}

@keyframes typing-dot {
    0%, 60%, 100% { 
        transform: translateY(0);
    }
    30% { 
        transform: translateY(-5px);
    }
}

/* loading progress for issue-selector */
.loading-progress {
    margin-top: 10px;
    font-size: 0.8em;
    color: #e0e0e0;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 8px;
    padding: 10px;
}
.progress-bar {
    height: 4px;
    background-color: #1e1e1e;
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
}
.progress-filled {
    height: 100%;
    background-color: rgb(255,115,0);
    width: 0%;
    transition: width 0.3s ease;
}
.evaluated-option {
    background-color: #2a4a2a; 
    color: #4caf50;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    .issue-panel, .evaluation-panel {
        height: 50vh;
        min-height: 0;
        /* Consolidated shared properties */
        background-color: #e8f5e9; 
        color: #2e7d32;
    }
}