/**
 * Archive Styles - Grid & List View
 * Based on grid.html and list.html templates
 */

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800&family=Playfair+Display:wght@700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

/* Archive Wrapper */
.dnvoting-archive-new {
    background: #f8fafc;
    min-height: 100vh;
    font-family: 'Montserrat', sans-serif;
}

.dnvoting-archive-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 3rem 1rem;
}

/* Archive Header */
.dnvoting-archive-new-header {
    margin-bottom: 3rem;
}

.dnvoting-header-top {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .dnvoting-header-top {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }
}

.dnvoting-header-content h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 900;
    color: #0f172a;
    margin: 0 0 1rem 0;
    line-height: 1.2;
}

@media (min-width: 768px) {
    .dnvoting-header-content h1 {
        font-size: 3rem;
    }
}

.dnvoting-header-content p {
    color: #64748b;
    font-size: 1.125rem;
    max-width: 42rem;
    margin: 0;
}

/* View Toggle */
.dnvoting-view-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.5rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.dnvoting-view-btn {
    padding: 0.5rem;
    border-radius: 0.75rem;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dnvoting-view-btn:hover {
    background: #f1f5f9;
}

.dnvoting-view-btn.active {
    background: #e2e8f0;
    color: #1a3a5f;
}

.dnvoting-view-btn .material-symbols-outlined {
    font-size: 1.5rem;
}

/* Filter Controls */
.dnvoting-filter-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.5rem 0;
    border-top: 1px solid #e2e8f0;
}

/* When no category tabs (taxonomy archive), align sort to right */
.dnvoting-filter-controls:not(:has(.dnvoting-category-tabs)) {
    justify-content: flex-end;
}

.dnvoting-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    flex: 1;
}

