/* 
 * Custom CSS fixes for AnalyzeLegal UI
 * Created: 2025-06-19
 * Version: 1.2
 */

/* Analysis columns layout */
#analysis-two-column-layout {
    display: flex;
    flex-wrap: nowrap;
    margin: 0 -15px;
    width: calc(100% + 30px);
    min-height: 100%;
}

.document-column,
.analysis-column {
    padding: 0 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .document-column,
    .analysis-column {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

.document-container,
.analysis-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 2rem;
}

.document-browser-content,
.analysis-content {
    padding: 1.25rem;
    background: #fff;
}

/* Ensure content areas don't scroll */
#doc-formatted-content,
#doc-raw-content,
.analysis-results {
    overflow: visible;
    margin: 0;
    padding: 0;
}

/* Ensure the document content is properly contained */
#doc-formatted-content,
#doc-raw-content {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

/* Button styles for statute modal */
#statute-view-full {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

#statute-view-full .fa-external-link-alt,
#statute-view-full .fa-search {
    font-size: 0.875rem;
}

/* Force navigation styles */
body header.header nav.navbar.navbar-dark {
    background-color: #1a202c !important;
    padding: 0.75rem 0 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
}

body header.header nav.navbar.navbar-dark .navbar-brand,
body header.header nav.navbar.navbar-dark .navbar-brand:hover,
body header.header nav.navbar.navbar-dark .navbar-brand:focus {
    color: #ffffff !important;
}

body header.header nav.navbar.navbar-dark .nav-link,
body header.header nav.navbar.navbar-dark .nav-link:hover,
body header.header nav.navbar.navbar-dark .nav-link:focus {
    color: rgba(255, 255, 255, 0.9) !important;
    padding: 0.75rem 1.25rem !important;
}

body header.header nav.navbar.navbar-dark .dropdown-menu {
    background-color: #2d3748 !important;
    border: none !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
}

body header.header nav.navbar.navbar-dark .dropdown-item {
    color: rgba(255, 255, 255, 0.9) !important;
}

body header.header nav.navbar.navbar-dark .dropdown-item:hover,
body header.header nav.navbar.navbar-dark .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

body header.header nav.navbar.navbar-dark .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Enhanced Statute Modal Styles */
#statuteModal .modal-dialog {
    max-width: 800px;
}

#statuteModal .modal-content {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

#statuteModal .modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 1.25rem 1.5rem;
}

#statuteModal .modal-title {
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#statuteModal .modal-body {
    padding: 0;
    max-height: 70vh;
    overflow-y: auto;
}

#statuteModal .modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
}

/* Statute content styles */
#statute-content {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#statute-content.show {
    opacity: 1;
}

#statute-code {
    font-family: 'Courier New', monospace;
    color: #2d3748;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

#statute-date {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

#statute-impact .badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35em 0.65em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#statute-description {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

#statute-compliance-container {
    border-left: 4px solid #f6ad55;
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    background-color: #fffaf0;
    border-radius: 0 4px 4px 0;
}

#statute-compliance-container .alert-heading {
    color: #c05621;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

#statute-compliance {
    font-size: 0.875rem;
    color: #4a5568;
    margin-bottom: 0;
}

#statute-subsections {
    border-top: 1px solid #e9ecef;
    padding: 1.5rem;
}

#statute-subsections h6 {
    color: #4a5568;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#statute-subsections .list-group-item {
    border: 1px solid #e9ecef;
    margin-bottom: 0.5rem;
    border-radius: 6px !important;
    transition: all 0.2s ease;
}

#statute-subsections .list-group-item:hover {
    border-color: #cbd5e0;
    background-color: #f8f9fa;
}

#statute-subsections .list-group-item h6 {
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
    color: #2d3748;
}

#statute-subsections .list-group-item small {
    font-size: 0.75rem;
    color: #718096;
}

#statute-subsections .list-group-item p {
    margin-bottom: 0;
    font-size: 0.875rem;
    color: #4a5568;
}

/* Loading state */
#statute-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

#statute-loading .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 1rem;
    color: #4a90e2;
}

#statute-loading p {
    color: #6c757d;
    margin-top: 1rem;
    font-size: 1rem;
}

/* Error state */
#statute-error {
    padding: 3rem 1.5rem;
    text-align: center;
}

#statute-error .fa-exclamation-circle {
    color: #e53e3e;
    margin-bottom: 1rem;
}

#statute-error h5 {
    color: #2d3748;
    margin-bottom: 0.75rem;
}

#statute-error p {
    color: #6c757d;
    margin-bottom: 1.5rem;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    #statuteModal .modal-dialog {
        margin: 0.5rem;
    }
    
    #statuteModal .modal-body {
        max-height: 70vh;
    }
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0;
        transform: translateY(10px);
    }
    10%, 90% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Frosted Glass Overlay */
.validation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease-in-out;
    pointer-events: auto;
    padding: 20px;
    box-sizing: border-box;
}

/* Show the overlay when active */
.validation-overlay.active {
    opacity: 1;
    visibility: visible;
}

