/* static/style.css */

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Playfair+Display:wght@400;700&display=swap');

/* NOTE: All CSS variables are now defined in static/css/core/variables.css */
/* This file contains only Swagger UI specific styles and global overrides */

/* --- Base Styles & Global Overrides --- */
html {
    background-color: var(--bg-primary) !important;
    height: 100%;
}

body {
    background-color: var(--bg-primary) !important;
    color: var(--text-color) !important;
    font-family: 'Lato', sans-serif; /* Lato for body/text */
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100%; /* Allow body to grow with content */
    display: flex;
    flex-direction: column;
}

/* Global Content Container for responsive width */
.content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px; /* Horizontal padding for content inside wrapper */
    width: 100%; /* Ensure it takes full width up to max-width */
    box-sizing: border-box; /* Include padding in element's total width */
}

/* Section padding for regular pages to avoid header overlap */
.section-padding {
    padding-top: 40px; /* Remove header compensation since main handles it */
    padding-bottom: 40px;
}

/* Hide default Swagger UI top bar completely */
.swagger-ui .topbar {
    display: none !important;
}
/* Also hide the default Swagger UI info bar's search/explore elements */
.swagger-ui .filter, /* The filter input */
.swagger-ui .info .url, /* The openapi.json URL */
.swagger-ui .info .title small, /* version num */
.swagger-ui .info .title .version-stamp { /* OAS 3.1 stamp */
    display: none !important;
}
/* Ensure the "Explore" button is also hidden, or re-theme it if it's not part of filter */
.swagger-ui .wrapper .highlight-code.json + div button { /* Targeting the explore button if it's there */
    display: none !important;
}


/* Main Content Wrapper for Swagger UI - ensures it matches header width */
.main-content-wrapper {
    flex-grow: 1; /* Allows content to push footer to bottom */
    padding-top: calc(80px + 15px); /* Header height + spacing */
    padding-bottom: 20px; /* Reduced bottom padding since footer flows naturally */
    background-color: var(--bg-primary) !important;
    width: 100%;
    min-height: calc(100vh - 80px - 140px); /* Viewport - header - estimated footer height */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}
#swagger-ui {
    max-width: 1200px; /* Match header content width */
    margin: 0 auto; /* Center the Swagger UI content */
    padding: 20px 0; /* Vertical padding */
    background-color: var(--bg-primary) !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: background-color 0.3s ease;
}

/* Aggressive Overrides for Swagger UI internal containers to ensure proper background */
#swagger-ui > section,
#swagger-ui > div,
.swagger-ui .swagger-container,
.swagger-ui .wrapper { /* Ensure wrapper takes full height to avoid white bottom bar */
    background-color: var(--bg-primary) !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: background-color 0.3s ease;
}


/* Blanket override for all elements within Swagger UI */
.swagger-ui * {
    color: var(--text-color) !important;
    background-color: transparent !important;
    font-family: 'Lato', sans-serif !important;
}

/* --- Custom Header Styling --- */
.custom-header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    height: 80px;
    min-height: 80px;
    max-height: 80px;
    box-sizing: border-box;
}

.custom-header .header-content-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.auth-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 150px; /* Prevent layout shift during auth check */
    justify-content: flex-end;
}

/* Hide auth elements until auth check completes - prevents CLS */
.auth-btn-hidden {
    display: none !important;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-avatar-initials {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-accent-orange);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.user-menu {
    position: relative;
}

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-medium);
    min-width: 150px;
    z-index: 1000;
    display: none;
}

.user-menu:hover .user-menu-dropdown {
    display: block;
}

.menu-item {
    display: block;
    padding: 10px 15px;
    color: var(--text-color);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.menu-item:hover {
    background-color: var(--bg-primary);
}

/* Custom Logo Styling */
.custom-logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    color: var(--header-text) !important;
    line-height: 1.1;
    text-decoration: none;
}
.custom-logo .logo-main-text {
    font-family: 'Playfair Display', serif !important;
    font-size: 28px !important;
    font-weight: 700 !important;
    color: var(--header-text) !important;
    white-space: nowrap;
    padding-bottom: 5px; /* Added padding */
}
.custom-logo .logo-slogan-text {
    font-family: 'Lato', sans-serif !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    text-transform: uppercase !important;
    color: var(--header-text) !important;
    opacity: 0.8;
    margin-top: -5px;
}

