/**
 * SchoolExa Blog - Custom Styles
 * Additional styles and enhancements
 * 
 * @package SchoolExa_Blog
 */

/* ============================================
   SEARCH RESULTS DROPDOWN
============================================ */

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    margin-top: 0.5rem;
    display: none;
    z-index: 100;
    max-height: 400px;
    overflow-y: auto;
}

.search-results-list {
    padding: 0.5rem;
}

.search-result-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: background var(--transition-fast);
}

.search-result-item:hover {
    background: var(--gray-50);
}

.search-result-image {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-category {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-green);
    display: block;
    margin-bottom: 0.25rem;
}

.search-result-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-excerpt {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-no-results {
    padding: 2rem;
    text-align: center;
    color: var(--gray-500);
}

/* ============================================
   BREADCRUMBS
============================================ */

.breadcrumbs {
    margin-bottom: 1.5rem;
}

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.breadcrumbs li {
    display: inline-flex;
    align-items: center;
}

.breadcrumbs a {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumbs a:hover {
    color: var(--white);
}

.breadcrumbs .current {
    color: var(--white);
    font-size: 0.875rem;
}

.breadcrumb-separator {
    color: rgba(255, 255, 255, 0.5);
    margin: 0 0.25rem;
}

/* ============================================
   MOBILE MENU ANIMATION
============================================ */

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ============================================
   STICKY HEADER STATES
============================================ */

.site-header.scroll-down {
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.site-header.scroll-up {
    transform: translateY(0);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-md);
}

/* ============================================
   BLOG CARD ENHANCEMENTS
============================================ */

.blog-card-wrapper {
    opacity: 1;
    transform: translateY(0);
}

.blog-card-wrapper.fade-in {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* No image placeholder */
.blog-card-image img[src$="placeholder.jpg"] {
    background: linear-gradient(135deg, var(--primary-green-100), var(--primary-green-200));
}

/* ============================================
   ENTRY CONTENT ENHANCEMENTS
============================================ */

.entry-content a {
    color: var(--primary-green);
    text-decoration: underline;
    text-decoration-color: var(--primary-green-200);
    text-underline-offset: 2px;
    transition: all var(--transition-fast);
}

.entry-content a:hover {
    color: var(--primary-green-dark);
    text-decoration-color: var(--primary-green);
}

.entry-content figure {
    margin: 2rem 0;
}

.entry-content figcaption {
    font-size: 0.875rem;
    color: var(--gray-500);
    text-align: center;
    margin-top: 0.75rem;
    font-style: italic;
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
}

.entry-content table th,
.entry-content table td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-200);
    text-align: left;
}

.entry-content table th {
    background: var(--gray-50);
    font-weight: 600;
}

.entry-content table tr:hover {
    background: var(--gray-50);
}

/* ============================================
   WORDPRESS BLOCKS STYLING
============================================ */

.wp-block-quote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: var(--primary-green-50);
    border-left: 4px solid var(--primary-green);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.wp-block-quote p {
    font-size: 1.125rem;
    font-style: italic;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.wp-block-quote cite {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-style: normal;
}

.wp-block-code {
    background: var(--gray-900);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    overflow-x: auto;
}

.wp-block-code code {
    color: var(--gray-100);
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
    background: none;
    padding: 0;
}

.wp-block-separator {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 3rem 0;
}

.wp-block-separator.is-style-dots {
    border: none;
    text-align: center;
}

.wp-block-separator.is-style-dots::before {
    content: '···';
    color: var(--gray-400);
    font-size: 1.5rem;
    letter-spacing: 1rem;
}

.wp-block-button__link {
    background: var(--gradient-primary);
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
    display: inline-block;
}

.wp-block-button__link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: var(--white);
}

/* ============================================
   LOADING STATES
============================================ */

.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   TOAST NOTIFICATIONS
============================================ */

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--gray-900);
    color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 10000;
    animation: slideUp 0.3s ease;
}

.toast.success {
    background: var(--primary-green);
}

.toast.error {
    background: #ef4444;
}

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

/* ============================================
   CUSTOM SCROLLBAR
============================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ============================================
   SELECTION HIGHLIGHT
============================================ */

::selection {
    background: var(--primary-green-200);
    color: var(--gray-900);
}

::-moz-selection {
    background: var(--primary-green-200);
    color: var(--gray-900);
}

/* ============================================
   FOCUS STYLES
============================================ */

.blog-card:focus-within {
    outline: 2px solid var(--primary-green);
    outline-offset: 4px;
}

/* ============================================
   CATEGORY PILL ACTIVE STATE
============================================ */

.category-pill.active {
    background: var(--primary-green);
    color: var(--white);
    border-color: var(--primary-green);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
============================================ */

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr !important;
    }
    
    .social-share-sidebar {
        position: static !important;
        flex-direction: row !important;
        justify-content: center;
        padding: 1rem 0;
        border-bottom: 1px solid var(--gray-200);
        margin-bottom: 2rem;
    }
    
    .share-label {
        display: none !important;
    }
    
    .table-of-contents {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .search-results-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 60vh;
    }
    
    .featured-post .blog-card {
        grid-template-columns: 1fr !important;
    }
    
    .featured-post .blog-card-content {
        padding: var(--spacing-lg) !important;
    }
    
    .featured-post .blog-card-title {
        font-size: 1.25rem !important;
    }
}

/* ============================================
   NO POSTS FOUND STYLES
============================================ */

.no-posts-found {
    text-align: center;
    padding: 4rem 0;
}

.no-posts-icon {
    color: var(--gray-300);
    margin-bottom: 1.5rem;
}

.no-posts-found h2 {
    margin-bottom: 0.75rem;
}

.no-posts-found p {
    color: var(--gray-500);
    max-width: 400px;
    margin: 0 auto 1.5rem;
}

/* ============================================
   READING PROGRESS BAR
============================================ */

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--gradient-primary);
    z-index: 9999;
    transition: width 0.1s ease;
}

/* ============================================
   DARK MODE SUPPORT (Future Enhancement)
============================================ */

@media (prefers-color-scheme: dark) {
    /* Add dark mode styles here if needed */
}

/* ============================================
   PRINT OPTIMIZATION
============================================ */

@media print {
    .hero-section,
    .category-filters,
    .newsletter-section,
    .social-share-sidebar,
    .table-of-contents,
    .related-posts-section,
    .site-header,
    .site-footer {
        display: none !important;
    }
    
    .single-post-content {
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}
