
/* === GLOBAL DESIGN SYSTEM TOKENS === */
:root {
    /* Colors */
    --color-primary: #1A56DB;        /* Electric blue — CTA buttons, links, accents */
    --color-primary-dark: #1043B5;   /* Hover state */
    --color-surface: #FFFFFF;        /* Card backgrounds */
    --color-bg: #F9FAFB;             /* Page background */
    --color-text: #111827;           /* Primary text */
    --color-text-muted: #4B5563;     /* Dates, captions, secondary */
    --color-border: #E5E7EB;         /* Card borders, dividers */
    --color-footer-bg: #0B0F1A;      /* Deep dark footer */

    /* Category Colors */
    --cat-ai: #8B5CF6;               /* Purple — AI Tools */
    --cat-seo: #059669;              /* Emerald — SEO */
    --cat-tech: #2563EB;             /* Blue — Tech Guides */
    --cat-tools: #D97706;            /* Amber — Free Tools */
    --cat-finance: #0891B2;          /* Cyan — Personal Finance */

    /* Typography */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Spacing Scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 48px;
    --space-2xl: 64px;

    /* Component Tokens */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-pill: 9999px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --header-height: 72px;
}

/* Base Styles */
body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .serif {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-text);
}

a {
    color: var(--color-primary);
    transition: all 0.2s ease;
    text-decoration: none;
}

a:hover {
    color: var(--color-primary-dark);
    text-decoration: none;
}

/* Header Redesign (Glassmorphism) */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: var(--header-height);
    display: flex;
    align-items: center;
}

@media (max-width: 991px) {
    .header {
        height: auto;
        padding: 10px 0;
    }
    .navbar-collapse {
        background: white;
        margin-top: 15px;
        padding: 20px;
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-lg);
        max-height: 80vh;
        overflow-y: auto;
    }
    .nav-link {
        padding: 12px 0 !important;
        border-bottom: 1px solid var(--color-border);
        width: 100%;
        text-align: left;
    }
    .navbar-nav {
        width: 100%;
        align-items: flex-start !important;
    }
    .btn-subscribe {
        margin-top: 10px;
        width: 100%;
        display: block;
    }
    .nav-item:last-child .nav-link {
        border-bottom: none;
    }
    .dropdown-menu {
        border: none !important;
        box-shadow: none !important;
        padding-left: 15px !important;
        background: var(--color-bg) !important;
        margin-top: 0 !important;
    }
}