/* Main Navigation Menu */
.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}
.main-nav li {
    margin-left: 25px;
}
.main-nav a {
    color: var(--header-text) !important; /* Header text links usually match header text color */
    text-decoration: none;
    font-family: 'Lato', sans-serif;
    font-size: 16px;
    font-weight: 700;
    transition: color 0.2s ease;
}
.main-nav a:hover {
    color: var(--button-bg) !important; /* Orange accent on hover for header links */
    text-decoration: none;
}


/* Toggle Button Styling */
#theme-toggle {
    background-color: transparent !important;
    color: var(--header-text) !important;
    border: none !important;
    padding: 5px;
    font-size: 24px !important;
    box-shadow: none !important;
    transition: color 0.2s ease;
    cursor: pointer;
    z-index: auto !important;
}
#theme-toggle:hover {
    color: var(--button-bg) !important;
}


/* --- Re-apply specific backgrounds and heading fonts where needed (inside #swagger-ui) --- */

/* Specific font override for the main API title H2 (e.g., "Father's Rights AI" at the top of content) */
.swagger-ui .info .title,
.swagger-ui .info h2.title {
    font-family: 'Playfair Display', serif !important;
    color: var(--text-color) !important;
    background-color: transparent !important;
    margin-top: 0 !important; /* Remove top margin that might push content down */
}
/* Ensure the Swagger UI's description also uses Lato */
.swagger-ui .info .description {
    font-family: 'Lato', sans-serif !important;
    color: var(--text-color) !important;
    background-color: transparent !important;
}


/* Specific font override for the "default" / Tag Section Title H3 */
.swagger-ui .opblock-tag-section h3.opblock-tag {
    font-family: 'Playfair Display', serif !important;
    color: var(--text-color) !important;
    background-color: transparent !important;
}
.swagger-ui .opblock-tag-section h3.opblock-tag span,
.swagger-ui .opblock-tag-section h3.opblock-tag div,
.swagger-ui .opblock-tag-section h3.opblock-tag small {
    font-family: 'Playfair Display', serif !important;
    color: var(--text-color) !important;
    background-color: transparent !important;
}


/* Operation Blocks */
.swagger-ui .opblock {
    background-color: var(--bg-primary) !important;
    border-radius: 8px;
    box-shadow: 0 2px 6px var(--shadow-light);
    margin-bottom: 15px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
}

