/* Simple, clean styling for Hypothesis Scoper */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #0A0E17; /* Vantum Midnight Black */
    color: #FFFFFF; /* Vantum White */
    line-height: 1.6;
    padding: 20px;
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* Mobile-first responsive padding */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
}

.container {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

header {
    margin-bottom: 40px;
    padding: 20px 0;
}

.header-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #2A2E39;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-content {
    text-align: center;
}

.logo {
    max-width: 60px;
    height: auto;
    margin-bottom: 12px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    opacity: 1;
    filter: brightness(0) invert(1); /* Makes logo white by default */
    transition: filter 0.3s ease;
}

.logo:hover {
    filter: brightness(0) invert(0.6); /* Makes logo gray on hover */
}

@media (max-width: 768px) {
    .header-top-bar {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .header-left,
    .header-right {
        justify-content: center;
    }
    
    .header-right {
        flex-wrap: wrap;
    }
    
    .logo {
        max-width: 50px;
        margin-bottom: 10px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .subtitle {
        font-size: 0.9em;
    }
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #FFFFFF; /* Vantum White */
}

.subtitle {
    color: #A3A6B4; /* Vantum Light Gray */
    font-size: 1.1em;
}

.card {
    background: #1A1E29; /* Vantum Charcoal */
    color: #FFFFFF; /* White text on dark background */
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

@media (max-width: 768px) {
    .card {
        padding: 20px;
        margin-bottom: 20px;
        border-radius: 6px;
    }
    
    .card h2 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
}

.card h2 {
    margin-bottom: 20px;
    color: #FFFFFF; /* White for headings on dark background */
    font-size: 1.5em;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .section-header h2 {
        font-size: 1.2em;
    }
    
    .section-header .btn-small {
        width: 100%;
    }
}

.section-header h2 {
    margin-bottom: 0;
    color: #FFFFFF; /* White for headings */
}

textarea {
    width: 100%;
    max-width: 100%;
    padding: 15px;
    border: 2px solid #A3A6B4; /* Vantum Light Gray border */
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 15px;
    background-color: #0A0E17; /* Vantum Midnight Black */
    color: #FFFFFF; /* White text */
    overflow-x: hidden;
    box-sizing: border-box;
}

textarea:focus {
    outline: none;
    border-color: #3498db;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: 500;
    width: auto;
    display: inline-block;
}

@media (max-width: 768px) {
    .btn {
        width: 100%;
        padding: 14px 24px;
        font-size: 16px;
    }
}

.btn-primary {
    background-color: #007A7A; /* Vantum Dark Teal */
    color: white;
}

.btn-primary:hover {
    background-color: #006666; /* Darker teal for hover */
}

.btn-primary:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-secondary:disabled,
.btn-secondary.save-btn-disabled {
    background-color: #4A4E5A;
    color: #6B7280;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary.save-btn-enabled {
    background-color: #00D4AA;
    color: #0A0E17;
}

.btn-secondary.save-btn-enabled:hover {
    background-color: #00B894;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-spacing {
    margin-top: 15px;
    margin-bottom: 10px;
}

/* Button group for side-by-side buttons */
.button-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

@media (max-width: 768px) {
    .button-group {
        flex-direction: column;
    }
    
    .button-group .btn {
        width: 100%;
    }
}

.output {
    background-color: #0A0E17; /* Vantum Midnight Black */
    border: 1px solid #A3A6B4; /* Vantum Light Gray border */
    border-radius: 4px;
    padding: 20px;
    white-space: normal; /* Changed from pre-wrap to allow HTML formatting */
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif; /* Changed from monospace */
    font-size: 14px;
    line-height: 1.7;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 15px;
    word-wrap: break-word;
    color: #FFFFFF; /* White text */
    /* Prevent jitter during streaming */
    contain: layout style;
    will-change: scroll-position;
}

@media (max-width: 768px) {
    .output {
        padding: 15px;
        font-size: 12px;
        max-height: 400px;
    }
}

.loading {
    text-align: center;
    padding: 20px;
    color: #A3A6B4; /* Vantum Light Gray */
    font-style: italic;
}

/* Progress bar and loading container */
.loading-container {
    padding: 20px;
    text-align: center;
}

.loading-text {
    color: #FFFFFF; /* White text */
    font-weight: 500;
    margin-bottom: 15px;
    font-size: 16px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    width: 0%;
    transition: width 0.3s ease;
    animation: progressPulse 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes progressPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.time-estimate {
    color: #A3A6B4; /* Vantum Light Gray */
    font-size: 14px;
    margin-top: 8px;
}

.estimate-text {
    margin-left: 8px;
    color: #95a5a6;
}

@media (max-width: 768px) {
    .loading-container {
        padding: 15px;
    }
    
    .loading-text {
        font-size: 14px;
    }
    
    .time-estimate {
        font-size: 12px;
    }
}

.error {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.success-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #27ae60;
    color: white;
    padding: 15px 25px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
}

@media (max-width: 768px) {
    .success-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        padding: 12px 20px;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Scrollbar styling for output - dark theme */
.output::-webkit-scrollbar,
.hypothesis-output::-webkit-scrollbar {
    width: 8px;
}

.output::-webkit-scrollbar-track,
.hypothesis-output::-webkit-scrollbar-track {
    background: #1A1E29; /* Vantum Charcoal - dark track */
}

.output::-webkit-scrollbar-thumb,
.hypothesis-output::-webkit-scrollbar-thumb {
    background: #A3A6B4; /* Vantum Light Gray - visible thumb */
    border-radius: 4px;
}

.output::-webkit-scrollbar-thumb:hover,
.hypothesis-output::-webkit-scrollbar-thumb:hover {
    background: #7f8c8d; /* Darker gray on hover */
}

/* Vertical layout - hypothesis on top, chat below */
.hypothesis-panel {
    margin-bottom: 30px;
}


.hypothesis-output {
    background-color: #0A0E17; /* Vantum Midnight Black - matches textarea */
    color: #FFFFFF; /* White text */
    border: 2px solid #A3A6B4; /* Vantum Light Gray border - matches textarea */
    border-radius: 6px;
    padding: 25px;
    white-space: normal; /* Changed from pre-wrap to allow HTML formatting */
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.7;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: border-color 0.3s;
    cursor: text;
    min-height: 400px;
    /* Prevent jitter during streaming */
    contain: layout style;
    will-change: scroll-position;
    word-wrap: break-word;
    word-break: break-word;
}

/* Editable textarea for hypothesis editing */
.hypothesis-output-edit {
    background-color: #0A0E17; /* Vantum Midnight Black */
    color: #FFFFFF; /* White text */
    border: 2px solid #3498db; /* Blue border when editing */
    border-radius: 6px;
    padding: 25px;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.7;
    max-height: 600px;
    min-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    resize: vertical;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    word-wrap: break-word;
    word-break: break-word;
}

.hypothesis-output-edit:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Icon button styles for edit/save/cancel */
.btn-icon {
    background: transparent;
    border: 1px solid #A3A6B4;
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-width: 32px;
    height: 32px;
}

.btn-icon:hover {
    background-color: #1A1E29;
    border-color: #3498db;
    color: #3498db;
}

.btn-icon:active {
    transform: scale(0.95);
}

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

/* Styling for rendered HTML content in output areas */
.hypothesis-output h1,
.output h1,
.quick-scope-output h1 {
    font-size: 1.8em;
    font-weight: 700;
    margin: 1.5em 0 0.8em 0;
    color: #FFFFFF;
    border-bottom: 2px solid #007A7A;
    padding-bottom: 0.5em;
}

.hypothesis-output h2,
.output h2,
.quick-scope-output h2 {
    font-size: 1.5em;
    font-weight: 600;
    margin: 1.3em 0 0.6em 0;
    color: #FFFFFF;
    border-bottom: 1px solid #2A2E39;
    padding-bottom: 0.4em;
}

.hypothesis-output h3,
.output h3,
.quick-scope-output h3 {
    font-size: 1.2em;
    font-weight: 600;
    margin: 1em 0 0.5em 0;
    color: #FFFFFF;
}

.hypothesis-output h4,
.output h4,
.quick-scope-output h4 {
    font-size: 1.1em;
    font-weight: 600;
    margin: 0.8em 0 0.4em 0;
    color: #FFFFFF;
}

.hypothesis-output h5,
.output h5,
.quick-scope-output h5 {
    font-size: 1em;
    font-weight: 600;
    margin: 0.6em 0 0.3em 0;
    color: #FFFFFF;
}

.hypothesis-output h6,
.output h6,
.quick-scope-output h6 {
    font-size: 0.9em;
    font-weight: 600;
    margin: 0.5em 0 0.3em 0;
    color: #A3A6B4;
}

.hypothesis-output p,
.output p,
.quick-scope-output p {
    margin: 0.8em 0;
    line-height: 1.7;
    color: #FFFFFF;
}

.hypothesis-output ul,
.hypothesis-output ol,
.output ul,
.output ol,
.quick-scope-output ul,
.quick-scope-output ol {
    margin: 0.8em 0;
    padding-left: 2em;
    color: #FFFFFF;
}

.hypothesis-output li,
.output li,
.quick-scope-output li {
    margin: 0.4em 0;
    line-height: 1.6;
    color: #FFFFFF;
}

.hypothesis-output strong,
.output strong,
.quick-scope-output strong {
    font-weight: 600;
    color: #FFFFFF;
}

.hypothesis-output em,
.output em,
.quick-scope-output em {
    font-style: italic;
    color: #FFFFFF;
}

.hypothesis-output code,
.output code,
.quick-scope-output code {
    background-color: #1A1E29;
    color: #00D9FF;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.hypothesis-output:focus-within {
    border-color: #3498db; /* Blue focus border */
    outline: none;
}

@media (max-width: 768px) {
    .hypothesis-output {
        padding: 20px;
        font-size: 13px;
        min-height: 300px;
        max-height: 500px;
    }
}

.action-buttons {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #A3A6B4; /* Vantum Light Gray border - matches theme */
}

/* Advanced Mode Modal - Full Screen ChatGPT-like */
.advanced-modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: #0A0E17; /* Vantum Midnight Black */
    animation: fadeIn 0.15s ease-out;
}

.advanced-modal.show {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.advanced-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 100%;
    background-color: #0A0E17;
    position: relative;
}

/* Minimal header - just close button */
.advanced-modal-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 12px 16px;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}

.advanced-modal-close-btn {
    background: rgba(42, 46, 57, 0.6);
    border: none;
    color: #A3A6B4;
    cursor: pointer;
    padding: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.advanced-modal-close-btn:hover {
    background: rgba(42, 46, 57, 0.9);
    color: #FFFFFF;
    transform: scale(1.05);
}

.advanced-modal-close-btn svg {
    width: 18px;
    height: 18px;
}

/* Chat messages container - ChatGPT-like spacing */
.advanced-chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 80px 0 20px 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 768px;
    width: 100%;
    margin: 0 auto;
    scroll-behavior: smooth;
}

.advanced-chat-message {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 0 24px;
    animation: slideUp 0.3s ease-out;
    position: relative;
}

.advanced-chat-message.user {
    flex-direction: row-reverse;
}

.advanced-chat-message.user .advanced-message-content {
    background: linear-gradient(135deg, #007A7A 0%, #006666 100%);
    color: #FFFFFF;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 2px 8px rgba(0, 122, 122, 0.2);
    max-width: calc(100% - 20px); /* More width since no avatar */
}

.advanced-chat-message.assistant .advanced-message-content {
    background-color: #1A1E29;
    color: #E5E7EB;
    border-radius: 18px 18px 18px 4px;
    border: 1px solid rgba(42, 46, 57, 0.5);
}

.advanced-message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 4px;
}

.advanced-chat-message.user .advanced-message-avatar {
    background: linear-gradient(135deg, #007A7A 0%, #006666 100%);
    color: #FFFFFF;
}

.advanced-chat-message.assistant .advanced-message-avatar {
    background: linear-gradient(135deg, #2A2E39 0%, #1A1E29 100%);
    color: #00D4AA;
    border: 1px solid rgba(0, 212, 170, 0.2);
}

.advanced-message-content {
    flex: 1;
    padding: 14px 18px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: calc(100% - 50px);
    font-size: 15px;
    letter-spacing: 0.01em;
}

/* Markdown-like formatting */
.advanced-message-content strong {
    font-weight: 600;
    color: inherit;
}

.advanced-message-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.advanced-message-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.advanced-message-content ul,
.advanced-message-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.advanced-message-content li {
    margin: 4px 0;
}

/* Markdown headers */
.advanced-message-content h1 {
    font-size: 1.5em;
    font-weight: 600;
    margin: 16px 0 12px 0;
    color: #FFFFFF;
    line-height: 1.3;
}

.advanced-message-content h2 {
    font-size: 1.3em;
    font-weight: 600;
    margin: 14px 0 10px 0;
    color: #FFFFFF;
    line-height: 1.3;
}

.advanced-message-content h3 {
    font-size: 1.1em;
    font-weight: 600;
    margin: 12px 0 8px 0;
    color: #FFFFFF;
    line-height: 1.3;
}

/* Vantum logo in avatar */
.advanced-avatar-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

/* Copy button for messages */
.advanced-chat-message {
    position: relative;
}

.advanced-message-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(42, 46, 57, 0.8);
    border: 1px solid rgba(42, 46, 57, 0.5);
    color: #A3A6B4;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    padding: 0;
    z-index: 5;
}

.advanced-chat-message:hover .advanced-message-copy-btn {
    opacity: 1;
}

.advanced-message-copy-btn:hover {
    background: rgba(42, 46, 57, 1);
    color: #FFFFFF;
    border-color: #007A7A;
}

/* Loading indicator with typing animation */
.advanced-chat-message.assistant .advanced-message-content.typing::after {
    content: '...';
    animation: typing 1.5s infinite;
}

@keyframes typing {
    0%, 60% { opacity: 1; }
    30% { opacity: 0.3; }
}

/* Chat input container - ChatGPT-like */
.advanced-chat-input-container {
    padding: 16px 24px 24px 24px;
    background: linear-gradient(to top, #0A0E17 0%, rgba(10, 14, 23, 0.95) 100%);
    max-width: 768px;
    width: 100%;
    margin: 0 auto;
    position: relative;
}

.advanced-input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    background: #1A1E29;
    border: 1.5px solid #2A2E39;
    border-radius: 24px;
    padding: 4px;
    transition: all 0.2s ease;
}

.advanced-input-wrapper:focus-within {
    border-color: #007A7A;
    box-shadow: 0 0 0 3px rgba(0, 122, 122, 0.1);
}

.advanced-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 20px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    background: transparent;
    color: #FFFFFF;
    min-height: 24px;
    max-height: 200px;
    line-height: 1.5;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    /* Hide scrollbar but keep scrolling functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari, Opera */
.advanced-chat-input::-webkit-scrollbar {
    display: none;
}

.advanced-chat-input::placeholder {
    color: #6B7280;
}

.advanced-chat-input:focus {
    outline: none;
}

.advanced-send-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #007A7A;
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    margin: 2px;
    flex-shrink: 0;
}

.advanced-send-btn:hover:not(:disabled) {
    background: #006666;
    transform: scale(1.05);
}

.advanced-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.advanced-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #2A2E39;
}

.advanced-send-btn svg {
    width: 16px;
    height: 16px;
}

.advanced-input-footer {
    margin-top: 8px;
    text-align: center;
}

.advanced-input-hint {
    color: #6B7280;
    font-size: 12px;
}

/* Generate hypothesis button (inside the input area; avoids overlap with send button on mobile) */
.advanced-generate-btn {
    margin-top: 12px;
    width: 100%;
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 122, 122, 0.6);
    background: linear-gradient(135deg, #007A7A 0%, #006666 100%);
    color: #FFFFFF;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.advanced-generate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #009999 0%, #007A7A 100%);
}

.advanced-generate-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.12);
    background: #2A2E39;
}

