/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@500&family=Inter:wght@400;500;700&display=swap');

:root {
    --accent-color: #00BFFF; /* Deep Sky Blue */
    --card-bg: #2c3034;
    --body-bg: #212529;
    --border-color: #444;
    --text-muted: #adb5bd;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--body-bg);
}

/* Navbar with accent border */
.navbar {
    background-color: rgba(33, 37, 41, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.navbar-brand {
    font-family: 'Fira Code', monospace;
    font-weight: 500;
    color: var(--accent-color) !important;
}

/* Blog Post Card Styling */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    border-radius: 0.75rem; /* Slightly more rounded */
    overflow: hidden; /* Ensures image corners are rounded */
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: 0 8px 25px rgba(0, 191, 255, 0.15);
}

.card-title a {
    text-decoration: none;
    color: #fff;
    font-weight: 700;
}

.card-title a:hover {
    color: var(--accent-color);
}

.card-img-top {
    height: 200px;
    object-fit: cover;
}

.post-tag {
    display: inline-block;
    background-color: rgba(0, 191, 255, 0.1);
    color: var(--accent-color);
    padding: 0.25rem 0.75rem;
    border-radius: 50rem;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    font-weight: 500;
    border: 1px solid rgba(0, 191, 255, 0.2);
}

/* Sidebar Styling */
.sidebar-widget {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 0.75rem;
}

.sidebar-title {
    font-family: 'Fira Code', monospace;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #fff;
}

.topic-link {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: color 0.2s ease;
}

.topic-link:last-child {
    border-bottom: none;
}

.topic-link:hover {
    color: var(--accent-color);
}

.form-control-dark {
    background-color: #343a40;
    border-color: var(--border-color);
}

.form-control-dark:focus {
     background-color: #343a40;
     border-color: var(--accent-color);
     box-shadow: 0 0 0 0.25rem rgba(0, 191, 255, 0.25);
}

.footer {
    background-color: #1a1d20;
    border-top: 1px solid var(--border-color);
}

/* === Post Content Styling === */

.post-content h2, .post-content h3, .post-content h4 {
    font-family: 'Fira Code', monospace;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
}

.post-content p, .post-content li {
    line-height: 1.8;
    color: #ced4da; /* Lighter gray for better readability */
}

.post-content a {
    color: var(--accent-color);
    text-decoration: underline;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* Blockquote Styling */
.post-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1rem;
    margin-left: 0;
    font-style: italic;
    color: var(--text-muted);
}

/* Code Block Styling */
.post-content pre {
    background-color: #1a1d20; /* Slightly different from card bg */
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 0.9rem;
    overflow-x: auto; /* For horizontal scrolling on long lines */
}

.post-content pre code {
    background: none;
    padding: 0;
    color: #e9ecef;
    font-family: 'Fira Code', monospace;
}

/* Copy Button for Code Blocks */
.btn-copy {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    opacity: 0.3;
    transition: opacity 0.2s ease-in-out;
}

pre:hover .btn-copy {
    opacity: 1;
}

/* === Focused Post Page Layout Additions === */

.post-header .post-meta {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
}

.post-header .post-title {
    line-height: 1.2;
}

.post-banner img.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0,0,0,.5) !important;
}

.post-body {
    font-size: 1.1rem; /* Slightly larger for easier reading */
    color: #e9ecef; /* Lighter text color */
}


.post-body p, .post-body li {
    line-height: 1.9;
}

/* === Images Inside Post Content === */

.post-body img {
    /* These !important rules will override inline width/height attributes */
    width: 100% !important;
    max-width: 100% !important; 
    
    height: auto !important; /* Maintains the aspect ratio */
    border-radius: 0.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--border-color);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.3);
}


/* === Make Post Card Clickable === */

.card {
    /* This is REQUIRED for the stretched-link to work */
    position: relative; 
}

/* Style the link inside the card title */
.card .card-title a.stretched-link {
    color: #fff;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

/* Ensure the title text still turns the accent color on hover */
.card:hover .card-title a.stretched-link {
    color: var(--accent-color);
}

/* The stretched-link utility creates a pseudo-element to cover the card.
   This makes sure it's invisible but functional. */
.stretched-link::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    content: "";
}

/* Search Results Styling */
#results-container .list-group-item {
    border-color: var(--border-color);
}
#results-container .list-group-item a {
    text-decoration: none;
    font-weight: 500;
}
#results-container .list-group-item a:hover {
    color: var(--accent-color) !important;
}