/* Operation Method Tag (e.g. GET, POST) */
.swagger-ui .opblock-summary-method {
    background-color: #2ecc71 !important; /* Fixed color */
    color: white !important;
    border-radius: 4px;
    padding: 4px 8px;
    font-weight: bold;
    text-transform: uppercase;
}
.swagger-ui .opblock-post .opblock-summary-method { background-color: #3498db !important; }
.swagger-ui .opblock-put .opblock-summary-method { background-color: #f39c12 !important; }
.swagger-ui .opblock-delete .opblock-summary-method { background-color: #e74c3c !important; }

/* Buttons (excluding theme toggle) */
.swagger-ui .btn {
    background-color: var(--button-bg) !important;
    color: var(--header-text) !important; /* Keep text color white for buttons */
    border: none;
    border-radius: 5px;
    padding: 8px 15px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 5px var(--button-shadow);
}
.swagger-ui .btn:hover {
    color: var(--header-text) !important; /* Keep text color for hover */
    background-color: var(--button-hover-bg) !important;
    box-shadow: 0 4px 8px var(--button-hover-shadow);
}
.swagger-ui .btn.cancel {
    background-color: #95a5a6 !important;
}
.swagger-ui .btn.cancel:hover {
    background-color: #7f8c8d !important;
}

/* Input fields (within Swagger UI) */
.swagger-ui input[type=text],
.swagger-ui input[type=password],
.swagger-ui input[type=email],
.swagger-ui input[type=number],
.swagger-ui textarea,
.swagger-ui select {
    border-radius: 5px;
    border: 1px solid var(--input-border);
    padding: 8px;
    box-shadow: inset 0 1px 3px var(--shadow-light);
    background-color: var(--bg-primary) !important;
    color: var(--text-color) !important;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.swagger-ui input[type=text]:focus,
.swagger-ui input[type=password]:focus,
.swagger-ui input[type=email]:focus,
.swagger-ui input[type=number]:focus,
.swagger-ui textarea:focus,
.swagger-ui select:focus {
    border-color: var(--button-bg) !important;
    box-shadow: 0 0 0 2px var(--input-focus-shadow);
    outline: none;
}

/* Code blocks and JSON displays */
.swagger-ui .highlight-code,
.swagger-ui .microlight,
.swagger-ui .renderedMarkdown code,
.swagger-ui .parameters-col_description code {
    background-color: var(--code-bg) !important;
    color: var(--code-text) !important;
    transition: background-color 0.3s ease, color 0.3s ease;
}


/* Styling for the copy buttons on response bodies */
.swagger-ui .copy-to-clipboard {
    border-radius: 5px;
    background-color: var(--bg-secondary) !important;
    color: var(--text-color) !important;
    padding: 5px 8px;
    transition: background-color 0.2s ease;
}
.swagger-ui .copy-to-clipboard:hover {
    background-color: var(--input-border) !important;
}


/* --- Schema Section Specific Overrides (more refined) --- */

/* The main container for each schema definition */
.swagger-ui .models .json-schema-2020-12 {
    background-color: var(--bg-primary) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px var(--shadow-light);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* The specific clickable title bar / head of each schema */
.swagger-ui .models .json-schema-2020-12-head {
    background-color: var(--bg-secondary) !important;
    color: var(--text-color) !important;
    border-radius: 5px;
    padding: 10px 15px;
    margin: -15px -15px 10px -15px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: inset 0 1px 3px var(--shadow-light);
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

/* The specific title text inside the JSON schema head if it's still an issue */
.swagger-ui .models .json-schema-2020-12-head .json-schema-2020-12__title {
    color: var(--text-color) !important;
    background-color: transparent !important;
    font-family: 'Playfair Display', serif !important;
    font-weight: 700 !important;
    font-size: 16px !important;
}


/* For the 'Expand all' link next to the title */
.swagger-ui .models .json-schema-2020-12-head .json-schema-2020-12-head__expand {
    color: var(--button-bg) !important;
    background-color: transparent !important;
}

/* Ensuring the 'object' text also switches */
.swagger-ui .models .json-schema-2020-12-head .json-schema-2020-12__description {
    color: var(--text-color-light) !important;
    background-color: transparent !important;
}

/* Content of the expanded schema (properties, etc.) */
.swagger-ui .parameters-col_description .model,
.swagger-ui .property-row {
    background-color: var(--bg-primary) !important;
    color: var(--text-color) !important;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.swagger-ui .property.primitive {
    color: var(--text-color-light) !important;
}

/* Ensure borders within expanded schema are themed */
.swagger-ui .model-box-control .parameters-col_description .property-row {
    border-bottom: 1px dashed var(--border-color);
}
.swagger-ui .model-box-control .parameters-col_description .property-row:last-of-type {
    border-bottom: none;
}


/* --- Custom Footer Styling --- */
.custom-footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 20px 0;
    flex: none; /* Ensures footer doesn't grow or shrink in flex layout */
    position: relative !important; /* Ensure footer flows naturally after main content */
    width: 100%;
    transition: background-color 0.3s ease, color 0.3s ease;
    /* Removed margin-top: auto since main is now flex and will push footer down */
}

.custom-footer .footer-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.custom-footer .footer-logo { /* Re-use custom-logo styles for consistency */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    color: var(--footer-text) !important;
    line-height: 1.1;
}
.custom-footer .footer-logo .logo-main-text {
    font-family: 'Playfair Display', serif !important;
    font-size: 24px !important; /* Slightly smaller than header logo */
    font-weight: 700 !important;
    color: var(--footer-text) !important;
}
.custom-footer .footer-logo .logo-slogan-text {
    font-family: 'Lato', sans-serif !important;
    font-size: 12px !important;
    font-weight: 400 !important;
    text-transform: uppercase !important;
    color: var(--footer-text) !important;
    opacity: 0.8;
    margin-top: -5px;
}

.footer-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}
.footer-nav li {
    margin-left: 20px;
}
.footer-nav a {
    color: var(--footer-text) !important; /* Footer links usually match footer text color */
    text-decoration: none;
    font-family: 'Lato', sans-serif;
    font-size: 14px;
    font-weight: 700;
    transition: color 0.2s ease;
}
.footer-nav a:hover {
    color: var(--button-bg) !important; /* Orange accent on hover for footer links */
}

.custom-footer .footer-bottom-row {
    text-align: center;
}
.custom-footer .copyright-text {
    font-family: 'Lato', sans-serif;
    font-size: 12px;
    color: var(--footer-copyright-text) !important; /* Themed copyright text color */
    margin: 0;
}


/* --- Global Link Styling --- */
/* This applies to all general <a> tags that are not specifically styled by other rules
   (like navigation links, or Swagger UI specific links) */
a {
    color: var(--link-color); /* Uses the themed link color variable */
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

a:hover {
    color: var(--link-hover-color); /* Uses the themed link hover color variable */
    text-decoration: underline;
}

/* --- Resources Page Toggle Styling (Refined for Consistency) --- */

.province-details {
    background-color: var(--bg-primary); /* Matches main content/Swagger block background */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
    overflow: hidden; /* Important for animation of content */
}

.province-details[open] {
    box-shadow: var(--shadow-medium);
}

.province-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    cursor: pointer;
    background-color: var(--bg-secondary); /* Matches Swagger UI internal headers/schema titles */
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px; /* Apply to top corners */
    user-select: none; /* Prevent text selection on click */
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.5em; /* Keep it prominent */
    color: var(--text-color); /* Default text color from theme */
    transition: background-color 0.2s ease;
    box-shadow: inset 0 1px 3px var(--shadow-light); /* Added subtle inner shadow like Swagger headers */
}

.province-details[open] .province-summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    background-color: var(--bg-secondary); /* Keep it this background when open */
    color: var(--brand-accent-orange); /* Highlight summary text when open */
    box-shadow: var(--shadow-medium); /* Emphasize when open */
}

.province-summary:hover {
    background-color: var(--bg-primary); /* Subtle change on hover to match main content bg */
}
body.dark-mode .province-summary:hover {
    background-color: var(--bg-primary); /* Dark mode hover bg-primary */
}

/* Specific override for province summary header text color in dark mode */
body.dark-mode .province-summary {
    color: #F9C08D; /* User requested light color for toggle header text in dark mode */
}

/* Keep consistent when open in dark mode */
body.dark-mode .province-details[open] .province-summary {
    color: #F9C08D;
}


.province-summary h3 {
    margin: 0;
    font-size: 1em; /* Adjust to fit summary line relative to parent font size */
    color: inherit; /* Inherit color from summary */
}

.toggle-icon {
    font-size: 0.8em;
    transition: transform 0.2s ease;
}

.province-details[open] .toggle-icon {
    transform: rotate(180deg);
}

.province-content {
    padding: 20px 25px;
    /* border-top: 1px solid var(--border-color); Removed, as summary has bottom border */
    background-color: var(--bg-primary); /* Explicitly set content background */
    border-radius: 0 0 8px 8px; /* Apply border-radius to bottom corners when open */
}

.province-content .resource-list {
    list-style: none; /* Remove default bullets */
    padding: 0;
    margin-top: 15px;
}

.province-content .resource-list li {
    margin-bottom: 15px;
    padding-left: 0; /* Ensure no default list padding */
}

.province-content .resource-list li a {
    font-weight: bold;
    font-size: 1.1em;
    color: var(--link-color);
    text-decoration: none;
}

.province-content .resource-list li a:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

.province-content .resource-list li p {
    font-size: 0.9em;
    color: var(--text-color-light);
    margin-top: 5px;
    margin-bottom: 0; /* Remove bottom margin for descriptions */
}


/* ============================================
   MOBILE NAVIGATION
   ============================================ */

/* Hamburger Menu Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: relative;
    margin-left: var(--spacing-md);
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background-color: var(--header-text);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Hamburger Animation - Active State */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Navigation */
.mobile-nav {
    background-color: var(--header-bg);
    max-width: 320px;
    width: 85%;
    height: 100%;
    margin-left: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding: var(--spacing-xl) var(--spacing-lg);
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
}

.mobile-menu-overlay.active .mobile-nav {
    transform: translateX(0);
}

.mobile-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav li {
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-nav li:last-child {
    border-bottom: none;
}

.mobile-nav a {
    display: block;
    padding: var(--spacing-md) 0;
    color: var(--header-text);
    text-decoration: none;
    font-family: 'Lato', sans-serif;
    font-size: 18px;
    font-weight: 600;
    transition: color 0.2s ease, padding-left 0.2s ease;
}

.mobile-nav a:hover,
.mobile-nav a.active {
    color: var(--button-bg);
    padding-left: 10px;
}

/* Mobile Auth Actions */
.mobile-auth-actions {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-xl);
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.mobile-login-btn,
.mobile-signup-btn {
    width: 100%;
    text-align: center;
    padding: 12px 20px;
    display: inline-block;
    border-radius: var(--radius-md);
}

.mobile-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: var(--spacing-md) 0;
    color: var(--header-text);
    background: transparent;
    border: none;
    font-family: 'Lato', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, padding-left 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-item:hover {
    color: var(--button-bg);
    padding-left: 10px;
}

.mobile-logout-btn {
    margin-top: var(--spacing-sm);
    color: #ef4444;
    border-bottom: none;
}

.mobile-logout-btn:hover {
    color: #dc2626;
}

/* Mobile Theme Toggle in Menu */
.mobile-theme-toggle-wrapper {
    padding-top: var(--spacing-lg);
    margin-top: var(--spacing-lg);
    border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.mobile-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--spacing-md) 0;
    background: transparent;
    border: none;
    color: var(--header-text);
    font-family: 'Lato', sans-serif;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, padding-left 0.2s ease;
}

.mobile-theme-toggle:hover {
    color: var(--button-bg);
    padding-left: 10px;
}

.mobile-theme-toggle .theme-icon {
    font-size: 24px;
    margin-right: var(--spacing-md);
}

.mobile-theme-toggle .theme-label {
    flex: 1;
    text-align: left;
}

/* Desktop Theme Toggle */
.desktop-theme-toggle {
    display: block;
}

/* Prevent body scroll when mobile menu is open */
body.mobile-menu-open {
    overflow: hidden;
}


/* --- Responsive Styles (Media Queries) --- */

/* Tablet and below (max-width 767px) - Mobile Navigation */
@media (max-width: 767px) {
    /* Show mobile menu toggle, hide desktop nav */
    .mobile-menu-toggle {
        display: flex;
    }
    
    .desktop-nav {
        display: none !important;
    }
    
    .mobile-menu-overlay {
        display: block;
    }
    
    /* Header adjustments for mobile */
    .header-content-wrapper {
        justify-content: space-between;
    }
    
    .custom-header .logo-main-text {
        font-size: 24px !important;
    }
    
    .custom-header .logo-slogan-text {
        font-size: 12px !important;
    }
    
    .header-actions {
        gap: 0;
        display: flex;
        align-items: center;
    }
    
    /* Hide desktop auth buttons on mobile, they're in the mobile menu */
    .auth-actions {
        display: none !important;
    }
    
    /* Hide desktop theme toggle on mobile */
    .desktop-theme-toggle {
        display: none !important;
    }
    
    /* Show mobile theme toggle */
    .mobile-theme-toggle-wrapper {
        display: block;
    }
    
    /* Footer adjustments */
    .custom-footer .footer-top-row {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-lg);
    }
    
    .custom-footer .footer-logo {
        align-items: center;
        margin-bottom: 0;
    }
    
    .footer-nav ul {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-sm);
    }
    
    .footer-nav li {
        margin: 0;
        width: 100%;
    }
    
    .footer-nav a {
        display: block;
        padding: var(--spacing-sm) 0;
    }
    
    .footer-bottom-row {
        text-align: center;
    }
    
    /* Reduce section padding on mobile to match side margins */
    .section-padding {
        padding-top: 20px;
        padding-bottom: 20px;
        margin-top: 0;
    }
    
    /* Reduce heading margins on mobile */
    .section-padding h1 {
        margin-top: 0;
        margin-bottom: 10px;
        font-size: 1.8em;
    }
    
    .section-padding h2 {
        margin-top: 0;
        margin-bottom: 8px;
    }
}

/* Tablet (768px to 991px) - Keep desktop nav but adjust sizing */
@media (min-width: 768px) and (max-width: 991px) {
    .content-container {
        padding: 0 20px;
    }

    .custom-header .logo-main-text {
        font-size: 24px !important;
    }
    
    .custom-header .logo-slogan-text {
        font-size: 12px !important;
    }
    
    .main-nav li {
        margin-left: 15px;
    }
    
    .main-nav a {
        font-size: 14px;
    }
    
    .desktop-theme-toggle {
        font-size: 20px !important;
    }
    
    /* Hide mobile elements on tablet/desktop */
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .mobile-theme-toggle-wrapper {
        display: none;
    }
}

/* Desktop (992px+) - Hide mobile elements */
@media (min-width: 992px) {
    .mobile-theme-toggle-wrapper {
        display: none;
    }
}

/* Mobile (e.g., max-width 480px) */
@media (max-width: 480px) {
    .content-container {
        padding: 0 10px; /* Further reduce horizontal padding */
    }

    /* Header adjustments */
    .custom-header .logo-main-text {
        font-size: 22px !important;
    }
    .custom-header .logo-slogan-text {
        font-size: 11px !important;
    }
    .main-nav ul {
        flex-wrap: wrap; /* Allow menu items to wrap */
        justify-content: flex-end; /* Align menu items to right if wrapped */
    }
    .main-nav li {
        margin-left: 10px;
        margin-bottom: 5px; /* Add some vertical space if wrapped */
    }
    .main-nav a {
        font-size: 12px;
    }
    #theme-toggle {
        font-size: 18px !important; /* Even smaller icon */
        margin-left: 5px; /* Less margin */
    }

    /* Adjust main content padding for smaller screens */
    .main-content-wrapper {
        padding-top: 80px; /* Keep consistent with header height */
        padding-bottom: 30px;
    }
    #swagger-ui {
        padding: 10px 0;
    }

    /* Footer adjustments */
    .custom-footer .footer-top-row {
        padding-bottom: 10px;
        margin-bottom: 10px;
    }
    .footer-nav li {
        margin: 0 5px;
    }
    .custom-footer .copyright-text {
        font-size: 10px;
    }
}