/* Scrollbar for chat messages - ChatGPT-like */
.advanced-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.advanced-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.advanced-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(42, 46, 57, 0.5);
    border-radius: 3px;
}

.advanced-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(42, 46, 57, 0.8);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .advanced-chat-messages {
        padding: 60px 0 16px 0;
        gap: 20px;
        max-width: 100%;
    }
    
    .advanced-chat-message {
        padding: 0 16px;
        gap: 12px;
    }
    
    .advanced-message-content {
        max-width: calc(100% - 42px);
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .advanced-chat-input-container {
        padding: 12px 16px 20px 16px;
        max-width: 100%;
    }
    
    .advanced-generate-btn {
        padding: 14px 16px;
        font-size: 16px;
        border-radius: 12px;
    }
}

/* Header Actions - for multiple buttons in section header */
.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

@media (max-width: 768px) {
    .header-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .header-actions .btn-small {
        width: 100%;
    }
}

/* Confluence Export Modal */
.confluence-modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.2s ease;
    overflow-y: auto; /* Allow scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.confluence-modal-content.payment-offer-modal {
    /* Larger, richer modal like the reference image */
    /* NOTE: This must beat `.confluence-modal-content` (max-width: 600px) which appears later. */
    width: min(980px, 95vw);
    max-width: 980px;
    max-height: 90vh;
    overflow-y: auto; /* Allow scrolling on mobile */
    overflow-x: hidden;
    background: radial-gradient(1200px 600px at 20% 0%, rgba(0, 212, 170, 0.10) 0%, rgba(26, 30, 41, 1) 45%) , #1A1E29;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
}

