/* HomeWiseGuide.com Custom Styles */

/* Custom Properties */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    
    /* Custom brand colors - WCAG AA Compliant */
    --brand-primary: #215E9D;        /* Deep Blue - Trust & Reliability */
    --brand-secondary: #32B087;      /* Calm Green - Growth & Safety */
    --brand-accent: #745CA6;         /* Subtle Purple - Wisdom & Elegance */
    
    /* Mapping custom brand colors to Bootstrap's core variables */
    --bs-primary: #215E9D;
    --bs-primary-rgb: 33, 94, 157;
    --bs-secondary: #32B087;
    --bs-secondary-rgb: 50, 176, 135;
    
    /* Define other necessary BS RGB variables */
    --bs-success-rgb: 25, 135, 84;
    --bs-warning-rgb: 255, 193, 7;
    --bs-info-rgb: 13, 202, 240;
    --bs-danger-rgb: 220, 53, 69;
    --bs-light-rgb: 248, 249, 250;
    --bs-dark-rgb: 33, 37, 41;
    
    /* Define a dark variant for the primary color if needed for gradients */
    --bs-primary-dark: #1A4A7A;
    
    /* Typography */
    --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Spacing */
    --section-padding: 4rem 0;
    --container-padding: 1.5rem;
    
    /* Trust-Building Primary Colors */
    --background-primary: #FFFFFF;    /* Clean White */
    --background-secondary: #E7E9EB;  /* Light Gray for Cards/Panels */
    --text-primary: #222222;         /* Very Dark Gray for High Contrast */
    --text-secondary: #4A5568;       /* Medium Gray for Secondary Text */
    
    /* Interactive Elements */
    --button-primary: #215E9D;       /* Deep Blue for Primary Actions */
    --button-secondary: #32B087;     /* Green for Secondary Actions */
    --link-color: #215E9D;           /* Blue for Links */
    --link-hover: #1A4A7A;          /* Darker Blue for Hover */
    
    /* Shadows and Effects */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    
    /* Border Radius */
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Dark mode variables - Trust-Building Color Scheme */
[data-bs-theme="dark"] {
    /* Trust-Building Primary Colors for Dark Mode */
    --brand-primary: #3A6EA5;        /* Mid-Blue - Trust & Reliability */
    --brand-secondary: #26A69A;      /* Deeper Green - Growth & Safety */
    --brand-accent: #BAA0E2;         /* Muted Purple - Wisdom & Elegance */
    
    /* Background & Text Colors for Dark Mode */
    --background-primary: #121212;    /* Rich Black */
    --background-secondary: #22272A;  /* Dark Gray for Cards/Panels */
    --text-primary: #F2F2F2;         /* Near White for High Contrast */
    --text-secondary: #B0BEC5;       /* Light Gray for Secondary Text */
    
    /* Interactive Elements for Dark Mode */
    --button-primary: #3A6EA5;       /* Mid-Blue for Primary Actions */
    --button-secondary: #26A69A;     /* Green for Secondary Actions */
    --link-color: #3A6EA5;           /* Blue for Links */
    --link-hover: #4A7BB5;           /* Lighter Blue for Hover */
    
    /* Bootstrap Integration for Dark Mode */
    --bs-primary: #3A6EA5;
    --bs-primary-rgb: 58, 110, 165;
    --bs-primary-dark: #2A5A8A;
    --bs-secondary: #26A69A;
    --bs-secondary-rgb: 38, 166, 154;
    --bs-light: #121212;
    --bs-light-rgb: 18, 18, 18;
    --bs-dark: #F2F2F2;
    --bs-dark-rgb: 242, 242, 242;
    
    /* General background and text colors for dark mode, creating depth */
    --light-color: #121212; /* Rich black background for the overall body */
    --dark-color: #F2F2F2; /* Near white text color for dark mode */
}

/* Base Typography */
body {
    font-family: var(--font-family-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-primary);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

/* Hero Section - Trust-Building Blue */
.hero {
    background: var(--brand-primary); /* Trust-building deep blue */
    color: white;
    padding: var(--section-padding);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.2; /* Reduced opacity for better text contrast */
}

.hero .container {
    position: relative;
    z-index: 1;
}

/* Navigation */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--brand-primary);
}

/* Dark mode toggle */
.dark-mode-toggle {
    transition: all 0.3s ease;
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
}