/* === AI ASSISTANT PAGE STYLES === */


/* === AI ASSISTANT PAGE STYLES === */


/** Layout Reset **/
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

/* Site navigation header only - not semantic <header> elements in content */
.custom-header {
    height: 80px;
    min-height: 80px;
    max-height: 80px;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
}

.ai-page-layout {
    height: calc(100vh - 110px);
    max-height: calc(100vh - 110px);
    margin-top: 15px;
    display: flex;
    flex-direction: row;
    box-sizing: border-box;
    padding: 15px;
    gap: 15px;
    border-radius: 16px;
    background: var(--bg-secondary);
    margin: 0 auto;
    width: calc(100% - 30px);
    max-width: 1600px;
    overflow: hidden;
    align-items: stretch;
}

.sidebar {
    width: 320px;
    min-width: 240px;
    max-width: 340px;
    background: var(--bg-secondary);
    border-radius: 16px 0 0 16px;
    box-shadow: var(--shadow-medium);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    flex-shrink: 0;
}

.chat-main {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: 0 16px 16px 0;
    box-shadow: var(--shadow-medium);
    overflow: hidden;
    height: 100%;
    padding: 0;
    min-height: 0;
}

.chat-messages {
    flex: 1 1 0;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 0;
    background: transparent;
    width: 100%;
    box-sizing: border-box;
}

