/* Custom color theme */
:root {
    --primary-green: #199953;
    --primary-green-hover: #157a43;
    --white-bg: #ffffff;
    --medium-grey-bg: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --bs-body-font-size: 15px;
}

/* Auto-expanding text areas */
.auto-expand {
    resize: none;
    overflow: hidden;
    word-wrap: break-word;
}

/* Rich text editor styles */
#bulletEditor {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
}

#bulletEditor:empty::before {
    content: attr(data-placeholder);
    color: var(--bs-secondary);
    pointer-events: none;
}

#bulletEditor:focus {
    outline: none;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Result area styles */
#resultArea {
    white-space: pre-wrap;
    word-wrap: break-word;
    border: none;
    background-color: var(--medium-grey-bg) !important;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
}

/* Detector split layout areas */
#analysisArea, #reasoningArea {
    white-space: pre-wrap !important;
    word-wrap: break-word;
    border: none;
    background-color: var(--medium-grey-bg) !important;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
}

#aiScentRemovalArea {
    border: none;
    background-color: var(--medium-grey-bg) !important;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
}

/* Resume bullets styling for AI scent removal */
#aiScentRemovalArea .resume-bullets {
    list-style: disc outside;
    padding-left: 1.5rem;
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
}

#aiScentRemovalArea .resume-bullets li + li {
    margin-top: 0.6rem;
}

/* Common expansion icon styling */
.expansion-icon {
    color: var(--primary-green) !important;
    text-decoration: none !important;
    border: none !important;
    background: transparent !important;
    background-color: transparent !important;
    margin-right: 0 !important;
    padding-right: 0 !important;
    box-shadow: none !important;
    outline: none !important;
}

.expansion-icon:hover,
.expansion-icon:focus,
.expansion-icon:active {
    color: var(--primary-green-hover) !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
    text-decoration: none !important;
    transform: none !important;
}

/* Bootstrap override for expansion icons */
button.expansion-icon.btn.btn-link,
button.expansion-icon.btn.btn-link:hover,
button.expansion-icon.btn.btn-link:focus,
button.expansion-icon.btn.btn-link:active {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Detector Layout Namespace - Higher specificity than Bootstrap */
.detector-layout {
    --detector-spacing: 1rem; /* Consistent 16px spacing */
    --detector-divider: var(--border-color);
}

/* Section structure with built-in dividers */
.detector-section {
    display: flow-root; /* Prevent margin collapsing */
    border-bottom: 1px solid var(--detector-divider);
    opacity: 1;
    margin: 0 !important; /* Override Bootstrap utility classes */
}

/* Last section doesn't need bottom border */
.detector-section:last-child {
    border-bottom: none;
}

/* Section header controls all spacing above divider */
.detector-section-header {
    padding: var(--detector-spacing) 0;
    margin: 0 !important; /* Override any Bootstrap margins */
}

/* Section body spacing starts below the header */
.detector-section-body {
    margin-top: 0 !important;
    margin-bottom: var(--detector-spacing);
}

/* When section body is hidden, no bottom spacing */
.detector-section-body[style*="display: none"] {
    margin-bottom: 0;
}

/* Action area (for button) - standalone between sections */
.detector-action-area {
    padding: var(--detector-spacing) 0;
    margin: 0;
    transition: all 0.2s ease;
}

/* When the button inside is hidden, collapse the action area */
.detector-action-area > .d-none:only-child {
    display: none !important;
}

/* Collapse the action area wrapper when it only contains hidden elements */
.detector-action-area:not(:has(button:not(.d-none))) {
    padding: 0;
    margin: 0;
    border: none;
    min-height: 0;
}

/* Ensure expansion button containers align to right edge */
.detector-section-header .d-flex.align-items-center {
    margin-right: 0 !important;
    padding-right: 0 !important;
}

#thinkingSection .detector-section-header {
  padding-top: 0.5rem !important; /* reduce from the default 1rem */
}

#aiScentRemovalArea .resume-bullets li {
    line-height: 1.6;
}

/* Detection results bullet styling */
#analysisArea .detection-bullets {
    list-style: disc outside;
    padding-left: 1.5rem;
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
}

