/* Premium Blog CSS - Nika Appliance Repair */
/* Modern, responsive blog design with animations */
/* PERFORMANCE OPTIMIZED: Reduced reflows, GPU acceleration */

:root {
    --primary-color: #2196f3;
    --secondary-color: #03a9f4;
    --accent-color: #00bcd4;
    --dark-color: #1a202c;
    --text-color: #333;
    --light-bg: #f9f9f9;
    --white: #fff;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
}

/* PERFORMANCE: Font optimization with font-display */
@font-face {
    font-family: 'Fredoka';
    font-display: swap; /* Prevents FOIT (Flash of Invisible Text) */
}

@font-face {
    font-family: 'Rubik';
    font-display: swap; /* Prevents FOIT (Flash of Invisible Text) */
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.8;
    color: var(--text-color);
    background: var(--light-bg);
}

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    z-index: 9999;
}

.reading-progress::after {
    content: '';
    display: block;
    height: 100%;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color), var(--accent-color));
    width: 0%;
    transition: width 0.1s ease;
    /* PERFORMANCE: GPU acceleration */
    will-change: width;
    transform: translateZ(0);
}

/* Blog Wrapper */
.blog-wrapper {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 3rem;
}

@media (max-width: 1024px) {
    .blog-wrapper {
        grid-template-columns: 1fr;
        margin: 1rem auto;
        gap: 2rem;
    }
}

@media (max-width: 480px) {
    .blog-wrapper {
        margin: 0.5rem auto;
        padding: 0 1rem;
    }
}

/* Main Content */
.blog-main {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 3rem;
}

@media (max-width: 768px) {
    .blog-main {
        padding: 1.5rem;
        border-radius: 0;
    }
}

@media (max-width: 480px) {
    .blog-main {
        padding: 1rem;
    }
}

/* Blog Header */
.blog-header {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e0e0e0;
}

.blog-meta-top {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.blog-category {
    color: var(--primary-color);
    font-weight: 600;
}

.reading-time {
    color: #666;
}

.blog-title {
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1.2;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.blog-meta {
    display: flex;
    gap: 1.5rem;
    color: #666;
    font-size: 0.95rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Social Share */
.social-share {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.share-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--white);
    transition: transform 0.2s;
}

.share-btn:hover {
    transform: translateY(-2px);
}

.share-btn.facebook { background: #1877f2; }
.share-btn.twitter { background: #1da1f2; }
.share-btn.linkedin { background: #0077b5; }
.share-btn.email { background: #666; }

@media (max-width: 480px) {
    .social-share {
        gap: 0.75rem;
        justify-content: center;
    }
}

/* Blog Content */
.blog-content {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    line-height: 1.8;
}

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

@media (max-width: 480px) {
    .blog-content p {
        margin-bottom: 1.25rem;
    }
}

.blog-content h2 {
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--primary-color);
    margin: 2.5rem 0 1.5rem;
    padding-left: 1rem;
    border-left: 4px solid var(--primary-color);
    scroll-margin-top: 80px;
}

.blog-content h3 {
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    color: var(--primary-color);
    margin: 2rem 0 1rem;
}

.blog-content ul, .blog-content ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.blog-content li {
    margin-bottom: 0.75rem;
}

.blog-content strong {
    color: var(--dark-color);
    font-weight: 600;
}

/* Info Boxes */
.tip-box, .info-box, .warning-box {
    padding: 1.5rem;
    border-radius: var(--radius);
    margin: 2rem 0;
    border-left: 4px solid;
}

.tip-box {
    background: #e3f2fd;
    border-color: var(--primary-color);
}

.info-box {
    background: #e8f5e9;
    border-color: #4caf50;
}

.warning-box {
    background: #fff3e0;
    border-color: #ff9800;
}

@media (max-width: 480px) {
    .tip-box, .info-box, .warning-box {
        padding: 1rem;
        margin: 1.5rem 0;
        border-left-width: 3px;
    }
}

/* CTA Box */
.cta-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius);
    text-align: center;
    margin: 3rem 0;
    position: relative;
    overflow: hidden;
}

.cta-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 30%, rgba(255,255,255,0.1) 70%, transparent 70%);
    background-size: 20px 20px;
    animation: movePattern 20s linear infinite;
}

@keyframes movePattern {
    from { background-position: 0 0; }
    to { background-position: 40px 40px; }
}

.cta-box h3 {
    color: var(--white);
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.cta-box p {
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.cta-box .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--white);
    color: #667eea;
    padding: 1rem 2rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s;
    position: relative;
    z-index: 1;
    min-height: 44px;
    justify-content: center;
}

.cta-box .btn:hover {
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .cta-box {
        padding: 2rem 1.5rem;
    }

    .cta-box h3 {
        font-size: 1.25rem;
    }

    .cta-box .btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .cta-box {
        padding: 1.5rem 1rem;
    }

    .cta-box h3 {
        font-size: 1.125rem;
    }
}

/* Comparison Grid */
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

@media (max-width: 640px) {
    .comparison-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin: 1.5rem 0;
    }
}

