/**
 * Archive Styles
 * Italia Delight Theme
 */

/* ===== Hero Search Bar ===== */
.hero-search-form {
    margin: 0 auto;
}

/* Screen reader only class for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Custom border width */
.border-3 {
    border-width: 3px;
}

.hero-search-field {
    font-size: 1.125rem;
    font-weight: 500;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    color: #1f2937;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-width: 3px;
}

.hero-search-field:hover {
    border-color: #ea4544;
    box-shadow: 0 15px 40px rgba(234, 69, 68, 0.15);
}

.hero-search-field:focus {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(234, 69, 68, 0.25);
    border-color: #ea4544;
}

.hero-search-field::placeholder {
    color: #4b5563;
    font-weight: 400;
}

/* Search icon styling */
.search-icon-wrapper svg {
    color: #ea4544;
    transition: all 0.3s ease;
}

.hero-search-field:focus ~ .search-icon-wrapper svg {
    color: #ea4544;
    transform: scale(1.1);
}

/* Search submit button */
.search-submit-btn {
    min-height: 44px;
    min-width: 44px;
    transition: all 0.3s ease;
}

.search-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(234, 69, 68, 0.3);
}

.search-submit-btn:active {
    transform: translateY(0);
}

.search-submit-btn svg {
    flex-shrink: 0;
}

/* ===== Filters Section ===== */
.filters-section {
    background: linear-gradient(135deg, #fafafa 0%, #ffffff 100%);
    border-radius: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 2px solid #f3f4f6;
    transition: all 0.3s ease;
}

.filters-section:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.search-field {
    transition: all 0.3s ease;
}

.search-field:focus {
    box-shadow: 0 0 0 4px rgba(234, 69, 68, 0.1);
}

.category-select {
    background: white url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") no-repeat right 0.5rem center/1.5em 1.5em;
    appearance: none;
    transition: all 0.3s ease;
}

.category-select:focus {
    box-shadow: 0 0 0 3px rgba(234, 69, 68, 0.1);
}

.filter-tag {
    animation: slideIn 0.3s ease;
    min-height: 32px;
    display: inline-flex;
}

.filter-tag button {
    min-width: 24px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.filter-tag button:hover {
    transform: scale(1.2);
}

/* Active filters container */
#active-filters,
#active-filters-archive {
    transition: all 0.3s ease;
}

#active-filters-tags,
#active-filters-tags-archive {
    min-height: 32px;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slideIn {
    animation: slideIn 0.3s ease;
}

/* Spinner animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ===== Loading States ===== */
#posts-loading {
    position: relative;
    min-height: 400px;
}

#posts-loading > div {
    backdrop-filter: blur(4px);
    z-index: 50;
}

/* Shimmer effect for skeleton loaders (optional future enhancement) */
@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: 200px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

.results-count {
    font-size: 0.875rem;
    padding: 0.75rem 0;
    border-bottom: 2px solid #f3f4f6;
}

/* ===== Archive Header ===== */
.archive-header {
    text-align: center;
    margin-bottom: 3rem;
}

.archive-header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: var(--font-weight-bold);
    margin-bottom: 1rem;
}

.archive-description {
    font-size: var(--font-size-lg);
    color: var(--color-text-light);
    max-width: 48rem;
    margin: 0 auto;
    line-height: var(--line-height-relaxed);
}

/* ===== Post Card ===== */
.post-card {
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 2px solid #f3f4f6;
}

.post-card:hover {
    box-shadow: 0 20px 40px rgba(234, 69, 68, 0.15), 0 0 0 2px rgba(234, 69, 68, 0.1);
    transform: translateY(-8px) scale(1.01);
}

/* Content area padding and spacing */
.post-card > div:last-child {
    padding: 1.75rem;
    background: linear-gradient(180deg, white 0%, #fafafa 100%);
}

@media (min-width: 768px) {
    .post-card > div:last-child {
        padding: 2.25rem;
    }
}

/* Post card image improvements */
.post-card img {
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover img {
    transform: scale(1.05);
}

/* Post card title enhancement */
.post-card h2 {
    transition: all 0.3s ease;
    line-height: 1.3;
}

.post-card:hover h2 {
    color: var(--color-brand-red);
    transform: translateX(4px);
}

.post-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.post-card:hover img {
    transform: scale(1.1);
}

.post-card h2 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: 0.75rem;
    transition: color var(--transition-fast);
}

.post-card:hover h2 {
    color: var(--color-brand-red);
}

.post-card h2 a {
    color: inherit;
    text-decoration: none;
}

.post-card p {
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    margin-bottom: 1rem;
}

/* ===== Pagination ===== */
.pagination-wrapper {
    margin-top: 3rem;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0.5rem 1rem;
    background-color: white;
    color: var(--color-text-gray);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-fast);
}