#analysisArea .detection-bullets li + li {
    margin-top: 0.6rem;
}

#analysisArea .detection-bullets li {
    line-height: 1.6;
}

/* Nested bullets for detection results */
#analysisArea .detection-bullets ul {
    list-style: circle outside;
    padding-left: 1.2rem;
    margin-top: 0.3rem;
    margin-bottom: 0;
}

#analysisArea .detection-bullets ul li {
    margin-top: 0.3rem;
}

#analysisArea .detection-bullets ul li:first-child {
    margin-top: 0.3rem;
}

/* Fallback nested bullet styling for any nested lists in analysis area */
#analysisArea ul ul {
    list-style: circle outside;
    padding-left: 1.2rem;
    margin-top: 0.3rem;
    margin-bottom: 0;
}

#analysisArea ul ul li {
    margin-top: 0.3rem;
}

/* Third level nesting */
#analysisArea ul ul ul {
    list-style: square outside;
}

/* AI Scent Level badges */
.ai-scent-high {
    background-color: #dc3545 !important;
    color: white !important;
}

.ai-scent-medium {
    background-color: #fd7e14 !important;
    color: white !important;
}

.ai-scent-low {
    background-color: var(--primary-green) !important;
    color: white !important;
}

/* Markup styling in result area */
#resultArea ul {
    margin: 0;
    padding-left: 1.5rem;
    list-style: disc outside;
}

#resultArea li {
    line-height: 1.6;
}

#resultArea li + li {
    margin-top: 0.6rem;
}

#resultArea strong {
    font-weight: 600;
    color: var(--bs-body-color);
}

#resultArea em {
    font-style: italic;
    color: var(--bs-body-color);
}

#resultArea br {
    line-height: 1.5;
}

/* Feather icon sizing */
.feather-sm {
    width: 16px;
    height: 16px;
}

.feather-lg {
    width: 48px;
    height: 48px;
}

/* Card styling */
.card {
    border: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
}

.card-header {
    background-color: var(--bs-secondary-bg);
    border-bottom: 1px solid var(--bs-border-color);
}

/* Button loading state */
.btn:disabled {
    pointer-events: none;
}

/* Custom button styling */
.btn-primary {
    background-color: var(--primary-green) !important;
    border-color: var(--primary-green) !important;
    color: white !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--primary-green-hover) !important;
    border-color: var(--primary-green-hover) !important;
    color: white !important;
}

/* Use radius for Sniff AI button. Only when Detector UI is visible (AI Sniff mode) */
body:has(#detectorSplitLayout:not(.d-none)) #autofixBtn {
  border-top-right-radius: var(--bs-border-radius) !important;
  border-bottom-right-radius: var(--bs-border-radius) !important;
}


/* Background and layout styling */
body {
    background-color: var(--white-bg) !important;
    color: var(--text-color) !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Open Sans', 'Helvetica Neue', sans-serif !important;
}

.container {
    background-color: var(--white-bg);
}

/* Card styling */
.card {
    border: 1px solid var(--border-color) !important;
    background-color: var(--card-bg) !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 1rem !important;
}

.card-header {
    background-color: var(--medium-grey-bg) !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
    border-top-left-radius: 1rem !important;
    border-top-right-radius: 1rem !important;
}

/* Form controls */
.form-control {
    background-color: var(--card-bg) !important;
    border-color: var(--border-color) !important;
    color: var(--text-color) !important;
}

.form-control:focus {
    border-color: var(--primary-green) !important;
    box-shadow: 0 0 0 0.25rem rgba(25, 153, 83, 0.25) !important;
}

/* Text colors */
.text-muted {
    color: var(--text-muted) !important;
}

/* Utility classes */
.opacity-50 {
    opacity: 0.5 !important;
}

/* Custom dropdown split button sizing */
#autofixDropdownBtn {
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
    padding: 0.375rem 0.2rem !important;
    flex: 0 0 24px !important;
}

/* Button outline styling for other components (not tabs) */
.btn-outline-primary {
    border-color: var(--primary-green) !important;
    color: var(--primary-green) !important;
    background-color: transparent !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--primary-green) !important;
    border-color: var(--primary-green) !important;
    color: white !important;
}