.comparison-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    border: 2px solid #e0e0e0;
    transition: transform 0.2s;
}

.comparison-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.comparison-card.safe {
    border-color: #4caf50;
    background: linear-gradient(to bottom, #f1f8f1 0%, var(--white) 100%);
}

.comparison-card.danger {
    border-color: #f44336;
    background: linear-gradient(to bottom, #fff5f5 0%, var(--white) 100%);
}

.comparison-card h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.comparison-card ul {
    list-style: none;
    padding: 0;
}

.comparison-card li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.comparison-card li:last-child {
    border-bottom: none;
}

.card-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid #e0e0e0;
    font-weight: 600;
    color: var(--primary-color);
}

/* Tables */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 2rem 0;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 500px;
}

thead {
    background: var(--primary-color);
    color: var(--white);
}

th, td {
    padding: 1rem;
    text-align: left;
}

tbody tr:nth-child(even) {
    background: #f9f9f9;
}

tbody tr:hover {
    background: #f0f0f0;
}

@media (max-width: 768px) {
    .table-wrapper {
        margin: 1.5rem 0;
    }

    th, td {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    table {
        min-width: 600px;
    }
}

@media (max-width: 480px) {
    th, td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
}

/* Sidebar */
.blog-sidebar {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

@media (max-width: 1024px) {
    .blog-sidebar {
        position: static;
        top: 0;
    }
}

.toc-widget, .related-widget {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.toc-widget h3, .related-widget h3 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

@media (max-width: 768px) {
    .toc-widget, .related-widget {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .toc-widget, .related-widget {
        padding: 1rem;
        border-radius: 0;
    }
}

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

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

.toc-list a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s;
    display: block;
    padding: 0.5rem;
    border-radius: 4px;
}

.toc-list a:hover,
.toc-list a.active {
    color: var(--primary-color);
    background: #f0f0f0;
}

.toc-list a.active {
    font-weight: 600;
    border-left: 3px solid var(--primary-color);
    padding-left: calc(0.5rem - 3px);
}

.related-post {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.related-post:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.related-post a {
    color: var(--dark-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.related-post a:hover {
    color: var(--primary-color);
}

.related-post-meta {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .blog-wrapper {
        padding: 0 1rem;
    }

    .blog-meta-top, .blog-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .blog-header {
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
    }

    .blog-content h2 {
        margin: 2rem 0 1rem;
        scroll-margin-top: 100px;
    }

    .blog-content h3 {
        margin: 1.5rem 0 0.75rem;
    }

    .blog-content ul, .blog-content ol {
        padding-left: 1.5rem;
        margin: 1.25rem 0;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .blog-content h2 {
        padding-left: 0.75rem;
        border-left-width: 3px;
    }

    .blog-content ul, .blog-content ol {
        padding-left: 1.25rem;
    }

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

/* Fix for very small screens */
@media (max-width: 360px) {
    .blog-wrapper {
        padding: 0 0.75rem;
    }

    .blog-main {
        padding: 0.75rem;
    }

    .blog-title {
        font-size: 1.5rem;
    }
}

/* Footer Responsive Styles */
@media (max-width: 768px) {
    .footer-trust-badges {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }

    .trust-badge-item {
        justify-content: center;
        text-align: center;
        flex-direction: column;
    }

    .badge-icon {
        font-size: 2.5rem;
    }

    .footer-main-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .footer-column {
        text-align: center;
    }

    .footer-links {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .footer-cta-button {
        width: 100%;
        max-width: 300px;
        justify-content: center;
        min-height: 44px;
    }

    .contact-item {
        justify-content: center;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .footer-trust-badges {
        gap: 1rem;
    }

    .badge-icon {
        font-size: 2rem;
    }

    .badge-text strong {
        font-size: 0.9rem;
    }

    .badge-text span {
        font-size: 0.8rem;
    }

    .footer-heading {
        font-size: 1rem;
    }

    .footer-links a {
        font-size: 0.875rem;
    }

    .footer-cta-button {
        padding: 0.875rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Prevent horizontal overflow */
* {
    max-width: 100%;
}

img {
    height: auto;
}

/* Ensure no element creates horizontal scroll */
body {
    overflow-x: hidden;
}

.blog-wrapper,
.blog-main,
.blog-content {
    overflow-x: hidden;
}

/* PERFORMANCE: CLS Prevention - Reserve space for images */
img {
    max-width: 100%;
    height: auto;
    /* Prevent CLS by reserving space */
    aspect-ratio: attr(width) / attr(height);
}

/* PERFORMANCE: Contain layout shifts */
.blog-sidebar {
    content-visibility: auto; /* Optimize off-screen rendering */
}

/* PERFORMANCE: Reduce paint complexity */
.share-btn,
.footer-cta-button,
.cta-box .btn {
    /* Use GPU-accelerated transforms instead of top/margin animations */
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* PERFORMANCE: Optimize animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Feature Image Section */
.blog-feature-image {
    width: 100%;
    margin: 2rem 0 3rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.blog-feature-image picture {
    display: block;
    width: 100%;
}

.blog-feature-image img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: cover;
}

/* Responsive feature image */
@media (max-width: 768px) {
    .blog-feature-image {
        margin: 1.5rem 0 2rem;
        border-radius: 8px;
    }
}

/* Author Box Styles */
.author-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    padding: 2.5rem;
    border-radius: 12px;
    margin: 3rem 0;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

/* Force all text in author box to be white */
.author-box h3,
.author-box h4,
.author-box h5,
.author-box h6,
.author-box p,
.author-box span,
.author-box a,
.author-box i {
    color: white !important;
}

.author-image {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white !important;
}

.author-image i {
    color: white !important;
}

.author-content h3 {
    color: white !important;
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.author-title {
    color: rgba(255, 255, 255, 0.95) !important;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem !important;
}

.author-bio {
    color: rgba(255, 255, 255, 0.95) !important;
    line-height: 1.8;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.author-credentials {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.author-credentials span {
    color: rgba(255, 255, 255, 0.95) !important;
    font-size: 0.9rem;
}

.author-credentials i {
    color: rgba(255, 255, 255, 0.95) !important;
    margin-right: 0.5rem;
}

.author-link {
    color: white !important;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    transition: transform 0.2s;
}

.author-link:hover {
    color: rgba(255, 255, 255, 0.85) !important;
    transform: translateX(4px);
}

@media (max-width: 768px) {
    .author-box {
        flex-direction: column;
        padding: 1.75rem;
        margin: 2rem 0;
    }

    .author-image {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }

    .author-content h3 {
        font-size: 1.25rem;
    }
}

/* FAQ Section Styles */
.faq-section {
    margin: 2rem 0;
}

.faq-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.faq-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.faq-item h3 {
    background: linear-gradient(135deg, #f5f7fa 0%, #fafbfc 100%);
    margin: 0;
    padding: 1.25rem;
    cursor: pointer;
    font-size: 1.05rem;
    color: var(--text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.2s ease;
}

.faq-item h3:hover {
    background: linear-gradient(135deg, #eff3f8 0%, #f5fafe 100%);
}

.faq-item h3::after {
    content: '▼';
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    margin-left: 1rem;
}

.faq-item.active h3::after {
    transform: rotate(180deg);
}

.faq-item p {
    padding: 1.25rem;
    margin: 0;
    color: #555;
    line-height: 1.8;
    display: none;
    background: white;
}

.faq-item.active p {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    .faq-item h3 {
        padding: 1rem;
        font-size: 0.95rem;
    }

    .faq-item p {
        padding: 1rem;
    }
}