/* Cards - Trust-Building Design */
.card {
    border: none;
    background-color: var(--background-secondary);
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
    border-radius: var(--border-radius-lg);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-title {
    font-weight: 600;
    color: var(--text-primary);
}

/* Buttons - Trust-Building Design */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition-normal);
}

.btn-primary {
    background: var(--button-primary); /* Trust-building blue */
    border: none;
    color: white;
}

.btn-primary:hover {
    background: var(--link-hover); /* Darker blue on hover */
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.4);
}

.btn-secondary {
    background: var(--button-secondary); /* Trust-building green */
    border: none;
    color: white;
}

.btn-secondary:hover {
    /* Use a darker shade of brand-secondary dynamically */
    background: color-mix(in srgb, var(--brand-secondary) 80%, black); /* Mix 80% of secondary with 20% black */
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--bs-secondary-rgb), 0.4);
}

.btn-outline-primary {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.btn-outline-primary:hover {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
}

/* Enhanced Article Styles */
.enhanced-article {
    max-width: min(800px, 90vw);
    margin: 0 auto;
    padding: 2rem 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.article-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary); /* Use the specifically defined secondary text color */
}

.article-category {
    background: var(--brand-primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}

.article-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    color: var(--text-primary); /* Use primary text color */
}

.article-excerpt {
    font-size: clamp(1.125rem, 2.5vw, 1.25rem);
    line-height: 1.6;
    color: var(--text-secondary); /* Use the specifically defined secondary text color */
    margin-bottom: 2rem;
}

.article-author {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bs-light);
    border-radius: 8px;
}

.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 2px solid var(--bs-border-color);
    flex-shrink: 0;
    background-color: var(--bs-light);
    display: block;
    max-width: 100%;
    height: auto;
}

/* Fallback for broken images */
.author-avatar:not([src]), 
.author-avatar[src=""],
.author-avatar[src*="default-author.jpg"] {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
}

.author-avatar[src*="default-author.jpg"]::before {
    content: "👤";
    font-size: 1.5rem;
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-weight: 600;
    color: var(--bs-dark);
}

.author-title {
    font-size: 0.875rem;
    color: var(--bs-secondary);
}

/* Reading Progress */
.reading-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(0,0,0,0.1);
    z-index: 1000;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--bs-primary), var(--bs-secondary));
    width: 0%;
    transition: width 0.3s ease;
}

/* Table of Contents */
.table-of-contents {
    background: var(--bs-light);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
    border-left: 4px solid var(--bs-primary);
}

.toc-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--bs-dark);
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-list a {
    color: var(--bs-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.toc-list a:hover {
    color: var(--bs-primary);
}

/* Related Articles */
.related-articles {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid var(--bs-border-color);
}

.related-articles-header {
    margin-bottom: 2rem;
}

.related-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.related-article-card .card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.related-article-card .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Content Recommendations */
.content-recommendations {
    margin-top: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-secondary) 100%);
    border-radius: 12px;
    color: white;
}

.recommendations-header h3 {
    color: white;
    margin-bottom: 0.5rem;
}

.recommendation-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.recommendation-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

/* Social Sharing */
.social-sharing {
    margin-top: 3rem;
    padding: 2rem;
    background: var(--bs-light);
    border-radius: 8px;
    border: 1px solid var(--bs-border-color);
}

.social-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.social-buttons .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Footer - Trust-Building Design with Proper Legibility */
footer {
    margin-top: auto;
    background-color: var(--background-secondary); /* Light gray in light mode, dark gray in dark mode */
    color: var(--text-primary); /* Ensure overall footer text is primary text color */
    position: relative;
    overflow: hidden;
    padding: 3rem 0 1rem 0;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="footer-grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.03"/></pattern></defs><rect width="100" height="100" fill="url(%23footer-grain)"/></svg>');
    pointer-events: none;
}

/* For dark mode specifically, make the grain even more subtle */
[data-bs-theme="dark"] footer::before {
    opacity: 0.05; /* Reduce opacity for dark mode */
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="footer-grain-dark" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="%233a3a3a" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23footer-grain-dark)"/></svg>');
}

footer .container {
    position: relative;
    z-index: 1;
}

