:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --success: #10B981;
    --success-hover: #059669;
    --bg-color: #F3F4F6;
    --card-bg: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    padding: 2rem;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.header-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    animation: fadeIn 0.4s ease-out;
}

.card h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-row .col {
    flex: 1;
    margin-bottom: 0;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    gap: 0.5rem;
}

.btn.primary {
    background-color: var(--primary);
    color: white;
}

.btn.primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn.success {
    background-color: var(--success);
    color: white;
    width: 100%;
}

.btn.success:hover {
    background-color: var(--success-hover);
    transform: translateY(-1px);
}

.btn.secondary {
    background-color: #E5E7EB;
    color: #4B5563;
}

.btn.secondary:hover {
    background-color: #D1D5DB;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0;
    transition: var(--transition);
}

.btn-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.loader {
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

.hidden {
    display: none !important;
}

.preview-field {
    margin-bottom: 1.25rem;
}

.preview-field strong {
    display: block;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.preview-field div, .preview-field ol {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    white-space: pre-wrap;
}

.preview-field ol {
    padding-left: 2.5rem;
}

.preview-field li {
    white-space: pre-wrap;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: capitalize;
}

.tag .remove-tag, .tag .remove-priority {
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: inherit;
    opacity: 0.6;
    transition: opacity 0.15s ease;
    display: inline-block;
    font-weight: bold;
    margin-left: 2px;
}

.tag .remove-tag:hover, .tag .remove-priority:hover {
    opacity: 1;
}

.prev-milestone.select-input, .prev-assignee.select-input {
    width: 100%;
    max-width: 320px;
    padding: 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    cursor: pointer;
}

.prev-milestone.select-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.tag.priority {
    background-color: #F3F4F6;
    color: #4B5563;
}
.tag.priority.critical, .tag.priority.high {
    background-color: #FEE2E2;
    color: #991B1B;
}
.tag.priority.medium {
    background-color: #FEF3C7;
    color: #92400E;
}
.tag.priority.low {
    background-color: #D1FAE5;
    color: #065F46;
}
.tag.priority.none {
    background-color: #F3F4F6;
    color: #4B5563;
}

.label-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    background: transparent !important;
    padding: 0 !important;
}

.label-container .tag {
    background-color: #DBEAFE;
    color: #1E40AF;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
    animation: fadeIn 0.3s ease-out;
}

.alert.success {
    background-color: #D1FAE5;
    color: #065F46;
    border: 1px solid #34D399;
}

.alert.error {
    background-color: #FEE2E2;
    color: #991B1B;
    border: 1px solid #F87171;
}

.alert a {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
}

/* Searchable Select Dropdown */
.searchable-select-container {
    position: relative;
}

.searchable-select {
    position: relative;
    display: flex;
    align-items: center;
}

.searchable-select input[type="text"] {
    padding-right: 2.5rem;
}

.searchable-select .dropdown-icon {
    position: absolute;
    right: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition);
}

.searchable-select.open .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    max-height: 250px;
    overflow-y: auto;
    z-index: 10;
    list-style: none;
    margin-top: 2px;
}

.dropdown-list li {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.dropdown-list li:hover, .dropdown-list li.highlighted {
    background-color: var(--bg-color);
    color: var(--primary);
}

.dropdown-list li.no-results {
    color: var(--text-muted);
    cursor: default;
    background-color: transparent;
}

/* Scanner Collapsible */
.scanner-fields {
    background-color: #F9FAFB;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px dashed var(--border);
    margin-bottom: 1.5rem;
    animation: fadeIn 0.3s ease-out;
}

/* Editable Fields in Preview */
[contenteditable="true"] {
    position: relative;
    border: 1px dashed transparent;
    padding: 0.5rem 0.75rem;
    margin: -0.5rem -0.75rem;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
}
.preview-field ol[contenteditable="true"] {
    margin: 0;
}
[contenteditable="true"]:hover {
    border-color: #CBD5E1;
    background-color: rgba(241, 245, 249, 0.5);
    cursor: text;
}
[contenteditable="true"]:focus {
    border-color: var(--primary);
    background-color: #FFFFFF;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Chat-Based Refinement Interface */
.refinement-chat-container {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.refinement-chat-container h3 {
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    font-weight: 600;
}
.refinement-form {
    display: flex;
    gap: 0.75rem;
}
.refinement-form input[type="text"] {
    flex-grow: 1;
    margin-bottom: 0;
}
.btn.refine-btn {
    background-color: #4F46E5;
    color: white;
    padding: 0.5rem 1.25rem;
    font-size: 0.95rem;
}
.btn.refine-btn:hover {
    background-color: #4338CA;
}

/* Multi-Card Layout styling */
.preview-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    background-color: var(--card-bg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    animation: fadeIn 0.3s ease-out;
}
.preview-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
}
.preview-card-header span {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}
.btn-delete-card {
    background: none;
    border: none;
    color: #EF4444;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition);
}
.btn-delete-card:hover {
    color: #DC2626;
    text-decoration: underline;
}
.card-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}
.card-actions .btn {
    width: auto;
}
.preview-field-row {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.preview-field-row .preview-field {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
}
.bulk-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border);
}

.missed-task-section {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

.missed-task-section h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-size: 1.15rem;
}

.missed-task-section .section-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Tab Navigation */
.tabs {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}
.tab-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}
.tab-btn:hover {
    color: var(--primary);
}
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.tab-content.hidden {
    display: none !important;
}

/* Command Console and Retester styling */
.command-input-container {
    display: flex;
    gap: 0.75rem;
}
.command-input-container input[type="text"] {
    flex: 1;
    font-family: 'Consolas', 'Courier New', Courier, monospace;
}
.help-text {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.help-text code {
    background-color: var(--border);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-family: monospace;
}

/* Output Section */
.retest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}
.retest-badges {
    display: flex;
    gap: 0.5rem;
}
.badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
#retest-status-badge {
    background-color: #E2E8F0;
    color: #475569;
}
#retest-status-badge.passed {
    background-color: #D1FAE5;
    color: #065F46;
}
#retest-status-badge.failed {
    background-color: #FEE2E2;
    color: #991B1B;
}
#retest-status-badge.inconclusive {
    background-color: #FEF3C7;
    color: #92400E;
}
#retest-status-badge.pending {
    background-color: #E2E8F0;
    color: #475569;
}

#retest-recommendation-badge {
    background-color: #F1F5F9;
    color: #475569;
}
#retest-recommendation-badge.close-issue {
    background-color: #DBEAFE;
    color: #1E40AF;
}
#retest-recommendation-badge.keep-open {
    background-color: #F3E8FF;
    color: #6B21A8;
}

/* Editor & Logs styling */
.code-editor {
    font-family: 'Consolas', 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    background-color: #1E1E1E;
    color: #D4D4D4;
    line-height: 1.5;
    padding: 1rem;
    border: 1px solid #3C3C3C;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}
.code-editor:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
    outline: none;
}
.editor-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
}
.editor-actions .btn {
    width: auto;
}
.logs-console {
    font-family: 'Consolas', 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    background-color: #0F172A;
    color: #38BDF8;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #1E293B;
    overflow-x: auto;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
}

.verdict-summary {
    background-color: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-top: 1.5rem;
}
.verdict-summary h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: var(--text-main);
    font-weight: 600;
}
.verdict-summary p {
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.6;
}

/* Settings Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.25rem;
    color: var(--text-main);
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.btn-close:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.btn-icon {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-icon:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}