.payment-offer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.payment-offer-badge {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #0A0E17;
    background: linear-gradient(135deg, #FFB400 0%, #FF7A00 100%);
    padding: 6px 10px;
    border-radius: 6px;
}

.payment-offer-body {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 0;
    flex: 1;
    min-height: 0; /* Allow flex child to shrink */
}

.payment-offer-left {
    padding: 26px 26px 24px 26px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.payment-offer-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.payment-offer-title {
    margin: 0;
    color: #FFFFFF;
    font-size: 34px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.payment-offer-price-pill {
    background: rgba(0, 122, 122, 0.25);
    border: 1px solid rgba(0, 122, 122, 0.55);
    color: #E8FFFA;
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

.payment-offer-subtitle {
    margin: 0 0 14px 0;
    font-size: 18px;
    font-weight: 600;
    color: #E5E7EB;
}

.payment-offer-description {
    margin: 0 0 18px 0;
    color: #A3A6B4;
    line-height: 1.65;
}

.payment-offer-bullets {
    margin: 0 0 18px 0;
    padding: 0;
    list-style: none;
    color: #E5E7EB;
}

.payment-offer-bullets li {
    margin-bottom: 10px;
}

.payment-offer-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.payment-offer-primary {
    width: 100%;
    background: linear-gradient(135deg, #007A7A 0%, #006666 100%);
    border: 1px solid rgba(0, 122, 122, 0.6);
}

.payment-offer-primary:hover {
    background: linear-gradient(135deg, #009999 0%, #007A7A 100%);
}

.payment-offer-secondary {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #E5E7EB;
}

.payment-offer-secondary:hover {
    background: rgba(255, 255, 255, 0.06);
}

.payment-offer-right {
    padding: 26px;
}

.payment-offer-preview {
    background: rgba(10, 14, 23, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    display: grid;
    gap: 14px;
}

.payment-offer-preview-chat {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px;
    background: rgba(26, 30, 41, 0.65);
}

.payment-offer-preview-label {
    color: #A3A6B4;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.payment-offer-preview-bubble {
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.4;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.payment-offer-preview-bubble-user {
    background: rgba(0, 122, 122, 0.18);
    border-color: rgba(0, 122, 122, 0.45);
    color: #E8FFFA;
}

.payment-offer-preview-bubble-ai {
    background: rgba(255, 255, 255, 0.06);
    color: #E5E7EB;
    margin-left: 20px; /* Base indentation for AI responses to show back-and-forth dialogue */
}

/* Progressive indentation for multiple AI responses - each subsequent response indented more */
/* First AI response after user message */
.payment-offer-preview-chat .payment-offer-preview-bubble-user + .payment-offer-preview-bubble-ai {
    margin-left: 20px;
}

/* Second AI response */
.payment-offer-preview-chat .payment-offer-preview-bubble-user + .payment-offer-preview-bubble-ai + .payment-offer-preview-bubble-ai {
    margin-left: 28px;
}

/* Third AI response and beyond */
.payment-offer-preview-chat .payment-offer-preview-bubble-user + .payment-offer-preview-bubble-ai + .payment-offer-preview-bubble-ai + .payment-offer-preview-bubble-ai {
    margin-left: 36px;
}

.payment-offer-preview-output {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px;
    background: rgba(26, 30, 41, 0.65);
}

.payment-offer-preview-output-title {
    color: #A3A6B4;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 10px;
}

.payment-offer-preview-output ul {
    margin: 0;
    padding-left: 18px;
    color: #A3A6B4;
    font-size: 13px;
}

@media (max-width: 900px) {
    .confluence-modal-content.payment-offer-modal {
        width: 95vw;
        max-height: 95vh;
        margin: 10px;
    }
    
    .payment-offer-body {
        grid-template-columns: 1fr;
    }
    .payment-offer-left {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding: 20px;
    }
    .payment-offer-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .payment-offer-title {
        font-size: 28px;
        line-height: 1.2;
    }
    .payment-offer-right {
        padding: 20px;
    }
}

/* Mobile-specific fixes */
@media (max-width: 768px) {
    .confluence-modal-content.payment-offer-modal {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
        height: 100vh;
    }
    
    .payment-offer-header {
        padding: 16px 18px;
        flex-shrink: 0;
    }
    
    .payment-offer-body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .payment-offer-left {
        padding: 20px 18px;
    }
    
    .payment-offer-title {
        font-size: 24px;
    }
    
    .payment-offer-subtitle {
        font-size: 16px;
    }
    
    .payment-offer-description {
        font-size: 14px;
    }
    
    .payment-offer-right {
        padding: 18px;
    }
    
    .payment-offer-preview {
        padding: 14px;
    }
}

.confluence-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px; /* Add padding for mobile */
}

/* On mobile, don't center - let it fill the screen */
@media (max-width: 768px) {
    .confluence-modal.show {
        align-items: flex-start;
        padding: 0;
    }
}

.confluence-modal-content {
    background-color: #1A1E29; /* Vantum Charcoal */
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.confluence-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #2A2E39;
}

.confluence-modal-header h3 {
    margin: 0;
    color: #FFFFFF;
    font-size: 1.5em;
}

.confluence-modal-close-btn {
    background: none;
    border: none;
    color: #FFFFFF;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.confluence-modal-close-btn:hover {
    color: #A3A6B4;
}

.confluence-modal-body {
    padding: 30px;
    flex: 1;
    overflow-y: auto;
}

.confluence-form-group {
    margin-bottom: 20px;
}

.confluence-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #FFFFFF;
    font-weight: 500;
}

.confluence-form-group input {
    width: 100%;
    padding: 12px;
    background-color: #0A0E17; /* Vantum Midnight Black */
    border: 2px solid #2A2E39;
    border-radius: 6px;
    color: #FFFFFF;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.confluence-form-group input:focus {
    outline: none;
    border-color: #007A7A; /* Vantum Teal */
}

.confluence-form-group small {
    display: block;
    margin-top: 6px;
    color: #A3A6B4;
    font-size: 12px;
}

.confluence-form-group small a {
    color: #007A7A;
    text-decoration: none;
}

.confluence-form-group small a:hover {
    text-decoration: underline;
}

.confluence-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 30px;
    border-top: 1px solid #2A2E39;
}

.confluence-status {
    padding: 15px 30px;
    margin-top: 0;
    border-top: 1px solid #2A2E39;
}

.confluence-status.success {
    background-color: rgba(0, 200, 0, 0.1);
    color: #4CAF50;
}

.confluence-status.error {
    background-color: rgba(200, 0, 0, 0.1);
    color: #F44336;
}

@media (max-width: 768px) {
    .confluence-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .confluence-modal-header,
    .confluence-modal-body,
    .confluence-modal-footer {
        padding: 20px;
    }
    
    .confluence-modal-footer {
        flex-direction: column;
    }
    
    .confluence-modal-footer .btn {
        width: 100%;
    }
}

/* My Scopes Modal Styles */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #A3A6B4;
}

.empty-state p {
    margin: 0;
    font-size: 16px;
}

.scope-list-item {
    border: 1px solid #2A2E39;
    border-radius: 8px;
    margin-bottom: 12px;
    background: #1A1E29;
    transition: all 0.2s ease;
    overflow: hidden;
}

.scope-list-item:hover {
    border-color: #3A3E49;
    background: #1F2330;
}

.scope-list-item.expanded {
    border-color: #00D4AA;
}

.scope-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
}

.scope-list-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.scope-list-icon {
    color: #00D4AA;
    flex-shrink: 0;
}

.scope-list-info {
    flex: 1;
    min-width: 0;
}

.scope-list-title {
    margin: 0 0 6px 0;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scope-list-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.scope-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.3px;
}

.scope-type-hypothesis {
    background: rgba(0, 212, 170, 0.15);
    color: #00D4AA;
    border: 1px solid rgba(0, 212, 170, 0.3);
}

.scope-type-scope {
    background: rgba(100, 150, 255, 0.15);
    color: #6496FF;
    border: 1px solid rgba(100, 150, 255, 0.3);
}

.scope-type-quick-scope {
    background: rgba(255, 180, 0, 0.15);
    color: #FFB400;
    border: 1px solid rgba(255, 180, 0, 0.3);
}

.scope-date {
    color: #A3A6B4;
    font-size: 12px;
}

.scope-list-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.scope-action-btn {
    background: transparent;
    border: 1px solid #2A2E39;
    border-radius: 6px;
    color: #A3A6B4;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.scope-action-btn:hover {
    background: #2A2E39;
    border-color: #3A3E49;
    color: #FFFFFF;
}

.scope-delete-btn:hover {
    background: rgba(244, 67, 54, 0.1);
    border-color: #F44336;
    color: #F44336;
}

.scope-expand-btn svg {
    transition: transform 0.2s ease;
}

.scope-list-content {
    border-top: 1px solid #2A2E39;
    background: #151821;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

.scope-content-wrapper {
    padding: 20px;
}

.scope-content-text {
    white-space: pre-wrap;
    color: #E0E0E0;
    font-size: 13px;
    line-height: 1.6;
    margin: 0 0 16px 0;
    padding: 16px;
    background: #0F1217;
    border-radius: 6px;
    border: 1px solid #1A1E29;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.scope-content-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.scopes-search-container {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #2A2E39;
}

.scopes-search-input {
    width: 100%;
    padding: 12px 16px;
    background: #151821;
    border: 1px solid #2A2E39;
    border-radius: 8px;
    color: #FFFFFF;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
}

.scopes-search-input:focus {
    outline: none;
    border-color: #00D4AA;
    background: #1A1E29;
}

.scopes-search-input::placeholder {
    color: #6B7280;
}

@media (max-width: 768px) {
    .scope-list-header {
        padding: 12px 16px;
    }
    
    .scope-list-title {
        font-size: 14px;
    }
    
    .scope-content-wrapper {
        padding: 16px;
    }
    
    .scope-content-text {
        font-size: 12px;
        max-height: 300px;
    }
}