/* Footer headings with proper contrast */
footer h5, footer h6 {
    color: var(--text-primary); /* Will be #222222 (dark) in light mode, #F2F2F2 (light) in dark mode */
    font-weight: 600;
    margin-bottom: 1.5rem;
    position: relative;
}

footer h5::after, footer h6::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 2rem;
    height: 2px;
    background: var(--brand-primary);
    border-radius: 1px;
}

/* Footer paragraph text with proper contrast */
footer p {
    color: var(--text-secondary); /* Will be #4A5568 (medium gray) in light, #B0BEC5 (light gray) in dark */
    line-height: 1.6;
}

/* Footer links with proper contrast and theme adaptation */
footer a {
    color: var(--link-color); /* Trust-building blue for links, adapts to theme */
    text-decoration: none;
    transition: var(--transition-normal);
    position: relative;
    display: inline-block;
}

footer a:hover {
    color: var(--link-hover); /* Darker blue on hover, adapts to theme */
}

footer a::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--brand-primary);
    transition: width 0.3s ease;
}

footer a:hover::before {
    width: 100%;
}

footer ul {
    margin: 0;
    padding: 0;
}

footer ul li {
    margin-bottom: 0.75rem;
    position: relative;
}

footer ul li::before {
    content: '→';
    position: absolute;
    left: -1rem;
    color: var(--brand-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

footer ul li:hover::before {
    opacity: 1;
}

/* Social Media Icons - Trust-Building Design */
footer .social-icons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

footer .social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--background-primary); /* Use primary background for icon circles */
    color: var(--text-primary); /* Use primary text color for icon itself */
    border: 1px solid var(--bs-border-color); /* Ensures border adapts */
    border-radius: 50%;
    transition: var(--transition-normal);
}

/* Ensure hover effect is consistent and visible */
footer .social-icons a:hover {
    background: var(--brand-primary);
    color: white; /* Text color on hover should be white for contrast on brand primary */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.3);
}

/* Newsletter Form - Trust-Building Design */
footer .newsletter-form {
    background: var(--background-primary); /* Consistent background for the form area */
    border: 1px solid var(--bs-border-color); /* Adaptive border */
    border-radius: 8px;
    padding: 1.5rem;
}

footer .newsletter-form .form-control {
    background: var(--background-secondary); /* Input background adapts */
    border: 1px solid var(--bs-border-color); /* Adaptive border */
    color: var(--text-primary); /* Input text color adapts */
    border-radius: 6px;
}

footer .newsletter-form .form-control::placeholder {
    color: var(--text-secondary); /* Placeholder text color adapts */
}

