/**
 * JigsawStation Reusable Components
 * Button, card, modal, and other shared UI components
 */

/* ==========================================================================
   Buttons
   ========================================================================== */

.category-btn {
    padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 3);
    background: var(--white);
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.category-btn:hover {
    color: var(--slate-900);
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.category-btn.active {
    color: white;
    background: var(--cyan-600);
    border-color: var(--cyan-600);
}

/* ==========================================================================
   Cards - Puzzle Items
   ========================================================================== */

.puzzle-item {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
    border: 1px solid var(--gray-200);
}

.puzzle-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gray-300);
}

.puzzle-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 75%; /* 4:3 aspect ratio - more compact */
    overflow: hidden;
    background: var(--gray-100);
}

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

.puzzle-item:hover .puzzle-image {
    transform: scale(1.03);
}

/* Puzzle Card Info */
.puzzle-info {
    padding: calc(var(--spacing-unit) * 1.5);
}

.puzzle-name {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--slate-900);
    margin-bottom: calc(var(--spacing-unit) * 0.5);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.puzzle-category {
    font-size: 12px;
    color: var(--gray-600);
    text-transform: capitalize;
    font-weight: 500;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.featured-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
}

/* ==========================================================================
   Overlays - Glass-morphism Play Overlay
   ========================================================================== */

.play-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.puzzle-item:hover .play-overlay {
    opacity: 1;
}

.play-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

.puzzle-item:hover .play-btn {
    transform: scale(1.05);
}

.play-icon {
    width: 24px;
    height: 24px;
    fill: var(--cyan-600);
    margin-left: 2px;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--cyan-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Empty State
   ========================================================================== */

.empty-state {
    text-align: center;
    padding: calc(var(--spacing-unit) * 12) calc(var(--spacing-unit) * 4);
    color: var(--gray-600);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: calc(var(--spacing-unit) * 3);
    opacity: 0.2;
    fill: var(--gray-600);
}

.empty-state p {
    font-size: 16px;
}

/* ==========================================================================
   Stats Bar
   ========================================================================== */

.stats-bar {
    display: flex;
    gap: calc(var(--spacing-unit) * 3);
    padding: calc(var(--spacing-unit) * 1) 0;
    font-size: 13px;
    color: var(--gray-600);
}

.stat {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 1);
}

.stat strong {
    color: var(--slate-900);
    font-weight: 600;
    font-family: var(--font-display);
}

/* ==========================================================================
   Breadcrumb Navigation
   ========================================================================== */

.breadcrumb {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.breadcrumb a {
    color: var(--gray-600);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--cyan-600);
}

.breadcrumb-separator {
    margin: 0 calc(var(--spacing-unit) * 1);
    opacity: 0.5;
}

/* ==========================================================================
   Category Hero Section
   ========================================================================== */

.category-hero {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    padding: calc(var(--spacing-unit) * 6) 0;
    margin-bottom: calc(var(--spacing-unit) * 4);
}

.category-hero-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 calc(var(--spacing-unit) * 3);
}

.category-title {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    color: var(--slate-900);
    letter-spacing: -0.02em;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.category-description {
    font-size: 16px;
    color: var(--gray-700);
    max-width: 700px;
    line-height: 1.7;
}

/* ==========================================================================
   Difficulty Filter
   ========================================================================== */

.difficulty-filter-section {
    margin-bottom: calc(var(--spacing-unit) * 4);
}

.filter-label {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--slate-900);
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.difficulty-filter {
    display: flex;
    gap: calc(var(--spacing-unit) * 1.5);
    flex-wrap: wrap;
    align-items: center;
}

.difficulty-btn {
    padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 3);
    background: var(--white);
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.difficulty-btn:hover {
    color: var(--slate-900);
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.difficulty-btn.active {
    color: white;
    background: var(--cyan-600);
    border-color: var(--cyan-600);
}

/* ==========================================================================
   Stats Section (Category Page)
   ========================================================================== */

.stats-section {
    display: flex;
    gap: calc(var(--spacing-unit) * 4);
    padding: calc(var(--spacing-unit) * 2) 0;
    margin-bottom: calc(var(--spacing-unit) * 3);
    font-size: 14px;
    color: var(--gray-600);
}

.stats-section .stat strong {
    color: var(--slate-900);
    font-weight: 600;
    font-family: var(--font-display);
    font-size: 24px;
}

/* ==========================================================================
   Responsive Component Adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .category-btn {
        flex-shrink: 0;
        font-size: 13px;
        padding: calc(var(--spacing-unit) * 1.25) calc(var(--spacing-unit) * 2.5);
    }

    .puzzle-name {
        font-size: 13px;
    }

    .puzzle-category {
        font-size: 11px;
    }

    .category-hero {
        padding: calc(var(--spacing-unit) * 4) 0;
    }

    .category-title {
        font-size: 28px;
    }

    .category-description {
        font-size: 14px;
    }

    .difficulty-filter {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: calc(var(--spacing-unit) * 1);
    }

    .difficulty-filter::-webkit-scrollbar {
        display: none;
    }

    .difficulty-btn {
        flex-shrink: 0;
        font-size: 13px;
        padding: calc(var(--spacing-unit) * 1.25) calc(var(--spacing-unit) * 2.5);
    }
}
