/* ==========================================================================
   All Posts Page Styles
   ========================================================================== */

/* Breadcrumb Navigation
   ========================================================================== */
.breadcrumb {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
}

.breadcrumb ol {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

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

.breadcrumb li:not(:last-child)::after {
    content: '›';
    margin-left: 0.5rem;
    color: #999;
    font-size: 1.125rem;
}

.breadcrumb a {
    color: #666;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: #000;
}

.breadcrumb li:last-child span {
    color: #000;
    font-weight: 500;
}

/* Main Container
   ========================================================================== */
.all-posts-page {
    width: 100%;
}

/* Page Header - Improved styling */
.all-posts-page .post-header {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem 2rem;
    text-align: center;
}

.all-posts-page .post-title {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 1rem;
    color: #15171A;
    color: var(--title-color);
}

.all-posts-page .post-excerpt {
    font-size: 1.25rem;
    line-height: 1.6;
    color: #626d79;
    max-width: 720px;
    margin: 0 auto;
}

.all-posts-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
}

/* Filter and Sort Controls
   ========================================================================== */
.posts-controls {
    display: grid;
    grid-template-columns: 200px 200px 2fr;
    gap: 1rem;
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background: #f7f7f7;
    background: var(--gray-150);
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.sort-controls,
.filter-controls,
.search-box {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.controls-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sort-controls label,
.filter-controls label,
.search-box label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #e0e0e0;
    margin-bottom: 0.25rem;
}

/* Dark mode labels */
.dark .sort-controls label,
.dark .filter-controls label,
.dark .search-box label {
    color: #e0e0e0;
}

.control-group select,
.control-group input,
.posts-controls select,
.posts-controls input {
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9375rem;
    background: white;
    background: var(--input-bg);
    color: var(--input-color);
    transition: all 0.2s ease;
    font-family: inherit;
    height: 48.5px;
    width: 100%;
    max-width: 100%;
}

.control-group select:hover,
.control-group input:hover,
.posts-controls select:hover,
.posts-controls input:hover {
    border-color: #bbb;
    border-color: var(--input-hover-border-color);
}

.control-group select:focus,
.control-group input:focus,
.posts-controls select:focus,
.posts-controls input:focus {
    outline: none;
    border-color: #3eb0ef;
    border-color: var(--ghost-accent-color);
    box-shadow: 0 0 0 3px rgba(62, 176, 239, 0.1);
}

.control-group select,
.posts-controls select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* Dark mode dropdown arrow */
.dark .control-group select,
.dark .posts-controls select {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.search-box {
    min-width: 0;
}

#search-input {
    width: 100%;
    max-width: 100%;
}

#search-input::placeholder {
    color: #dcd9d9;
    color: var(--placeholder-color);
}

.results-count {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: #626d79;
    font-weight: 500;
}

/* Skeleton Loaders
   ========================================================================== */
.skeleton-card {
    background: white;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    height: 400px;
    border: 1px solid #f0f0f0;
    position: relative;
}

.skeleton-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.5) 50%,
        transparent 100%
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Dark mode skeleton */
.dark .skeleton-card {
    background: #2a2a2a;
    border-color: #444;
}

.dark .skeleton-card::before {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.05) 50%,
        transparent 100%
    );
}

/* Posts Grid
   ========================================================================== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.post-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid #f0f0f0;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-color: #e0e0e0;
}

/* Post Card Image */
.post-card-image {
    position: relative;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: block;
}

.post-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-card:hover .post-card-image img {
    transform: scale(1.05);
}

/* Post Card Content */
.post-card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card-title {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
    line-height: 1.4;
    font-weight: 600;
}

.post-card-title a {
    color: #15171A;
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-card-title a:hover {
    color: #3eb0ef;
}

.post-card-excerpt {
    color: #626d79;
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Post Card Meta */
.post-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
    font-size: 0.875rem;
    color: #738a94;
}

.post-card-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.post-card-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.tag {
    background: #f0f0f0;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #626d79;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tag:hover {
    background: #e0e0e0;
    color: #15171A;
}

/* No Posts State
   ========================================================================== */
.no-posts {
    text-align: center;
    padding: 4rem 2rem;
    color: #626d79;
    grid-column: 1 / -1;
}

.no-posts svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.3;
    stroke: currentColor;
}