footer .newsletter-form .form-control:focus {
    background: var(--background-secondary);
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

footer .newsletter-form .btn {
    background: var(--brand-primary);
    border: none;
    border-radius: 6px;
    transition: var(--transition-normal);
}

footer .newsletter-form .btn:hover {
    background: var(--link-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.4);
}

/* Bottom Footer - Trust-Building Design */
footer hr {
    border-color: var(--bs-border-color);
    margin: 2rem 0;
}

footer .bottom-footer {
    background: var(--background-primary); /* Use primary background for bottom section */
    margin: 0 -1.5rem -1.5rem -1.5rem;
    padding: 1.5rem;
    border-radius: 0 0 8px 8px;
}

footer .bottom-footer p {
    color: var(--text-secondary); /* Secondary text color */
    margin: 0;
}

footer .bottom-footer a {
    color: var(--link-color); /* Trust-building blue for links */
    font-size: 0.875rem;
}

footer .bottom-footer a:hover {
    color: var(--link-hover); /* Darker blue on hover */
}

/* Responsive Footer */
@media (max-width: 768px) {
    footer {
        text-align: center;
    }
    
    footer h5::after, footer h6::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    footer .social-icons {
        justify-content: center;
    }
    
    footer ul li::before {
        display: none;
    }
    
    footer a:hover {
        transform: none;
    }
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    z-index: 1000;
    background: var(--brand-primary);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
}

/* Consolidated and improved focus styles using :focus-visible */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible,
.page-link:focus-visible,
.list-group-item:focus-visible,
.accordion-button:focus-visible,
.card a:focus-visible,
.card button:focus-visible,
.hover-lift:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero {
        padding: 2rem 0;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .article h1 {
        font-size: 2rem;
    }
    
    .article h2 {
        font-size: 1.5rem;
    }
    
    .article h3 {
        font-size: 1.25rem;
    }
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .dark-mode-toggle {
        display: none !important;
    }
    
    .hero {
        background: none !important;
        color: black !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* Loading states - Consolidated */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--brand-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-secondary);
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Utility classes */
.text-gradient {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
}

/* Form styles */
.form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

.form-control {
    border-radius: 0.5rem;
}

/* Alert styles */
.alert {
    border-radius: 0.5rem;
    border: none;
}

.alert-primary {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--brand-primary);
}

/* Badge styles */
.badge {
    border-radius: 0.375rem;
    font-weight: 500;
}

/* Progress bar */
.progress {
    border-radius: 0.5rem;
    height: 0.5rem;
}

.progress-bar {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
}

/* Tooltip */
.tooltip {
    font-size: 0.875rem;
}

/* Popover */
.popover {
    border-radius: 0.5rem;
    border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* Modal */
.modal-content {
    border-radius: 0.75rem;
    border: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.modal-footer {
    border-top: 1px solid rgba(0,0,0,0.1);
}

/* Dropdown */
.dropdown-menu {
    border-radius: 0.5rem;
    border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.dropdown-item {
    border-radius: 0.25rem;
    margin: 0.125rem 0.5rem;
    padding: 0.5rem 0.75rem;
}

.dropdown-item:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--brand-primary);
}

/* Pagination */
.page-link {
    border-radius: 0.375rem;
    margin: 0 0.125rem;
    border: none;
    color: var(--dark-color);
}

.page-link:hover {
    background-color: var(--brand-primary);
    color: white;
}

.page-item.active .page-link {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

/* Breadcrumb */
.breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: var(--secondary-color);
}

/* Table */
.table {
    border-radius: 0.5rem;
    overflow: hidden;
}

.table thead th {
    background-color: var(--light-color);
    border-bottom: 2px solid var(--brand-primary);
    font-weight: 600;
}

/* List group */
.list-group-item {
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    border: 1px solid rgba(0,0,0,0.1);
}

.list-group-item:first-child {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

.list-group-item:last-child {
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

/* Spinner */
.spinner-border {
    color: var(--brand-primary);
}

/* Toast */
.toast {
    border-radius: 0.5rem;
    border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* Offcanvas */
.offcanvas {
    border-radius: 0.5rem 0 0 0.5rem;
}

/* Accordion */
.accordion-item {
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(0,0,0,0.1);
}

.accordion-button {
    border-radius: 0.5rem;
    font-weight: 600;
}

.accordion-button:not(.collapsed) {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--brand-primary);
}

/* Carousel */
.carousel {
    border-radius: 0.75rem;
    overflow: hidden;
}

.carousel-item {
    border-radius: 0.75rem;
}

/* Figure */
.figure {
    border-radius: 0.5rem;
    overflow: hidden;
}

.figure-caption {
    color: var(--secondary-color);
    font-size: 0.875rem;
}

/* Code blocks */
code {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--brand-primary);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

pre {
    background-color: var(--light-color);
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
}

pre code {
    background: none;
    color: inherit;
    padding: 0;
}

/* Enhanced hover effects for category hub pages */
.hover-lift {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Progress bar animations */
.progress-bar {
    transition: width 0.6s ease;
}

/* Feature icon styling */
.feature-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Enhanced card styling */
.card {
    border-radius: 12px;
    overflow: hidden;
}

.card-header {
    border-bottom: none;
    padding: 1.5rem;
}

/* Hero section enhancements */
.hero {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-primary-dark) 100%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-stats {
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

/* Breadcrumb enhancements */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 2rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: var(--bs-primary);
    font-weight: bold;
}

/* Form enhancements */
.form-select:focus,
.form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Alert enhancements */
.alert {
    border-radius: 8px;
    border: none;
}

.alert-success {
    background-color: rgba(var(--bs-success-rgb), 0.1);
    color: var(--bs-success);
}

.alert-warning {
    background-color: rgba(var(--bs-warning-rgb), 0.1);
    color: var(--bs-warning);
}

.alert-info {
    background-color: rgba(var(--bs-info-rgb), 0.1);
    color: var(--bs-info);
}

/* Badge enhancements */
.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
}

/* Button enhancements */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.btn-outline-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.3);
}

/* Responsive improvements */
@media (max-width: 768px) {
    .hero-stats {
        margin-top: 2rem;
    }
    
    .display-4 {
        font-size: 2.5rem;
    }
    
    .hero .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .feature-icon {
        width: 50px;
        height: 50px;
    }
}

/* Dark mode enhancements */
[data-bs-theme="dark"] .hero {
    background: var(--bs-primary); /* Solid color instead of gradient for better contrast */
}

[data-bs-theme="dark"] .card {
    background-color: var(--background-secondary); /* Dark gray for cards in dark mode */
    border-color: rgba(255,255,255,0.08); /* Subtle light border for dark cards */
    box-shadow: 0 2px 8px rgba(0,0,0,0.2), 0 4px 16px rgba(0,0,0,0.1); /* Adjusted shadows for dark mode */
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: var(--background-secondary); /* Use the consistent secondary background */
    border-color: var(--bs-border-color); /* Bootstrap's variable for border color */
    color: var(--text-primary); /* Primary text color for inputs */
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: var(--text-secondary); /* Consistent secondary text color for placeholders */
}

/* Ensure body adapts to the new dark mode background */
[data-bs-theme="dark"] body {
    background-color: var(--light-color); /* The new deeper dark background */
    color: var(--dark-color); /* Light text on dark background */
}

/* Other elements that should adopt dark backgrounds and light text */
[data-bs-theme="dark"] .table-of-contents,
[data-bs-theme="dark"] .social-sharing,
[data-bs-theme="dark"] .article-author,
[data-bs-theme="dark"] .alert {
    background: var(--background-secondary); /* Consistent secondary background for these blocks */
    border-color: var(--bs-border-color); /* Adaptive border color */
}

/* Ensure text within cards and other main content areas is light in dark mode */
[data-bs-theme="dark"] .card-title,
[data-bs-theme="dark"] .card-text,
[data-bs-theme="dark"] .article-title,
[data-bs-theme="dark"] .author-name,
[data-bs-theme="dark"] .toc-title {
    color: var(--dark-color); /* Uses the new --dark-color (#e0e0e0) for text */
}

/* Animation keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .hover-lift,
    .btn,
    .progress-bar {
        transition: none;
    }
    
    .hover-lift:hover {
        transform: none;
    }
    
    .btn-outline-primary:hover {
        transform: none;
    }
}

/* Focus indicators */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .hero,
    .card,
    .btn,
    .progress {
        break-inside: avoid;
    }
    
    .hover-lift:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* Enhanced Article Print Styles */
    .reading-progress-container,
    .social-sharing,
    .content-recommendations {
        display: none !important;
    }
    
    .enhanced-article {
        max-width: none;
        padding: 0;
    }
    
    .article-header {
        border-bottom: 1px solid #000;
    }
}

/* Enhanced Article Mobile Responsive */
@media (max-width: 768px) {
    .enhanced-article {
        padding: 1rem 0;
    }
    
    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .related-articles-grid {
        grid-template-columns: 1fr;
    }
    
    .social-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .social-buttons .btn {
        justify-content: center;
    }
    
    .article-author {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .author-avatar {
        width: 40px;
        height: 40px;
    }
    
    .recommendations-grid {
        grid-template-columns: 1fr;
    }
    
    .table-of-contents {
        margin: 1rem 0;
        padding: 1rem;
    }
}

/* Dark Mode Support for Enhanced Articles */
[data-bs-theme="dark"] .enhanced-article {
    color: var(--bs-light);
}

[data-bs-theme="dark"] .article-title {
    color: var(--bs-light);
}

[data-bs-theme="dark"] .article-excerpt {
    color: var(--bs-secondary);
}

[data-bs-theme="dark"] .article-author {
    background: var(--bs-dark);
    border: 1px solid var(--bs-border-color);
}

[data-bs-theme="dark"] .author-name {
    color: var(--bs-light);
}

[data-bs-theme="dark"] .table-of-contents {
    background: var(--bs-dark);
    border-color: var(--bs-primary);
}

[data-bs-theme="dark"] .toc-title {
    color: var(--bs-light);
}

[data-bs-theme="dark"] .toc-list a {
    color: var(--bs-secondary);
}

[data-bs-theme="dark"] .toc-list a:hover {
    color: var(--bs-primary);
}

[data-bs-theme="dark"] .social-sharing {
    background: var(--bs-dark);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .content-recommendations {
    background: var(--bs-primary); /* Solid color instead of gradient for better contrast */
}

[data-bs-theme="dark"] .reading-progress-container {
    background: rgba(255,255,255,0.1);
}

/* Animation Enhancements */
.enhanced-article .card {
    transition: all 0.3s ease;
}

.enhanced-article .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

[data-bs-theme="dark"] .enhanced-article .card:hover {
    box-shadow: 0 4px 15px rgba(255,255,255,0.1);
}

/* Focus styles for accessibility */
.enhanced-article .btn:focus,
.enhanced-article .card:focus-within {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Cost Calculator Styles */
.cost-calculator {
    background: var(--background-secondary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
}

.cost-calculator:hover {
    box-shadow: var(--shadow-lg);
}

.cost-calculator .card-header {
    background: var(--brand-primary);
    color: white;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    border: none;
}

.cost-calculator .form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.cost-calculator .form-select,
.cost-calculator .form-control {
    border: 2px solid var(--background-secondary);
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
}

.cost-calculator .form-select:focus,
.cost-calculator .form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
    outline: none;
}

.cost-calculator .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
}

.cost-calculator .form-check-label {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-left: 0.5rem;
}

.cost-calculator .btn-primary {
    background: var(--brand-primary);
    border: none;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    transition: var(--transition-normal);
}

.cost-calculator .btn-primary:hover {
    background: var(--bs-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.cost-calculator .btn-primary:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Estimate Result Styles */
.estimate-result {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: white;
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease-out;
}

.estimate-result .alert-heading {
    color: white;
    font-weight: 700;
    margin-bottom: 1rem;
}

.estimate-result .display-5 {
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 1rem;
}

.estimate-result .lead {
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

.estimate-result .btn-outline-primary {
    border-color: white;
    color: white;
    font-weight: 600;
    transition: var(--transition-normal);
}

.estimate-result .btn-outline-primary:hover {
    background: white;
    color: var(--brand-primary);
    transform: translateY(-1px);
}

/* Error Message Styles */
.error-message {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    animation: fadeInUp 0.4s ease-out;
}

.error-message .alert-heading {
    color: white;
    font-weight: 600;
}

/* Loading State */
.cost-calculator .btn-primary:disabled {
    background: var(--secondary-color);
    transform: none;
    box-shadow: none;
}

.cost-calculator .btn-primary:disabled .spinner-border {
    width: 1rem;
    height: 1rem;
}

/* Responsive Design for Calculator */
@media (max-width: 768px) {
    .cost-calculator .form-select,
    .cost-calculator .form-control {
        font-size: 1rem;
        padding: 0.625rem 0.875rem;
    }
    
    .cost-calculator .btn-primary {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }
    
    .estimate-result .display-5 {
        font-size: 2rem;
    }
    
    .cost-calculator .form-check-label {
        font-size: 1rem;
    }
}

/* Dark Mode Support for Calculator */
[data-bs-theme="dark"] .cost-calculator {
    background: var(--background-secondary);
}

[data-bs-theme="dark"] .cost-calculator .form-select,
[data-bs-theme="dark"] .cost-calculator .form-control {
    background: var(--background-primary);
    color: var(--text-primary);
    border-color: var(--background-secondary);
}

[data-bs-theme="dark"] .cost-calculator .form-select:focus,
[data-bs-theme="dark"] .cost-calculator .form-control:focus {
    background: var(--background-primary);
    border-color: var(--brand-primary);
}

[data-bs-theme="dark"] .cost-calculator .form-check-label {
    color: var(--text-primary);
}

/* Animation for form elements */
.cost-calculator .form-select,
.cost-calculator .form-control,
.cost-calculator .form-check-input {
    transition: all var(--transition-fast);
}

.cost-calculator .form-select:hover,
.cost-calculator .form-control:hover {
    border-color: var(--brand-secondary);
}

/* Accessibility improvements */
.cost-calculator .form-select:focus-visible,
.cost-calculator .form-control:focus-visible,
.cost-calculator .btn:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cost-calculator .form-select,
    .cost-calculator .form-control {
        border-width: 3px;
    }
    
    .cost-calculator .btn-primary {
        border: 3px solid var(--brand-primary);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .cost-calculator .btn-primary:hover {
        transform: none;
    }
    
    .estimate-result {
        animation: none;
    }
    
    .error-message {
        animation: none;
    }
} 