/* Hover Dropdowns for Desktop */
@media (min-width: 992px) {
    .nav-item.dropdown:hover > .dropdown-menu {
        display: block;
        margin-top: 0;
        opacity: 1;
        visibility: visible;
        animation: fadeInDown 0.2s ease-out;
    }
    
    .dropdown-toggle::after {
        transition: transform 0.2s ease;
    }
    
    .nav-item.dropdown:hover .dropdown-toggle::after {
        transform: rotate(180deg);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.navbar-brand h1 {
    font-size: 22px;
    margin: 0;
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    white-space: nowrap;
}

/* Ensure Logo and Toggler stay on the same line */
.navbar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100%;
}

.navbar-brand {
    margin-right: 0 !important;
    padding-right: 10px;
    flex-shrink: 1;
    overflow: hidden;
}

.navbar-toggler {
    flex-shrink: 0;
    border: none !important;
    padding: 0.5rem !important;
}

.nav-link {
    font-weight: 500;
    font-size: 15px;
    color: var(--color-text) !important;
    padding: 0.5rem 1rem !important;
}

.nav-link:hover {
    color: var(--color-primary) !important;
}

.btn-subscribe {
    background-color: var(--color-primary);
    color: white !important;
    border-radius: var(--radius-pill);
    padding: 10px 24px !important;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(26, 86, 219, 0.2);
}

.btn-subscribe:hover {
    background-color: var(--color-primary-dark) !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(26, 86, 219, 0.3);
}

/* Sidebar Newsletter Card */
.sidebar-newsletter-card {
    background: linear-gradient(135deg, #1A56DB 0%, #1145A3 100%);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    color: white;
    border: none;
    overflow: hidden;
    position: relative;
}

.sidebar-newsletter-card h4 {
    color: white !important;
    font-family: var(--font-display);
}

.sidebar-newsletter-card .form-control {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border-radius: var(--radius-sm);
}

.sidebar-newsletter-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-newsletter-card .btn-light {
    background: white !important;
    color: var(--color-primary) !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none !important;
}

.sidebar-newsletter-card .btn-light:hover {
    background: #f8fafc !important;
    transform: translateY(-1px);
}

/* Category Pills */
.pill {
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: white;
    display: inline-block;
}

.pill-ai { background-color: var(--cat-ai); }
.pill-seo { background-color: var(--cat-seo); }
.pill-tech { background-color: var(--cat-tech); }
.pill-tools { background-color: var(--cat-tools); }
.pill-finance { background-color: var(--cat-finance); }

/* Hero Section */
.hero-card {
    background: white !important;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg) !important;
    transition: transform 0.3s ease;
}

.hero-card:hover {
    transform: scale(1.005);
}

/* Enforce Font Awesome Family */
.fa {
    font-family: 'FontAwesome' !important;
}

/* Button & Link Polish */
.btn-primary, .btn-primary:focus, .btn-primary:active {
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: white !important;
}

.btn-primary:hover {
    background-color: var(--color-primary-dark) !important;
    border-color: var(--color-primary-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 86, 219, 0.3) !important;
}

/* Global bg-primary override to match theme */
.bg-primary {
    background-color: var(--color-primary) !important;
}

.bg-primary, .bg-primary h1, .bg-primary h2, .bg-primary h3, .bg-primary h4, .bg-primary h5, .bg-primary h6, .bg-primary p, .bg-primary span {
    color: #ffffff !important;
}

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

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

.btn-light {
    background-color: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    color: var(--color-primary) !important;
}

.btn-light:hover {
    background-color: #f3f4f6 !important;
    color: var(--color-primary-dark) !important;
}

/* Social Share Icons - Brand Colors */
.social-share-sidebar a.text-muted:hover i.fa-twitter,
.social-share-sidebar a i.fa-twitter { color: #1DA1F2 !important; }
.social-share-sidebar a.text-muted:hover i.fa-facebook,
.social-share-sidebar a i.fa-facebook { color: #4267B2 !important; }
.social-share-sidebar a.text-muted:hover i.fa-linkedin,
.social-share-sidebar a i.fa-linkedin { color: #0077B5 !important; }
.social-share-sidebar button.text-muted:hover i.fa-link,
.social-share-sidebar button i.fa-link { color: var(--color-primary) !important; }

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
}

.toast-msg {
    background: #111827;
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Article Card Hover Refinement */
.article-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--color-border);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    height: 100%;
    position: relative;
}

.article-content h2, 
.article-content h3,
.comments-section {
    scroll-margin-top: 100px;
}

.article-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    border-color: transparent;
}

.article-card-img-wrapper {
    overflow: hidden;
    width: 100%;
    aspect-ratio: 16/10;
}

.article-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

/* Fallback Featured Image Styles */
.img-fallback {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex !important;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16/9;
    width: 100%;
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.img-fallback .fallback-logo {
    width: 40%;
    max-width: 280px;
    height: auto;
    opacity: 0.6;
    filter: grayscale(1);
    transition: all 0.3s ease;
}

.article-card:hover .img-fallback .fallback-logo {
    opacity: 0.9;
    transform: scale(1.05);
    filter: grayscale(0);
}

.article-card-body {
    padding: var(--space-lg);
}

.article-meta {
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 500;
}

/* Tool Cards */
.tool-card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    transition: all 0.3s ease;
}

.tool-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}

/* Footer Improvements */
.footer {
    background-color: var(--color-footer-bg) !important;
    color: #ffffff !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer h1, .footer h2, .footer h3, .footer h4, .footer p, .footer span, .footer li, .footer .small {
    color: #ffffff !important;
}

.footer a.text-reset {
    color: rgba(255, 255, 255, 0.8) !important;
}

.footer a.text-reset:hover {
    color: #ffffff !important;
    text-decoration: underline !important;
}

.footer .social-icons i {
    color: #ffffff !important;
}

/* Newsletter Section Fix */
.newsletter-card h2, .newsletter-card p, .newsletter-card span {
    color: #ffffff !important;
}

/* Article Titles - Professional Charcoal */
.article-card h3 a, .article-card h4 a, .post-title a, #postContainer .article-card h4 a {
    color: #111827 !important;
}

.article-card h3 a:hover, .article-card h4 a:hover, .post-title a:hover {
    color: var(--color-primary) !important;
}

/* Infinite Scroll */
#scrollSentinel {
    margin-top: 2rem;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* === MOBILE RESPONSIVENESS REFINEMENTS === */
@media (max-width: 768px) {
    /* Typography */
    h1, .display-3 { font-size: 32px !important; }
    h2, .display-4 { font-size: 28px !important; }
    h3 { font-size: 24px !important; }
    
    .serif-body { font-size: 1.05rem !important; }

    /* Spacing */
    .section-padding { padding: 40px 0; }
    .container { padding-left: 20px; padding-right: 20px; }
    
    /* Article Specifics */
    .single-article-wrapper { padding-top: 20px !important; }
    .author-row { margin-top: 20px !important; margin-bottom: 30px !important; }
    
    /* Sidebar Fixes */
    .sidebar { margin-top: 50px; }
    .sticky-top { position: relative !important; top: 0 !important; }
    
    /* Form Layouts */
    .comment-form { padding: 25px !important; }
    
    /* Grid Adjustments */
    .row > [class*="col-"] { margin-bottom: 20px; }
}

