/* Make the HTML and body take up full viewport height */
html, body {
    height: 100%;
    margin: 0;
}

body {
    background-color: #f8f9fa;
    /* Create a flex container with column direction */
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Important for pushing footer down */
}

/* Main content should grow to push footer down */
.main-content {
    flex: 1 0 auto; /* flex-grow: 1, flex-shrink: 0, flex-basis: auto */
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Fix for rows inside the main content */
.main-content > .row {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}

/* Footer should be at the auto margin-top from main-content's flex:1 */
footer {
    flex-shrink: 0; /* Prevent footer from shrinking */
    width: 100%;
}

body {
    background-color: #f8f9fa;
}

/* Article content styles */
.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content h1, 
.article-content h2, 
.article-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #0d6efd;
    font-weight: 600;
}

.article-content h1 {
    font-size: 1.8rem;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.article-content h2 {
    font-size: 1.5rem;
}

.article-content h3 {
    font-size: 1.3rem;
}

.article-content ul, 
.article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.card {
    border-radius: 0.5rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
}

.card-header {
    border-bottom: none;
}

.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
    border-color: #86b7fe;
}

/* Loading indicator styles */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
    backdrop-filter: blur(5px);
}

.spinner-container {
    background-color: white;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    max-width: 90%;
    width: 350px;
}

.spinner-text {
    color: white;
    font-size: 1.2rem;
    margin-top: 1.5rem;
    max-width: 80%;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    margin: 1.5rem 0 0.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background-color: #0d6efd;
    animation: progress-animation 2s infinite;
}

@keyframes progress-animation {
    0% { width: 10%; }
    50% { width: 70%; }
    100% { width: 10%; }
}

/* Code formatting styles */
.article-content pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.article-content code {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9em;
    color: #212529;
    background-color: rgba(0, 0, 0, 0.03);
    padding: 0.2em 0.4em;
    border-radius: 0.2em;
}

.article-content pre code {
    display: block;
    padding: 0;
    color: inherit;
    background-color: transparent;
    white-space: pre;
    font-size: 0.85em;
    line-height: 1.5;
}

/* Language-specific syntax highlighting */
.codehilite .hll { background-color: #ffffcc }
.codehilite .c { color: #408080; font-style: italic } /* Comment */
.codehilite .k { color: #008000; font-weight: bold } /* Keyword */
.codehilite .o { color: #666666 } /* Operator */
.codehilite .cm { color: #408080; font-style: italic } /* Comment.Multiline */
.codehilite .cp { color: #BC7A00 } /* Comment.Preproc */
.codehilite .c1 { color: #408080; font-style: italic } /* Comment.Single */
.codehilite .cs { color: #408080; font-style: italic } /* Comment.Special */
.codehilite .gd { color: #A00000 } /* Generic.Deleted */
.codehilite .ge { font-style: italic } /* Generic.Emph */
.codehilite .gr { color: #FF0000 } /* Generic.Error */
.codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.codehilite .gi { color: #00A000 } /* Generic.Inserted */
.codehilite .go { color: #808080 } /* Generic.Output */
.codehilite .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
.codehilite .gs { font-weight: bold } /* Generic.Strong */
.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.codehilite .gt { color: #0040D0 } /* Generic.Traceback */
.codehilite .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
.codehilite .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
.codehilite .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
.codehilite .kp { color: #008000 } /* Keyword.Pseudo */
.codehilite .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
.codehilite .kt { color: #B00040 } /* Keyword.Type */
.codehilite .m { color: #666666 } /* Literal.Number */
.codehilite .s { color: #BA2121 } /* Literal.String */
.codehilite .na { color: #7D9029 } /* Name.Attribute */
.codehilite .nb { color: #008000 } /* Name.Builtin */
.codehilite .nc { color: #0000FF; font-weight: bold } /* Name.Class */
.codehilite .no { color: #880000 } /* Name.Constant */
.codehilite .nd { color: #AA22FF } /* Name.Decorator */
.codehilite .ni { color: #999999; font-weight: bold } /* Name.Entity */
.codehilite .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
.codehilite .nf { color: #0000FF } /* Name.Function */
.codehilite .nl { color: #A0A000 } /* Name.Label */
.codehilite .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
.codehilite .nt { color: #008000; font-weight: bold } /* Name.Tag */
.codehilite .nv { color: #19177C } /* Name.Variable */
.codehilite .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
.codehilite .w { color: #bbbbbb } /* Text.Whitespace */
.codehilite .mf { color: #666666 } /* Literal.Number.Float */
.codehilite .mh { color: #666666 } /* Literal.Number.Hex */
.codehilite .mi { color: #666666 } /* Literal.Number.Integer */
.codehilite .mo { color: #666666 } /* Literal.Number.Oct */
.codehilite .sb { color: #BA2121 } /* Literal.String.Backtick */
.codehilite .sc { color: #BA2121 } /* Literal.String.Char */
.codehilite .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
.codehilite .s2 { color: #BA2121 } /* Literal.String.Double */
.codehilite .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
.codehilite .sh { color: #BA2121 } /* Literal.String.Heredoc */
.codehilite .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
.codehilite .sx { color: #008000 } /* Literal.String.Other */
.codehilite .sr { color: #BB6688 } /* Literal.String.Regex */
.codehilite .s1 { color: #BA2121 } /* Literal.String.Single */
.codehilite .ss { color: #19177C } /* Literal.String.Symbol */
.codehilite .bp { color: #008000 } /* Name.Builtin.Pseudo */
.codehilite .vc { color: #19177C } /* Name.Variable.Class */
.codehilite .vg { color: #19177C } /* Name.Variable.Global */
.codehilite .vi { color: #19177C } /* Name.Variable.Instance */
.codehilite .il { color: #666666 } /* Literal.Number.Integer.Long */

/* Advanced article sidebar styles */
.sidebar-sticky {
    position: sticky;
    top: 20px;
    z-index: 1000;
}

/* Advanced article sidebar styles */
.sidebar-sticky {
    top: 20px;
    z-index: 1000;
}

/* Word count display styles */
#word-count-display {
    font-size: 0.9rem;
    color: #6c757d;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    background-color: #f8f9fa;
    display: inline-block;
}

/* Print styles */
@media print {
    nav, footer, .btn, .breadcrumb {
        display: none !important;
    }
    
    body {
        background-color: white !important;
    }
    
    .card {
        box-shadow: none !important;
        border: none !important;
    }
    
    .card-header {
        background-color: white !important;
        color: black !important;
    }
    
    .article-content {
        font-size: 12pt;
    }
}