.no-posts p:first-of-type {
    font-size: 1.125rem;
    font-weight: 600;
    color: #15171A;
    margin-bottom: 0.5rem;
}

/* Pagination Controls
   ========================================================================== */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 0;
}

.pagination-controls button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: #3eb0ef;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(62, 176, 239, 0.2);
}

.pagination-controls button:hover:not(:disabled) {
    background: #2d8fc1;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(62, 176, 239, 0.3);
}

.pagination-controls button:active:not(:disabled) {
    transform: translateY(0);
}

.pagination-controls button:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pagination-controls button svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Prevent any pseudo-elements from adding arrows */
.pagination-controls button::before,
.pagination-controls button::after,
#prev-page::before,
#prev-page::after,
#next-page::before,
#next-page::after {
    content: none !important;
    display: none !important;
}

#page-info {
    font-weight: 600;
    min-width: 120px;
    text-align: center;
    font-size: 0.9375rem;
    color: #07aa6d;
}

/* Responsive Design
   ========================================================================== */

/* Tablet */
@media (max-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .all-posts-wrapper {
        padding: 1.5rem 0 3rem;
    }

    .container {
        padding: 0 1rem;
    }

    .breadcrumb {
        padding: 1rem;
        font-size: 0.8125rem;
    }

    /* Stack controls vertically on mobile */
    .posts-controls {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .posts-controls {
        padding: 1rem;
    }

    .controls-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .control-group label {
        font-size: 0.8125rem;
    }

    .control-group select,
    .control-group input {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }
    
    .pagination-controls {
        gap: 1rem;
        flex-wrap: wrap;
    }
    
    .pagination-controls button {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    #page-info {
        min-width: 100px;
        font-size: 0.875rem;
        order: -1;
        width: 100%;
        text-align: center;
    }

    .post-card-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .post-card-tags {
        justify-content: flex-start;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .posts-controls {
        padding: 1rem;
        border-radius: 8px;
    }

    .breadcrumb {
        padding: 0.75rem 1rem;
    }

    .breadcrumb ol {
        font-size: 0.75rem;
    }

    .post-card-title {
        font-size: 1.125rem;
    }

    .post-card-content {
        padding: 1.25rem;
    }

    .pagination-controls button {
        flex: 1;
        justify-content: center;
    }

    .results-info {
        font-size: 0.8125rem;
    }
}

/* Print Styles
   ========================================================================== */
@media print {
    .posts-controls,
    .pagination-controls,
    .breadcrumb {
        display: none;
    }

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

    .post-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 1rem;
    }

    .post-card:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Dark Mode Support (if your theme supports it)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    .all-posts-wrapper {
        background: #1a1a1a;
    }

    .posts-controls {
        background: #2a2a2a;
    }

    .control-group label {
        color: #e0e0e0;
    }

    .control-group select,
    .control-group input {
        background: #1a1a1a;
        border-color: #444;
        color: #e0e0e0;
    }

    .control-group select:hover,
    .control-group input:hover {
        border-color: #666;
    }

    .control-group select {
        background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    }

    .results-info {
        border-color: #444;
        color: #999;
    }

    .post-card {
        background: #2a2a2a;
        border-color: #444;
    }

    .post-card-title a {
        color: #e0e0e0;
    }

    .post-card-excerpt {
        color: #999;
    }

    .post-card-meta {
        border-color: #444;
        color: #888;
    }

    .tag {
        background: #1a1a1a;
        color: #999;
    }

    .tag:hover {
        background: #333;
        color: #e0e0e0;
    }

    .breadcrumb a {
        color: #999;
    }

    .breadcrumb a:hover,
    .breadcrumb li:last-child span {
        color: #e0e0e0;
    }

    #page-info {
        color: #07aa6d;
    }

    .no-posts {
        color: #999;
    }

    .no-posts p:first-of-type {
        color: #e0e0e0;
    }
}

/* Accessibility Improvements
   ========================================================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible styles for keyboard navigation */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 2px solid #3eb0ef;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .spinner {
        animation: none;
        border: 3px solid #3eb0ef;
    }
}