@media (max-width: 480px) {
    .navbar-brand h1 { font-size: 18px; }
    .btn-subscribe { padding: 8px 16px !important; font-size: 12px; }
    .author-box { padding: 20px !important; }
    .author-avatar { width: 60px; height: 60px; }
}

@media (max-width: 360px) {
    .navbar-brand h1 { font-size: 16px; }
    .navbar { padding-left: 10px; padding-right: 10px; }
}

/* Comment Section Redesign */
.avatar-circle {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #1043B5 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(26, 86, 219, 0.2);
    border: 2px solid white;
}

.comment-card {
    position: relative;
    transition: all 0.2s ease;
}

.comment-card:hover {
    transform: translateX(4px);
    border-color: var(--color-primary) !important;
}

.comment-form .form-control:focus {
    background: white !important;
    box-shadow: 0 0 0 4px rgba(26, 86, 219, 0.1) !important;
    border: 1px solid var(--color-primary) !important;
}

/* === ARTICLE CONTENT STYLING (TABLES & CODE) === */
.article-content table {
    width: 100%;
    margin: 2rem 0;
    border-collapse: collapse;
    border: 1px solid var(--color-border);
    background-color: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.article-content table th {
    background-color: #f8fafc;
    color: var(--color-text);
    font-weight: 700;
    text-align: left;
    padding: 12px 20px;
    border-bottom: 2px solid var(--color-border);
}

.article-content table td {
    padding: 12px 20px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 15px;
}

.article-content table tr:last-child td {
    border-bottom: none;
}

.article-content table tr:nth-child(even) {
    background-color: #fcfdfe;
}

/* Make tables responsive */
@media (max-width: 768px) {
    .article-content table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Code & Commands Styling */
.article-content code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: #d63384; /* Professional magenta for code */
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    word-break: break-word;
}

.article-content pre {
    background-color: #1e1e1e; /* Dark theme for code blocks */
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid #2d2d2d;
    box-shadow: var(--shadow-md);
}

.article-content pre code {
    color: #9cdcfe; /* Light blue for multi-line code */
    background-color: transparent;
    padding: 0;
    border: none;
    font-size: 14px;
    line-height: 1.6;
    display: block;
    word-break: normal;
}

/* Blockquote & Notes Styling */
.article-content blockquote {
    background-color: #f0f7ff; /* Very light blue */
    border-left: 4px solid var(--color-primary);
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-style: italic;
    color: var(--color-text-muted);
    position: relative;
}

.article-content blockquote p {
    margin-bottom: 0;
}

.article-content blockquote::before {
    content: "\f129"; /* FontAwesome info-circle icon */
    font-family: 'FontAwesome';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--color-primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-style: normal;
    border: 2px solid white;
}

/* === TOOL PAGE REFINEMENTS === */
.tool-seo-content {
    margin: 48px 0;
}

.tool-content-wrapper {
    max-width: 860px;
    margin: 0 auto;
}

.tool-seo-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-text);
}

.tool-seo-content p {
    font-size: 16px;
    line-height: 1.8;
    color: var(--color-text-muted);
    margin-bottom: 24px;
    max-width: 760px;
    text-align: left;
}

/* How to Use - Steps */
.tool-steps {
    list-style: none;
    padding: 0;
    max-width: 760px;
}

.tool-steps li {
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: flex-start;
}

.tool-steps li:last-child {
    border-bottom: none;
}

.tool-steps .step-num {
    font-weight: 700;
    color: var(--color-primary);
    margin-right: 12px;
    flex-shrink: 0;
}

/* FAQ Section */
.tool-faq-section {
    max-width: 760px;
}

.tool-faq-item {
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 20px;
    padding-bottom: 20px;
}

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

.tool-faq-item h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text);
}

.tool-faq-item p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--color-text-muted);
    margin-bottom: 0;
}

/* Feature Cards (Word Counter etc.) */
.tool-feature-card {
    padding: 24px !important;
    height: 100%;
}

.tool-feature-card h3 {
    font-size: 16px !important;
    font-weight: 600 !important;
    margin-bottom: 8px !important;
}

.tool-feature-card p {
    font-size: 14px !important;
    line-height: 1.6 !important;
    margin-bottom: 0 !important;
}

/* Related Tools Section */
.related-tools-section {
    margin: 48px 0;
}

.related-tools-section h3 {
    text-align: center;
}

.related-tool-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.related-tool-card .btn {
    width: 100%;
    margin-top: auto;
}

@media (max-width: 768px) {
    .tool-seo-content h2 {
        font-size: 20px;
    }
    
    .tool-seo-content, .related-tools-section {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .tool-content-wrapper {
        max-width: 100%;
    }
}