.validation-overlay-icon {
    width: 100px;
    height: 100px;
    margin-bottom: 1.5rem;
    animation: pulse 2.5s infinite cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.validation-overlay-icon svg {
    width: 60%;
    height: 60%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
}

.validation-overlay-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 1.25rem 0;
    text-align: center;
    max-width: 500px;
    padding: 0 20px;
    line-height: 1.5;
    opacity: 1 !important;
    position: relative !important;
    transform: none !important;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.validation-overlay-subtext {
    color: #4b5563;
    font-size: 1rem;
    margin: 0.5rem 0 0;
    max-width: 500px;
    line-height: 1.6;
    text-align: center;
    padding: 0 30px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.rotating-text-container {
    position: relative;
    height: 60px;
    margin: 1rem 0 2rem 0;
    overflow: visible;
    width: 100%;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.rotating-text {
    position: absolute;
    width: 100%;
    text-align: center;
    opacity: 0;
    color: #8B2131 !important;
    font-size: 1.3rem;
    font-weight: 500;
    line-height: 1.6;
    pointer-events: none;
    left: 0;
    right: 0;
    margin: 0 auto;
    padding: 8px 30px;
    box-sizing: border-box;
    text-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    will-change: opacity, transform;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.rotating-text.visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeInOut {
    0% { 
        opacity: 0;
        transform: translateY(10px);
    }
    15% {
        opacity: 1;
        transform: translateY(0);
    }
    85% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Specific delays for each message */
.rotating-text:nth-child(1) { animation-delay: 0s; }
.rotating-text:nth-child(2) { animation-delay: 3s; }
.rotating-text:nth-child(3) { animation-delay: 6s; }
.rotating-text:nth-child(4) { animation-delay: 9s; }
.rotating-text:nth-child(5) { animation-delay: 12s; }
.rotating-text:nth-child(6) { animation-delay: 15s; }
.rotating-text:nth-child(7) { animation-delay: 18s; }
.rotating-text:nth-child(8) { animation-delay: 21s; }

/* Validation overlay styles are defined at the top of the file */

/* Enhanced styling for issue sections */
.issue-card {
    border-left: 4px solid #8B2131;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    background-color: #fff;
    border-radius: 8px;
}

.issue-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
}

.issue-card .card-header {
    background-color: rgba(139, 33, 49, 0.05);
    border-bottom: 1px solid rgba(139, 33, 49, 0.2);
    padding: 1rem;
    display: flex;
    align-items: center;
}

.issue-card .card-header::before {
    content: '\f071'; /* Font Awesome exclamation triangle */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 0.75rem;
    color: #8B2131;
}

.issue-card .card-body {
    padding: 1.25rem;
}

/* Problematic text styling */
.problematic-text-label {
    font-weight: 600;
    color: #8B2131;
    display: flex;
    align-items: center;
}

.problematic-text-label::before {
    content: '\f06a'; /* Font Awesome exclamation circle */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 0.5rem;
}

.problematic-text-content {
    background-color: rgba(139, 33, 49, 0.05);
    border-left: 3px solid #8B2131;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0 1rem;
    border-radius: 0 4px 4px 0;
}

/* Reference styling */
.reference-label {
    font-weight: 600;
    color: #0d6efd;
    display: flex;
    align-items: center;
}

.reference-label::before {
    content: '\f02d'; /* Font Awesome book */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 0.5rem;
}

.reference-content {
    background-color: rgba(13, 110, 253, 0.05);
    border-left: 3px solid #0d6efd;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0 1rem;
    border-radius: 0 4px 4px 0;
}

/* Explanation styling */
.explanation-label {
    font-weight: 600;
    color: #6c757d;
    display: flex;
    align-items: center;
}

.explanation-label::before {
    content: '\f059'; /* Font Awesome question circle */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 0.5rem;
}

.explanation-content {
    background-color: rgba(108, 117, 125, 0.05);
    border-left: 3px solid #6c757d;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0 1rem;
    border-radius: 0 4px 4px 0;
}

/* Suggested fix styling */
.suggested-fix-label {
    font-weight: 600;
    color: #198754;
    display: flex;
    align-items: center;
}

.suggested-fix-label::before {
    content: '\f0c7'; /* Font Awesome save */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 0.5rem;
}

.suggested-fix-container {
    background-color: rgba(25, 135, 84, 0.05);
    border-left: 3px solid #198754;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0 1rem;
    border-radius: 0 4px 4px 0;
    position: relative;
}

/* Copy button styling */
.copy-suggestion-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: #198754;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.copy-suggestion-btn:hover {
    background-color: #146c43;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.copy-suggestion-btn::before {
    content: '\f0c5'; /* Font Awesome copy */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 0.4rem;
}

/* Hide only specific pre-formatted code blocks in suggestion areas */
/* MODIFIED: Removed selectors that were hiding legitimate suggestion text */
/* NOTE: The following selectors were causing the suggested fix text to be hidden */

/* Only hide pre blocks that are not part of the suggestion display structure */
pre.mb-0[style*="white-space: pre-wrap"]:not(.suggestion-text),
.p-2.bg-light.border.rounded pre.mb-0:not(.suggestion-text) {
    display: none !important;
}

/* Ensure suggestion text is always visible */
.text-success,
.suggested-fix-content,
.copy-fix-btn + div {
    display: block !important;
}

/* Target the specific pattern shown in the example */
.suggested-fix-container .p-2.bg-white.border.border-success.rounded,
.p-2.bg-white.border.border-success.rounded {
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Ensure the green suggestion text is properly displayed */
.text-success {
    white-space: pre-wrap;
    margin-bottom: 1rem;
}

/* Make sure the copy button is still visible and properly positioned */
.copy-suggestion-btn,
.copy-suggestion {
    margin-bottom: 0.5rem;
}

/* Additional specific targeting for the example structure */
button.copy-suggestion + div.p-2.bg-white.border.border-success.rounded,
button.copy-suggestion + div.p-2.bg-white.border.border-success.rounded pre {
    display: none !important;
}
.pointer-none {
    pointer-events: none !important;
}