/* Message & Button Styles */
.message { 
    display: flex; 
    gap: 10px; 
    align-items: flex-start; 
}
.message.user { 
    justify-content: flex-end; 
}
.message-bubble { 
    max-width: 75%; 
    padding: 12px 18px; 
    border-radius: 20px; 
    line-height: 1.5; 
    word-wrap: break-word; 
}
.message.user .message-bubble { 
    background-color: var(--brand-primary-dark); 
    color: var(--brand-white); 
    border-bottom-right-radius: 5px; 
}
.message.assistant .message-bubble { 
    background-color: var(--bg-primary); 
    color: var(--text-color); 
    border: 1px solid var(--border-color); 
    border-bottom-left-radius: 5px; 
}

.message-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    margin: 0 0 0 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    overflow: visible;
}
.message.user .message-avatar {
    background: #1a2b4d;
    color: #fff;
    margin: 0 0 0 8px;
    margin-left: 0;
    margin-right: 8px;
}

/* Sidebar Styles */
.sidebar-section {
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}
.sidebar-section:first-child {
    padding-top: 0;
    border-top: none;
}
.sidebar-item, .document-item {
    padding: 8px 10px;
    cursor: pointer;
    color: var(--text-color);
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-item:hover, .document-item:hover {
    background-color: rgba(235, 129, 50, 0.1);
}
.sidebar-item.active {
    background-color: var(--brand-primary-dark);
    color: var(--brand-white);
}

/* Button Styles */
.btn-primary {
    background: var(--brand-accent-orange);
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(232,119,46,0.08);
}
.btn-primary:hover:not(:disabled) {
    background: var(--brand-accent-orange-light);
    color: #fff;
}
.btn-primary:disabled {
    background: #e3e3e3;
    color: #aaa;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Chat Input Styles */
.chat-input-area { 
    display: flex; 
    align-items: center; 
    padding: 15px 20px; 
    border-top: 1px solid var(--border-color); 
    gap: 10px; 
    background-color: var(--bg-secondary); 
    flex-shrink: 0; 
}
.chat-input { 
    flex-grow: 1; 
    padding: 12px 15px; 
    border: 1px solid var(--input-border); 
    border-radius: 25px; 
    font-size: 1em; 
    background-color: var(--bg-primary); 
    color: var(--text-color); 
    transition: border-color 0.2s ease; 
    font-family: inherit; 
    resize: none; 
    overflow-y: hidden; 
    line-height: 1.5; 
    max-height: 150px; 
}
.chat-input:focus { 
    outline: none; 
    border-color: var(--brand-accent-orange); 
    box-shadow: 0 0 0 2px var(--input-focus-shadow); 
}

/* Loading States */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    font-size: 1.1em;
    color: var(--text-color-light);
    text-align: center;
    flex-direction: column;
}
.loading-indicator i {
    font-size: 1.5em;
    color: var(--brand-accent-orange);
    animation: spin 2s linear infinite; 
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-page-layout { 
        flex-direction: column; 
        padding: 10px; 
        gap: 15px; 
        height: auto; 
    }
    .sidebar { 
        width: 100%; 
        height: auto; 
        max-height: none; 
        order: 1; 
    }
    .chat-main { 
        width: 100%; 
        min-height: 400px; 
        order: 2; 
    }
}
