/**
 * SHW User Experience Pro - Styles
 * Version: 1.0.0
 */

/* Skip Links for Accessibility */
.shw-skip-links {
    position: absolute;
    top: -100px;
    left: 0;
    width: 100%;
    z-index: 10000;
}

.shw-skip-link {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: #667eea;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
    font-weight: 600;
    z-index: 10001;
}

.shw-skip-link:focus {
    top: 0;
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

/* Enhanced Search Form */
.shw-search-form {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.shw-search-wrapper {
    position: relative;
    display: flex;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.shw-search-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #e2e8f0;
    border-right: none;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.shw-search-input:focus {
    border-color: #667eea;
}

.shw-search-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 14px 24px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shw-search-button:hover {
    background: #5a67d8;
}

.shw-search-button:focus {
    outline: 3px solid #fbbf24;
    outline-offset: -3px;
}

.screen-reader-text {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Excerpt Read Time */
.shw-excerpt-readtime {
    color: #718096;
    font-size: 0.9em;
    font-weight: 600;
}

/* Content Age Notice */
.shw-content-age-notice {
    background: #fff8dc;
    border-left: 4px solid #fbbf24;
    padding: 16px 20px;
    margin-bottom: 24px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
}

.shw-content-age-notice strong {
    color: #92400e;
}

/* ===== STICKY HEADER OVERLAP FIX ===== */
/* When Astra sticky header is active, add padding to body to prevent content overlap */

body.ast-sticky-active,
body.ast-sticky-header-shrink {
    padding-top: 90px !important;
}

/* Admin bar adjustment */
body.admin-bar.ast-sticky-active,
body.admin-bar.ast-sticky-header-shrink {
    padding-top: 122px !important;
}

/* Mobile admin bar */
@media (max-width: 782px) {
    body.admin-bar.ast-sticky-active,
    body.admin-bar.ast-sticky-header-shrink {
        padding-top: 136px !important;
    }
}

/* Smaller mobile header */
@media (max-width: 921px) {
    body.ast-sticky-active,
    body.ast-sticky-header-shrink {
        padding-top: 70px !important;
    }
    
    body.admin-bar.ast-sticky-active,
    body.admin-bar.ast-sticky-header-shrink {
        padding-top: 116px !important;
    }
}

/* Ensure sticky header is properly positioned */
body.ast-sticky-active #masthead,
body.ast-sticky-header-shrink #masthead {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 99999 !important;
    background-color: #ffffff !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}

/* Admin bar offset for sticky header */
body.admin-bar.ast-sticky-active #masthead,
body.admin-bar.ast-sticky-header-shrink #masthead {
    top: 32px !important;
}

@media (max-width: 782px) {
    body.admin-bar.ast-sticky-active #masthead,
    body.admin-bar.ast-sticky-header-shrink #masthead {
        top: 46px !important;
    }
}

/* Smooth transition for body padding */
body {
    transition: padding-top 0.3s ease;
}

/* Ensure header is always visible */
#masthead {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ===== FEATURED IMAGE DISPLAY FIX ===== */
/* Force featured images to display on single posts */
.single .post-thumb-img-content,
.single .ast-single-post-thumbnails,
.single .entry-thumb,
.single .post-thumbnail,
.single .wp-post-image,
.ast-single-post .post-thumb-img-content,
.ast-single-post .post-thumbnail img {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.single .post-thumb-img-content,
.ast-single-post .post-thumb-img-content {
    margin-bottom: 1.5em;
}

.single .post-thumbnail img,
.single .wp-post-image {
    width: 100%;
    height: auto;
    max-width: 100%;
}

/* Archive featured images */
.ast-blog-featured-section,
.ast-blog-featured-section .post-thumb {
    display: block !important;
    visibility: visible !important;
}

/* Mobile Bottom Navigation */
.shw-mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 998;
    padding: 8px 0;
}

.shw-mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
}

.shw-mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #4a5568;
    font-size: 12px;
    padding: 8px 12px;
    transition: color 0.2s;
}

.shw-mobile-nav-item:hover,
.shw-mobile-nav-item.active {
    color: #667eea;
}

.shw-mobile-nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
}

/* Help Tooltip */
.shw-help-tooltip {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 20px;
    max-width: 300px;
    z-index: 1000;
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.shw-help-content h4 {
    margin: 0 0 12px 0;
    color: #2d3748;
    font-size: 16px;
}

.shw-help-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #4a5568;
}

.shw-help-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    color: #a0aec0;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shw-help-close:hover {
    color: #4a5568;
}

/* Floating Action Button (for help) */
.shw-fab-help {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 999;
    transition: all 0.3s;
}

.shw-fab-help:hover {
    background: #5a67d8;
    transform: scale(1.1);
}

.shw-fab-help:active {
    transform: scale(0.95);
}

/* Loading Indicator */
.shw-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .shw-mobile-nav {
        display: block;
    }
    
    .shw-search-form {
        max-width: 100%;
    }
    
    .shw-search-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .shw-help-tooltip {
        bottom: 100px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .shw-fab-help {
        bottom: 80px; /* Above mobile nav */
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .shw-search-button,
    .shw-fab-help {
        border: 2px solid white;
    }
    
    .shw-content-age-notice {
        border: 2px solid #fbbf24;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .shw-sticky-nav,
    .shw-fab-help,
    .shw-help-tooltip {
        transition: none;
        animation: none;
    }
}

/* Print Styles */
@media print {
    .shw-skip-links,
    .shw-mobile-nav,
    .shw-fab-help,
    .shw-help-tooltip,
    .shw-sticky-nav {
        display: none !important;
    }
}

/* Focus Visible Polyfill */
.shw-search-button:focus-visible,
.shw-mobile-nav-item:focus-visible,
.shw-fab-help:focus-visible {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}
