/* Utilimarc Brand Colors */
:root {
    --utilimarc-sky-blue: #7AA2C4;
    --utilimarc-turquoise: #40C4C2;
    --utilimarc-cobalt-blue: #0154F6;
    --utilimarc-navy-blue: #00416B;
    --utilimarc-midnight-blue: #001A30;
    --utilimarc-dark-grey: #616161;
    --utilimarc-grey: #8D8D8D;
}

/* Base styling */
body {
    font-family: 'Manrope', sans-serif;
    background-color: #f5f8fa; /* Light blue/gray background to match design */
    color: #333333;
}

/* Force visibility for critical text elements */
body, p, span, div, h1, h2, h3, h4, h5, h6, 
.card-body, .form-label,
input, select, textarea {
    color: #000000;
}

/* Preserve white text for buttons with dark backgrounds */
.btn-primary, .btn-secondary, .btn-success, 
.btn-danger, .btn-warning, .btn-info, 
.btn-dark, .badge.bg-secondary {
    color: #ffffff !important;
}

/* Restore proper styling for muted text */
.text-muted {
    color: #6c757d !important;
}

/* Main content container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Card styling for the main container */
.rounded-4 {
    border-radius: 1rem !important;
}

/* Custom placeholder text */
::placeholder {
    color: #adb5bd;
    opacity: 1;
}

/* Focus styles for form elements */
.form-control:focus, .form-select:focus {
    border-color: #d1d9e6;
    box-shadow: 0 0 0 0.25rem rgba(1, 84, 246, 0.15);
}