.page-numbers:hover {
    background-color: var(--color-brand-red);
    color: white;
    border-color: var(--color-brand-red);
}

.page-numbers.current {
    background-color: var(--color-brand-red);
    color: white;
    border-color: var(--color-brand-red);
}

.page-numbers.dots {
    background-color: transparent;
    border: none;
    cursor: default;
}

.page-numbers.dots:hover {
    background-color: transparent;
    color: var(--color-text-gray);
}

.page-numbers.prev,
.page-numbers.next {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-numbers svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* ===== No Results ===== */
.no-results {
    text-align: center;
    padding: 5rem 1rem;
}

.no-results h1 {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: 1rem;
}

.no-results .page-content {
    max-width: 48rem;
    margin: 0 auto;
}

.no-results p {
    font-size: var(--font-size-lg);
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
}

/* ===== Search Form ===== */
.search-form {
    display: flex;
    max-width: 32rem;
    margin: 0 auto 2rem;
}

.search-form label {
    flex: 1;
}

.search-form .search-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    font-size: var(--font-size-base);
}

.search-form .search-submit {
    padding: 0.75rem 1.5rem;
    background-color: var(--color-brand-red);
    color: white;
    border: none;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.search-form .search-submit:hover {
    background-color: var(--color-brand-red-dark);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    /* Hero search mobile optimization */
    .hero-search-field {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 1rem 8rem 1rem 3.5rem;
    }

    .search-icon-wrapper {
        padding-left: 1rem;
    }

    .search-icon-wrapper svg {
        width: 1.25rem;
        height: 1.25rem;
    }

    .search-submit-btn {
        padding: 0.75rem 1rem;
        right: 0.5rem;
    }

    .search-submit-btn span {
        display: none;
    }

    /* Category filter mobile */
    .category-select {
        min-width: 100% !important;
        max-width: 100% !important;
        font-size: 16px; /* Prevent iOS zoom */
        padding: 0.875rem 2.5rem 0.875rem 1.25rem;
        min-height: 44px;
    }

    /* Filters section mobile */
    .filters-section {
        padding: 1rem;
    }

    .filters-section > div {
        gap: 1.5rem;
    }

    /* Active filters mobile */
    .filter-tag {
        font-size: 0.813rem;
        padding: 0.5rem 0.75rem;
    }

    /* Archive header mobile */
    .archive-header h1 {
        font-size: var(--font-size-3xl);
    }

    .archive-description {
        font-size: var(--font-size-base);
    }

    /* Post card mobile */
    .post-card h2 {
        font-size: var(--font-size-lg);
    }

    .post-card > div:last-child {
        padding: 1.5rem;
    }

    /* Pagination mobile */
    .page-numbers {
        min-width: 2rem;
        height: 2rem;
        padding: 0.25rem 0.75rem;
        font-size: var(--font-size-sm);
    }

    /* Loading spinner mobile */
    #posts-loading {
        min-height: 300px;
    }

    #posts-loading svg {
        width: 2.5rem;
        height: 2.5rem;
    }
}

/* Tablet breakpoint */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero-search-field {
        font-size: 1rem;
    }

    .category-select {
        min-width: 180px;
        max-width: 250px;
    }
}

/* Large screens - optimize search bar width */
@media (min-width: 1280px) {
    .hero-search-field {
        font-size: 1.125rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Ensure all interactive elements have min 44x44px touch targets */
    .search-submit-btn,
    .category-select,
    .filter-tag button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .hero-search-field:hover {
        transform: none;
    }

    .post-card:hover {
        transform: none;
    }

    .post-card:hover img {
        transform: none;
    }
}

/* ===== Category Badge ===== */
.post-card .category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--color-brand-red);
    color: white;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 0.75rem;
    text-decoration: none;
    transition: background-color var(--transition-fast);
}

.post-card .category-badge:hover {
    background-color: var(--color-brand-red-dark);
}