/* Modern tab styling with underline design */
.nav-tabs {
    border-bottom: 1px solid var(--border-color) !important;
    margin-bottom: 0 !important;
}

.nav-tabs .nav-link {
    border: none !important;
    border-radius: 0 !important;
    color: var(--text-muted) !important;
    background-color: transparent !important;
    font-weight: 500;
    padding: 1rem 1.5rem 0.5rem 1.5rem !important; /* top right bottom left */
    margin-bottom: 0 !important;
    position: relative;
    transition: all 0.3s ease-in-out;
    letter-spacing: 0.5px;
    border-bottom: 3px solid transparent !important;
}

.nav-tabs .nav-link:hover {
    background-color: rgba(25, 153, 83, 0.05) !important;
    color: var(--primary-green) !important;
    border-bottom: 3px solid rgba(25, 153, 83, 0.3) !important;
}

.nav-tabs .nav-link.active {
    background-color: transparent !important;
    color: var(--primary-green) !important;
    font-weight: 600;
    border-bottom: 3px solid var(--primary-green) !important;
}

.nav-tabs .nav-link.active:hover {
    color: var(--primary-green-hover) !important;
    background-color: rgba(25, 153, 83, 0.05) !important;
    border-bottom: 3px solid var(--primary-green-hover) !important;
}

/* Disabled tab styling with enhanced visual feedback */
.nav-tabs .nav-link:disabled {
    color: rgba(108, 117, 125, 0.4) !important;
    background-color: transparent !important;
    border-bottom: 3px solid transparent !important;
    cursor: not-allowed;
    opacity: 0.6;
}

.nav-tabs .nav-link:disabled:hover {
    color: rgba(108, 117, 125, 0.4) !important;
    background-color: transparent !important;
    border-bottom: 3px solid transparent !important;
}

/* Lock icon styling for disabled tabs */
.nav-tabs .nav-link:disabled .lock-icon {
    opacity: 0.7;
    margin-right: 0.5rem;
}

/* Pet icon spinning animation */
@keyframes petSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.pet-spinning {
    animation: petSpin 1s linear infinite;
}

/* Allow both cards to grow with content */
.col-lg-6 .card {
    min-height: 500px; /* Minimum height instead of fixed */
    height: auto; /* Allow automatic height */
    display: flex;
    flex-direction: column;
}

/* Allow card bodies to grow naturally */
.col-lg-6 .card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Contain content within card */
}

/* Remove any height constraints on content containers */
.col-lg-6:first-child .card .card-body > div:first-child {
    flex: 0 1 auto; /* Allow it to shrink/grow with content */
}

/* Allow output card detector layout to grow naturally */
#detectorSplitLayout {
    display: flex;
    flex-direction: column;
    height: auto;
}

/* Ensure sections within detector layout can expand */
#detectorSplitLayout > div {
    flex: 0 1 auto; /* Allow sections to grow/shrink as needed */
}

/* Text input styling */
#textInput {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
}

/* Card title styling */
.card-title {
    font-size: 15px !important;
    font-weight: bold !important;
}

/* Sticky footer setup */
html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
}

.container.py-5 {
    flex: 1;
}

/* Footer styling */
footer {
    padding: 0.5rem 0;
    margin-top: 0;
}

footer .container {
    background: transparent;
}

footer p {
    font-size: 12px;
    color: white;
}

/* Remove all borders from trash button */
.no-focus-outline {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0.25rem 0.5rem !important;
    color: #dc3545 !important;
}

.no-focus-outline:hover,
.no-focus-outline:focus,
.no-focus-outline:active {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
    color: #dc3545 !important;
    opacity: 0.8;
}

/* Spray icon animation for Remove AI Scent */
@keyframes sprayPump {
    0% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(-45deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

.spray-pumping {
    animation: sprayPump 1s ease-in-out infinite;
}

/* Override Bootstrap btn-link color for text-primary utility class */
.btn.btn-link.text-primary {
    color: var(--primary-green) !important;
}

/* Dropdown item styling */
.dropdown-item:active {
    background-color: rgba(25, 153, 83, 0.15) !important;
    color: var(--primary-green) !important;
}

.dropdown-item:focus {
    background-color: #6c757d !important;
    color: white !important;
}