/* Button hover effects */
.btn {
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Policy content styling for structured markdown */
.policy-markdown, .policy-content {
    line-height: 1.6;
    font-size: 1rem;
    color: #000000;
    padding: 0 1rem;
}

/* Title styling */
.policy-markdown h1, .policy-content h1 {
    font-size: 2rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
    color: #000000;
    text-align: center;
}

/* Main sections (## in markdown) */
.policy-markdown h2,
.policy-markdown .policy-main-header,
.policy-content h2 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #000000;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

/* All subsections (### and deeper in markdown) - simplified to same style but with different indentation */
.policy-markdown h3,
.policy-markdown .policy-section-header,
.policy-content h3,
.policy-markdown h4,
.policy-markdown .policy-subsection-header,
.policy-content h4,
.policy-markdown h5,
.policy-markdown .policy-deep-header,
.policy-content h5 {
    font-size: 1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #000000;
}

/* Individual indentation by level */
.policy-markdown h3,
.policy-markdown .policy-section-header,
.policy-content h3 {
    padding-left: 1rem;
}

.policy-markdown h4,
.policy-markdown .policy-subsection-header,
.policy-content h4 {
    padding-left: 2rem;
}

.policy-markdown h5,
.policy-markdown .policy-deep-header,
.policy-content h5 {
    padding-left: 3rem;
}

/* Lists styling */
.policy-markdown ul, 
.policy-markdown ol,
.policy-content ul,
.policy-content ol {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.policy-markdown li,
.policy-content li {
    margin-bottom: 0.5rem;
}

/* Section numbers highlighting */
.policy-markdown .section-number,
.policy-content .section-number {
    font-weight: 600;
    color: #000000;
    display: inline-block;
    min-width: 2rem;
}

/* Improved styling for markdown hierarchical content */
.policy-content .policy-numbered-item {
    font-weight: normal;
    position: relative;
    margin-bottom: 0.75rem;
    clear: both;
}

/* Styles for specific header classes - simplified to two main font sizes */
.policy-content .policy-h1,
.policy-content h1 {
    font-size: 2rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
    color: #000000;
    text-align: center;
}

.policy-content .policy-h2,
.policy-content h2 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #000000;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

/* Removed duplicate styles - this is now unified with the styles above */

/* Improved list handling */
.policy-content .policy-list,
.policy-content ul,
.policy-content ol {
    margin: 0.75rem 0;
    padding-left: 2.5rem;
}

.policy-content .policy-item,
.policy-content li {
    margin-bottom: 0.5rem;
    display: list-item;
}

/* Styling for numbered paragraphs, preserve their structure but use consistent fonts */
.policy-content .section-level-1 {
    position: relative;
    margin-left: 0;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 1.5rem; /* Larger font for main sections (like "3. Definitions") */
    font-weight: 600;
    display: block;
    clear: both;
    text-indent: 0;
}

.policy-content .section-level-2,
.policy-content .section-level-3 {
    position: relative;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 1rem; /* Smaller uniform font for all subsections */
    font-weight: normal;
    display: block;
    clear: both;
}

/* Specific indentation for level 2 - synchronized with header indentation */
.policy-content .section-level-2 {
    margin-left: 1rem;
    text-indent: 0;
    padding-left: 0;
}

/* Specific indentation for level 3 - synchronized with header indentation */
.policy-content .section-level-3 {
    margin-left: 2rem;
    text-indent: 0;
    padding-left: 0;
}

/* Don't allow the AI content to break the layout */
.policy-content {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

/* Hierarchical indentation for content based on header level - synchronized with other section indentation */
.policy-markdown h2 + p,
.policy-markdown .policy-main-header + p,
.policy-content h2 + p {
    padding-left: 0.5rem;
}

.policy-markdown h3 + p,
.policy-markdown .policy-section-header + p,
.policy-content h3 + p {
    padding-left: 1rem;
}

.policy-markdown h4 + p,
.policy-markdown .policy-subsection-header + p,
.policy-content h4 + p {
    padding-left: 2rem;
}

.policy-markdown h5 + p,
.policy-markdown .policy-deep-header + p,
.policy-content h5 + p {
    padding-left: 3rem;
}

/* Company name highlighting */
.policy-markdown .company-highlight,
.policy-content .company-highlight {
    background-color: #fff9c4;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 500;
}

/* Standard paragraph styling */
.policy-markdown p,
.policy-content p {
    margin-bottom: 1rem;
    color: #000000;
}

/* Horizontal rule styling */
.policy-markdown hr,
.policy-content hr {
    margin: 1.5rem 0;
    border-top: 2px solid #000000;
    opacity: 0.2;
}

/* Blockquotes for notices */
.policy-markdown blockquote,
.policy-content blockquote {
    background-color: #f5f7fa;
    border-left: 4px solid #000000;
    padding: 1rem;
    margin: 1rem 0;
    color: #000000;
    font-style: italic;
}

/* Extra spacing for policy sections */
.policy-markdown h2::after,
.policy-markdown .policy-main-header::after,
.policy-content h2::after {
    content: "";
    display: block;
    margin-top: 0.5rem;
}

/* Loading animation */
.spinner-border {
    width: 3rem;
    height: 3rem;
    color: #0066ff;
}

#loading-container {
    color: inherit;
}

#loading-container p {
    color: #333333;
    font-weight: 400;
}

/* Form styling */
.form-label {
    font-weight: 600;
    color: var(--utilimarc-midnight-blue);
}

/* Dropdown placeholder styling */
.form-select option[disabled] {
    color: var(--utilimarc-dark-grey);
}

.form-control, .form-select, input[type="email"] {
    border: 1px solid #e0e0e0;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    background-color: #ffffff;
    color: #495057;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    height: auto;
    min-height: 45px;
}

.form-control:focus, .form-select:focus, input[type="email"]:focus {
    border-color: var(--utilimarc-cobalt-blue);
    box-shadow: 0 0 0 0.15rem rgba(1, 84, 246, 0.15);
    background-color: #ffffff;
    color: #212529;
    outline: none;
}

.form-floating label {
    color: var(--utilimarc-dark-grey);
}

/* Button styling */
.btn {
    border-radius: 4px !important; /* Force squared corners on all buttons */
}

/* Override Bootstrap's button styles */
.btn, 
.btn-primary, 
.btn-secondary, 
.btn-outline-primary, 
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-danger {
    border-radius: 4px !important; /* Force all buttons to have squared corners */
}
.btn-primary {
    background-color: #0066ff;
    border-color: #0066ff;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #0055cc; /* Slightly darker shade of blue */
    border-color: #0055cc;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 102, 255, 0.3);
}

/* Simplified Generate Policy button */
#generate-button {
    background-color: #0066ff;
    border-color: #0066ff;
    font-size: 1rem;
    border-radius: 4px; /* Squared-off button */
    padding: 0.75rem 2rem;
    margin-top: 1.5rem; /* Extra margin before button */
}

.btn-secondary {
    background-color: var(--utilimarc-dark-grey);
    border-color: var(--utilimarc-dark-grey);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
}

.btn-secondary:hover, .btn-secondary:focus {
    background-color: var(--utilimarc-grey);
    border-color: var(--utilimarc-grey);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(97, 97, 97, 0.3);
}

