/*
Additional CSS for JavaScript functionality and enhancements
*/

/* ==========================================================================
   Back to Top Button
   ========================================================================== */

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

/* ==========================================================================
   Enhanced Search Form
   ========================================================================== */

.search-form.enhanced {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 300px;
}

.search-form.enhanced .search-field {
    padding-right: 3rem;
    border-radius: 25px;
    border: 2px solid #ddd;
    transition: border-color 0.3s ease;
}

.search-form.enhanced.focused .search-field {
    border-color: #3498db;
    outline: none;
}

.search-form.enhanced .search-submit {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: #7f8c8d;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: color 0.3s ease;
}

.search-form.enhanced .search-submit:hover {
    color: #3498db;
}

/* ==========================================================================
   Comment Form Enhancements
   ========================================================================== */

.comment-form .required {
    color: #e74c3c;
    font-weight: bold;
}

.comment-form input.error,
.comment-form textarea.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

.comment-form .form-submit {
    margin-top: 1rem;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.loading {
    overflow: hidden;
}

.loading::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.loading::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10000;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ==========================================================================
   Lazy Loading Images
   ========================================================================== */

img.lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.lazy.loaded {
    opacity: 1;
}

/* ==========================================================================
   Footer Widget Areas
   ========================================================================== */

.footer-widgets {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.footer-widget-area {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-widget-column .widget {
    margin-bottom: 1.5rem;
}

.footer-widget-column .widget-title {
    color: #ecf0f1;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

.footer-widget-column .widget ul {
    list-style: none;
    padding: 0;
}

.footer-widget-column .widget li {
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.footer-widget-column .widget li:last-child {
    border-bottom: none;
}

.footer-widget-column .widget a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-widget-column .widget a:hover {
    color: #3498db;
}

/* ==========================================================================
   Footer Navigation
   ========================================================================== */

.footer-navigation {
    margin-bottom: 1rem;
}

.footer-navigation ul {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
}

.footer-navigation a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-navigation a:hover {
    color: #3498db;
}

/* ==========================================================================
   Post Navigation
   ========================================================================== */

.post-navigation {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.post-navigation .nav-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.post-navigation .nav-previous,
.post-navigation .nav-next {
    flex: 1;
    max-width: 48%;
}

.post-navigation .nav-next {
    text-align: right;
}

.post-navigation .nav-subtitle {
    display: block;
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 0.25rem;
}

.post-navigation .nav-title {
    display: block;
    font-weight: 600;
    color: #2c3e50;
}

.post-navigation a {
    text-decoration: none;
    transition: color 0.3s ease;
}

.post-navigation a:hover .nav-title {
    color: #3498db;
}

/* ==========================================================================
   Archive Page Header
   ========================================================================== */

.page-header {
    margin-bottom: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    border-radius: 8px;
    text-align: center;
}

.page-header .page-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.page-header .archive-description {
    margin-top: 0.5rem;
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ==========================================================================
   404 Page Styles
   ========================================================================== */

.error-404 .page-header {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.error-404 .widget-area {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* ==========================================================================
   Responsive Enhancements
   ========================================================================== */

@media (max-width: 768px) {
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .footer-widget-area {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }
    
    .footer-navigation ul {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .post-navigation .nav-links {
        flex-direction: column;
        gap: 1rem;
    }
    
    .post-navigation .nav-previous,
    .post-navigation .nav-next {
        max-width: 100%;
        text-align: center;
    }
    
    .page-header {
        padding: 1.5rem 1rem;
    }
    
    .page-header .page-title {
        font-size: 1.5rem;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .back-to-top,
    .menu-toggle,
    .main-navigation,
    .sidebar,
    .site-footer,
    .comment-form {
        display: none !important;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .site-header {
        position: static;
        box-shadow: none;
        border-bottom: 1px solid #ddd;
    }
    
    a {
        color: #000 !important;
        text-decoration: underline !important;
    }
    
    .post, .page {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}