.dnvoting-category-tab {
    padding: 0.625rem 1.5rem;
    border-radius: 9999px;
    background: white;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.dnvoting-category-tab:hover {
    border-color: #1a3a5f;
}

.dnvoting-category-tab.active {
    background: #1a3a5f;
    color: white;
    border-color: #1a3a5f;
    font-weight: 700;
}

.dnvoting-filter-divider {
    display: none; /* Hide divider */
}

.dnvoting-sort-select {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    padding: 0.625rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    flex-shrink: 0; /* Prevent shrinking */
    width: auto !important; /* Override theme CSS */
    min-width: 200px; /* Ensure readable width */
}

.dnvoting-sort-select:focus {
    border-color: #1a3a5f;
    box-shadow: 0 0 0 3px rgba(26, 58, 95, 0.1);
}

/* Grid View */
.dnvoting-posts-grid {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 3rem;
    min-height: 400px;
}

/* When loading, override grid to allow flexbox centering */
.dnvoting-posts-grid:has(.dnvoting-posts-loading) {
    display: block;
}

@media (min-width: 640px) {
    .dnvoting-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .dnvoting-posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .dnvoting-posts-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Grid Card */
.dnvoting-grid-card {
    background: white;
    border-radius: 2rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.dnvoting-grid-card:hover {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(-4px);
}

.dnvoting-grid-card-image-wrapper {
    position: relative;
    height: 16rem;
    overflow: hidden;
}

.dnvoting-grid-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.dnvoting-grid-card:hover .dnvoting-grid-card-image {
    transform: scale(1.1);
}

.dnvoting-grid-card-badges {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    gap: 0.5rem;
}

.dnvoting-grid-card-badge {
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
}

.dnvoting-badge-nomination {
    background: #f59e0b;
    color: white;
}

.dnvoting-badge-candidacy {
    background: #2563eb;
    color: white;
}

.dnvoting-grid-card-heart {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.dnvoting-grid-card-heart:hover {
    background: white;
    transform: scale(1.1);
}

.dnvoting-grid-card-heart .material-symbols-outlined {
    font-size: 1.25rem;
    font-variation-settings: 'FILL' 0;
    transition: all 0.2s;
}

.dnvoting-grid-card-heart.voted .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
    color: #ef4444;
}

.dnvoting-grid-card-heart:not(.voted):hover {
    color: #ef4444;
}

.dnvoting-grid-card-category {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    padding: 0.375rem 0.75rem;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    color: white;
    font-size: 0.75rem;
    border-radius: 0.5rem;
}

.dnvoting-grid-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.dnvoting-grid-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.dnvoting-grid-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    line-height: 1.3;
    flex: 1;
}

.dnvoting-grid-card-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #f59e0b;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.dnvoting-grid-card-rating .material-symbols-outlined {
    font-size: 0.875rem;
}

.dnvoting-grid-card-rating span:last-child {
    font-size: 0.875rem;
    font-weight: 700;
}

.dnvoting-grid-card-description {
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0 0 1.5rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dnvoting-grid-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1.5rem;
    border-top: 1px solid #f1f5f9;
    margin-top: auto;
}

.dnvoting-grid-card-votes {
    display: flex;
    flex-direction: column;
}

.dnvoting-grid-card-votes-label {
    font-size: 0.625rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.dnvoting-grid-card-votes-count {
    font-size: 1.125rem;
    font-weight: 900;
    color: #1a3a5f;
}

.dnvoting-grid-card-vote-btn {
    background: #e2e8f0;
    color: #475569;
    padding: 0.5rem 1.5rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.dnvoting-grid-card-vote-btn:hover {
    background: #1a3a5f;
    color: white;
    transform: translateY(-2px);
}

/* List View */
.dnvoting-posts-list {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 3rem;
    min-height: 400px;
}

/* When loading, override flex to allow loading centering */
.dnvoting-posts-list:has(.dnvoting-posts-loading) {
    display: block;
}

.dnvoting-list-card {
    background: white;
    border-radius: 1.5rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .dnvoting-list-card {
        flex-direction: row;
    }
}

.dnvoting-list-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.dnvoting-list-card-image-wrapper {
    position: relative;
    width: 100%;
    height: 14rem;
    overflow: hidden;
    border-radius: 1rem;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .dnvoting-list-card-image-wrapper {
        width: 20rem;
        height: auto;
    }
}

.dnvoting-list-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.dnvoting-list-card:hover .dnvoting-list-card-image {
    transform: scale(1.05);
}

.dnvoting-list-card-badges {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.dnvoting-list-card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0.5rem 0;
}

.dnvoting-list-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.dnvoting-list-card-meta {
    flex: 1;
}

.dnvoting-list-card-category {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

.dnvoting-list-card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    line-height: 1.3;
}

.dnvoting-list-card-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #f59e0b;
    flex-shrink: 0;
    margin-left: 1rem;
}

.dnvoting-list-card-rating .material-symbols-outlined {
    font-size: 0.875rem;
}

.dnvoting-list-card-rating span:last-child {
    font-size: 0.875rem;
    font-weight: 700;
}

.dnvoting-list-card-description {
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0 0 1.5rem 0;
    max-width: 42rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dnvoting-list-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1.5rem;
    border-top: 1px solid #f1f5f9;
    margin-top: auto;
}

.dnvoting-list-card-votes {
    display: flex;
    flex-direction: column;
}

.dnvoting-list-card-votes-label {
    font-size: 0.625rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.dnvoting-list-card-votes-count {
    font-size: 1.5rem;
    font-weight: 900;
    color: #1a3a5f;
}

.dnvoting-list-card-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dnvoting-list-card-heart {
    width: 3rem;
    height: 3rem;
    background: #f1f5f9;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.dnvoting-list-card-heart:hover {
    background: #fef2f2;
    color: #ef4444;
}

.dnvoting-list-card-heart .material-symbols-outlined {
    font-size: 1.25rem;
    font-variation-settings: 'FILL' 0;
}

.dnvoting-list-card-heart.voted {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.dnvoting-list-card-heart.voted .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

.dnvoting-list-card-vote-btn {
    background: #1a3a5f;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.dnvoting-list-card-vote-btn:hover {
    box-shadow: 0 10px 25px -5px rgba(26, 58, 95, 0.3);
    transform: translateY(-2px);
}

/* Pagination */
.dnvoting-pagination-section {
    margin-top: 5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.dnvoting-load-more-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #1a3a5f;
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 1.125rem;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 25px -5px rgba(26, 58, 95, 0.2);
}

.dnvoting-load-more-btn:hover {
    box-shadow: 0 20px 25px -5px rgba(26, 58, 95, 0.3);
    transform: translateY(-2px);
    border-color: rgba(245, 158, 11, 0.3);
}

.dnvoting-load-more-btn .material-symbols-outlined {
    font-size: 1.25rem;
}

.dnvoting-load-more-btn.loading .material-symbols-outlined {
    display: none;
}

.dnvoting-loading-spinner {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    width: 1rem;
    height: 1rem;
    animation: spin 1s linear infinite;
    display: none;
}

.dnvoting-load-more-btn.loading .dnvoting-loading-spinner {
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.dnvoting-pagination-stats {
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Loading State */
.dnvoting-posts-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    width: 100%;
    z-index: 10;
}

.dnvoting-posts-loading .dnvoting-loading-spinner {
    display: block;
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top-color: #1a3a5f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* No Results */
.dnvoting-no-results {
    text-align: center;
    padding: 4rem 1rem;
    color: #94a3b8;
}

.dnvoting-no-results .material-symbols-outlined {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.dnvoting-no-results h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #475569;
    margin: 0 0 0.5rem 0;
}

.dnvoting-no-results p {
    font-size: 1rem;
    margin: 0;
}

/* Responsive */
@media (max-width: 640px) {
    .dnvoting-archive-container {
        padding: 2rem 1rem;
    }
    
    .dnvoting-header-content h1 {
        font-size: 2rem;
    }
    
    .dnvoting-filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .dnvoting-category-tabs {
        order: 2;
    }
    
    .dnvoting-sort-select {
        order: 1;
    }
}

/* See More Button */
.dnvoting-category-more-btn {
    padding: 0.625rem 1.5rem;
    border-radius: 9999px;
    background: white;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.dnvoting-category-more-btn:hover {
    border-color: #1a3a5f;
    color: #1a3a5f;
}

.dnvoting-category-more-btn .material-symbols-outlined {
    font-size: 1.25rem;
}

/* Category Modal */
.dnvoting-category-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.dnvoting-category-modal.is-open {
    display: flex;
}

.dnvoting-category-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.dnvoting-category-modal-content {
    position: relative;
    background: white;
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dnvoting-category-modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.dnvoting-category-modal-close:hover {
    background: #e2e8f0;
    color: #1a3a5f;
}

.dnvoting-category-modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.875rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 2rem 0;
    text-align: center;
}

.dnvoting-category-modal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .dnvoting-category-modal-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .dnvoting-category-modal-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .dnvoting-category-modal-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.dnvoting-category-modal-item {
    padding: 1.5rem;
    border-radius: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.dnvoting-category-modal-item:hover {
    background: white;
    border-color: #1a3a5f;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.dnvoting-category-modal-item-name {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.dnvoting-category-modal-item-count {
    font-size: 0.875rem;
    color: #64748b;
}