.btn-outline-primary {
    color: #0066ff;
    border-color: #0066ff;
}

.btn-outline-primary:hover, .btn-outline-primary:focus {
    background-color: #0066ff;
    color: white;
}

/* Rating buttons styling */
.btn-outline-success {
    color: #20aa8a;
    border-color: #20aa8a;
    font-weight: 500;
}

.btn-outline-success:hover,
.btn-success {
    background-color: #20aa8a;
    border-color: #20aa8a;
    color: white;
}

.btn-outline-danger {
    color: #d9534f;
    border-color: #d9534f;
    font-weight: 500;
}

.btn-outline-danger:hover,
.btn-danger {
    background-color: #d9534f;
    border-color: #d9534f;
    color: white;
}

/* Card styling with paper-like effect */
.card {
    border: 1px solid #eaeaea;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-body {
    padding: 1.5rem;
    background-color: #ffffff;
}

.card-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #eaeaea;
    color: #6c757d;
    font-size: 0.875rem;
    padding: 0.75rem 1.5rem;
}

/* Make the footer stick to bottom */
html, body {
    height: 100%;
}

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

.container {
    flex: 1 0 auto;
}

.footer {
    flex-shrink: 0;
}

/* Logo styling */
.navbar-brand img {
    height: 40px;
    width: auto;
    margin-right: 10px;
}

/* Home page heading */
.home-heading {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--utilimarc-midnight-blue);
}

.home-subheading {
    font-size: 1.25rem;
    color: var(--utilimarc-dark-grey);
    margin-bottom: 2.5rem;
}

/* Simplified form styling */

/* Make the editor textarea more comfortable */
#feedback-text {
    resize: vertical;
    min-height: 120px;
    max-height: 300px;
    border: 1px solid #e0e0e0;
    background-color: #f5f5f5;
    color: #000000;
}

#feedback-text:focus {
    border-color: var(--utilimarc-grey);
    box-shadow: 0 0 0 0.25rem rgba(141, 141, 141, 0.25);
    background-color: #f5f5f5;
    color: #000000;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .card-header h2 {
        margin-bottom: 0.75rem;
    }
    
    .btn-group {
        margin-top: 0.75rem;
    }
}

/* Badge styling */
.badge {
    font-weight: 600;
    padding: 0.5em 0.75em;
    border-radius: 6px;
}

.badge.bg-secondary {
    background-color: var(--utilimarc-sky-blue) !important;
    color: white;
}

/* Error container styling */
.alert-danger {
    background-color: #ffeded;
    border-color: #ffdbdb;
    color: #e53935;
}

/* Code blocks in policies */
.policy-markdown pre, 
.policy-markdown code,
.policy-content pre,
.policy-content code {
    background-color: #f5f5f5;
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-size: 0.875em;
    color: #000000;
}

.policy-markdown pre,
.policy-content pre {
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Disclaimer text */
.policy-markdown p:last-of-type,
.policy-content p:last-of-type {
    color: initial; /* Reset to default color */
    font-size: initial; /* Reset to default size */
    font-style: normal; /* Reset to normal style */
    border-top: none; /* Reset border */
    padding-top: 0; /* Reset padding */
    margin-top: 0; /* Reset margin */
}

/* Target only the disclaimer text in square brackets */
.policy-markdown p:last-of-type:has-text("[DISCLAIMER:"),
.policy-content p:last-of-type:has-text("[DISCLAIMER:") {
    color: #888888;
    font-size: 0.9em;
    border-top: 1px solid #e0e0e0;
    padding-top: 1rem;
    margin-top: 2rem;
    font-style: italic;
}

/* Suggestion chips styling */
.suggestion-chip {
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    font-weight: 500;
    color: #000000 !important;
    border-radius: 4px !important;
}

.suggestion-chip:hover {
    background-color: #e0e6f0;
    color: #000000 !important;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* FAQ Page Styling */
.faq-item {
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.faq-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.faq-item h4 {
    color: var(--utilimarc-navy-blue);
    position: relative;
}

.faq-item h4 strong {
    color: var(--utilimarc-cobalt-blue);
}

.faq-item p {
    color: #333;
    line-height: 1.6;
}

.faq-item ul {
    padding-left: 1.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.faq-item ul li {
    margin-bottom: 0.25rem;
    color: #333;
}

.faq-item strong {
    font-weight: 600;
}
