/**
 * Custom Post Types Styling
 * Author: Nguyễn Thiệu Toàn
 * Version: 1.0.0
 */

/* ========================================
   Archive Template Styles
======================================== */

/* Hero Section */
.cpt-archive-hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: #fff;
    padding: 80px 0 60px;
    position: relative;
    overflow: hidden;
}

.cpt-archive-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" r="2" fill="rgba(255,255,255,0.05)"/></svg>');
    opacity: 0.5;
}

.cpt-archive-hero .container {
    position: relative;
    z-index: 1;
}

.cpt-archive-title {
    font-size: 3rem;
    font-weight: 800;
    margin: 0 0 1rem;
    line-height: 1.2;
}

.cpt-archive-description {
    font-size: 1.25rem;
    opacity: 0.95;
    max-width: 700px;
    margin: 0 0 2rem;
}

.cpt-stats {
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stat-item svg {
    opacity: 0.8;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.8;
    display: block;
}

/* Filter Controls */
.cpt-filters {
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin: -30px auto 3rem;
    max-width: 1200px;
    position: relative;
    z-index: 2;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-group label {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.875rem;
}

.filter-group select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #1e293b;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-group select:hover {
    border-color: #3b82f6;
}

.filter-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.view-btn {
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.view-btn:hover {
    background: #f8fafc;
    color: #3b82f6;
}

.view-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

/* Grid Layout */
.cpt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.cpt-grid.list-view {
    grid-template-columns: 1fr;
}

/* Card Styles */
.cpt-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cpt-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.cpt-grid.list-view .cpt-card {
    flex-direction: row;
}

.cpt-card-image {
    position: relative;
    padding-top: 56.25%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
}

.cpt-grid.list-view .cpt-card-image {
    padding-top: 0;
    width: 300px;
    min-height: 200px;
}

.cpt-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.cpt-card:hover .cpt-card-image img {
    transform: scale(1.05);
}

.status-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.status-badge.live {
    background: rgba(34, 197, 94, 0.9);
    color: #fff;
}

.status-badge.beta {
    background: rgba(234, 179, 8, 0.9);
    color: #fff;
}

.status-badge.development {
    background: rgba(59, 130, 246, 0.9);
    color: #fff;
}

.status-badge.archived {
    background: rgba(148, 163, 184, 0.9);
    color: #fff;
}

.cpt-card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cpt-card-categories {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.category-badge {
    padding: 0.25rem 0.75rem;
    background: #eff6ff;
    color: #3b82f6;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.category-badge:hover {
    background: #3b82f6;
    color: #fff;
}

.cpt-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
    line-height: 1.3;
}

.cpt-card-title a {
    color: #1e293b;
    text-decoration: none;
    transition: color 0.2s;
}

.cpt-card-title a:hover {
    color: #3b82f6;
}

.cpt-card-excerpt {
    color: #64748b;
    line-height: 1.6;
    margin: 0 0 1rem;
    flex: 1;
}

.cpt-card-tech {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tech-badge {
    padding: 0.25rem 0.625rem;
    background: #f1f5f9;
    color: #475569;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

.cpt-card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.875rem;
    color: #64748b;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.cpt-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: #3b82f6;
    color: #fff;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

/* Pagination */
.cpt-pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 3rem 0;
}

.cpt-pagination a,
.cpt-pagination span {
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.cpt-pagination a:hover {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.cpt-pagination .current {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

/* ========================================
   Single Template Styles
======================================== */

.cpt-single-hero {
    background-size: cover;
    background-position: center;
    color: #fff;
    padding: 100px 0 60px;
    position: relative;
}

.cpt-single-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.95), rgba(59, 130, 246, 0.9));
}

.cpt-single-hero .container {
    position: relative;
    z-index: 1;
}

.cpt-single-hero-content {
    max-width: 900px;
}

.cpt-categories {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.cpt-single-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 1.5rem;
}

.cpt-single-excerpt {
    font-size: 1.25rem;
    line-height: 1.6;
    opacity: 0.95;
    margin-bottom: 2rem;
}

.cpt-single-meta {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.cpt-single-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.cpt-single-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 4rem 1rem;
}

.cpt-single-content {
    background: #fff;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 3rem;
    line-height: 1.8;
}

.cpt-single-content h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 2rem;
    font-weight: 700;
}

.cpt-single-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.cpt-single-content p {
    margin-bottom: 1rem;
}

.cpt-single-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

/* Tech Stack Section */
.cpt-tech-section {
    background: #fff;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 3rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
    color: #1e293b;
}

.tech-stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.tech-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.tech-item:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    transform: translateY(-2px);
}

.tech-icon {
    font-size: 1.5rem;
}

.tech-name {
    font-weight: 600;
    color: #475569;
}

/* Related Section */
.cpt-related-section {
    background: #fff;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.cpt-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.cpt-related-card {
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
}

.cpt-related-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.cpt-related-card a {
    text-decoration: none;
    color: inherit;
}

.cpt-related-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.cpt-related-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem;
    padding: 0 1rem;
}

.cpt-related-card p {
    color: #64748b;
    font-size: 0.875rem;
    padding: 0 1rem 1rem;
    margin: 0;
}

/* ========================================
   Responsive Design
======================================== */

@media (max-width: 768px) {
    .cpt-archive-title,
    .cpt-single-title {
        font-size: 2rem;
    }
    
    .cpt-archive-description,
    .cpt-single-excerpt {
        font-size: 1rem;
    }
    
    .cpt-stats {
        gap: 1.5rem;
    }
    
    .cpt-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .view-toggle {
        margin-left: 0;
        justify-content: center;
    }
    
    .cpt-grid {
        grid-template-columns: 1fr;
    }
    
    .cpt-grid.list-view .cpt-card {
        flex-direction: column;
    }
    
    .cpt-grid.list-view .cpt-card-image {
        width: 100%;
        padding-top: 56.25%;
    }
    
    .cpt-single-content {
        padding: 1.5rem;
    }
    
    .tech-stack-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .cpt-related-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Loading & Animations
======================================== */

.cpt-loading {
    text-align: center;
    padding: 3rem;
}

.cpt-loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Empty State */
.cpt-empty {
    text-align: center;
    padding: 4rem 2rem;
    background: #f8fafc;
    border-radius: 12px;
}

.cpt-empty svg {
    width: 80px;
    height: 80px;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.cpt-empty h3 {
    font-size: 1.5rem;
    color: #475569;
    margin-bottom: 0.5rem;
}

.cpt-empty p {
    color: #64748b;
}
