/**
 * Achievement Matrix Page Styles
 * Copyright (c) 2025 OptionFlare LLC
 */

/* ===== BASE LAYOUT ===== */
.achievement-matrix-container {
    max-width: 1400px;
    margin: 60px auto 2rem;
    padding: 0 2rem;
    min-height: calc(100vh - 200px);
}

/* ===== HEADER SECTION ===== */
.achievement-header {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.1), rgba(15, 23, 42, 0.8));
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.achievement-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, #22d3ee, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.achievement-subtitle {
    font-size: 1.125rem;
    color: #94a3b8;
    margin: 0 0 1.5rem 0;
}

.user-level-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.level-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.level-number {
    font-size: 2rem;
    font-weight: 800;
    color: #22d3ee;
}

.level-label {
    font-size: 0.875rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.xp-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.xp-current {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fbbf24;
}

.xp-total {
    font-size: 0.875rem;
    color: #94a3b8;
}

/* ===== FILTER SECTION ===== */
.filter-section {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: center;
}

.expand-collapse-btn {
    background: rgba(34, 211, 238, 0.1);
    color: #22d3ee;
    border: 1px solid rgba(34, 211, 238, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.expand-collapse-btn:hover {
    background: rgba(34, 211, 238, 0.2);
    border-color: rgba(34, 211, 238, 0.5);
    transform: translateY(-1px);
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(34, 211, 238, 0.3);
    color: white;
}

.filter-btn.active {
    background: rgba(34, 211, 238, 0.1);
    border-color: #22d3ee;
    color: #22d3ee;
}

.filter-icon {
    font-size: 1rem;
}

/* ===== CATEGORY SECTIONS ===== */
.category-section {
    margin-bottom: 3rem;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-header:hover {
    background: rgba(34, 211, 238, 0.1);
    border-color: rgba(34, 211, 238, 0.3);
    transform: translateX(4px);
}

.category-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.category-icon {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.collapse-icon {
    font-size: 1.25rem;
    color: #22d3ee;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.collapse-icon.collapsed {
    transform: rotate(-90deg);
}

.category-content {
    overflow: hidden;
    transition: all 0.4s ease;
    margin-top: 0;
}

.category-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.category-content.expanded {
    max-height: 2000px;
    opacity: 1;
}

.category-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.category-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.completion-text {
    font-size: 0.875rem;
    color: #22d3ee;
    font-weight: 600;
}

.completion-bar {
    width: 120px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.completion-fill {
    height: 100%;
    background: linear-gradient(90deg, #22d3ee, #3b82f6);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ===== ACHIEVEMENT GRID ===== */
.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ===== ANIMATIONS ===== */
@keyframes sparkle {
    0%, 100% { 
        opacity: 0.8; 
        transform: scale(1); 
    }
    50% { 
        opacity: 1; 
        transform: scale(1.1); 
    }
}

@keyframes glow {
    0%, 100% { 
        box-shadow: 0 4px 15px rgba(34, 211, 238, 0.1); 
    }
    50% { 
        box-shadow: 0 4px 20px rgba(34, 211, 238, 0.2); 
    }
}

/* ===== ACHIEVEMENT CARDS ===== */
.achievement-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.achievement-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--tier-color);
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.achievement-card:hover::before {
    opacity: 1;
}

.achievement-card.unlocked {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.08), rgba(59, 130, 246, 0.05));
    border-color: rgba(34, 211, 238, 0.4);
    box-shadow: 0 4px 15px rgba(34, 211, 238, 0.1);
    position: relative;
}

.achievement-card.unlocked::before {
    opacity: 1;
    background: linear-gradient(90deg, #22d3ee, #3b82f6);
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}

.achievement-card.unlocked::after {
    content: '✨';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 1rem;
    opacity: 0.8;
    pointer-events: none;
    animation: sparkle 2s ease-in-out infinite;
}

.achievement-card.unlocked:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(34, 211, 238, 0.2);
    border-color: rgba(34, 211, 238, 0.6);
}

.achievement-card.locked {
    opacity: 1;
    filter: none;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    position: relative;
}

.achievement-card.locked .achievement-title {
    color: #f1f5f9;
    font-weight: 700;
}

.achievement-card.locked .achievement-description {
    color: #cbd5e1;
}

.achievement-card.locked .achievement-xp {
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.achievement-card.locked .achievement-icon {
    opacity: 0.8;
    filter: sepia(0.3);
}

.achievement-card.locked::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
    opacity: 0.6;
}

.achievement-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 1rem;
    opacity: 0.7;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.achievement-card.locked:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.achievement-card.locked:hover .achievement-title {
    color: white;
}

.achievement-card.locked:hover .achievement-description {
    color: #e2e8f0;
}

.achievement-card.locked:hover::after {
    opacity: 0.9;
    background: rgba(0, 0, 0, 0.5);
}

.achievement-card.almost-there {
    border-color: #fbbf24;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(255, 255, 255, 0.05));
    animation: glow 2s ease-in-out infinite;
}

.achievement-card.almost-there::before {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
}

.achievement-card.almost-there::after {
    content: '⚡';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 1rem;
    opacity: 0.9;
    pointer-events: none;
    animation: sparkle 1.5s ease-in-out infinite;
    background: rgba(251, 191, 36, 0.2);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}


.achievement-card.hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.achievement-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.achievement-icon {
    font-size: 2rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.achievement-card.unlocked .achievement-icon {
    background: rgba(34, 211, 238, 0.2);
}

.achievement-xp {
    background: var(--tier-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.achievement-content {
    margin-bottom: 1rem;
}

.achievement-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
    margin: 0 0 0.5rem 0;
}

.achievement-description {
    font-size: 0.875rem;
    color: #94a3b8;
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

.achievement-unlocked {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(34, 211, 238, 0.1);
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(34, 211, 238, 0.3);
}

.unlock-icon {
    color: #22d3ee;
    font-weight: 700;
    font-size: 1rem;
}

.unlock-date {
    font-size: 0.75rem;
    color: #22d3ee;
    font-weight: 600;
}

.achievement-progress {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-info {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--tier-color), #22d3ee);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 6px rgba(34, 211, 238, 0.3);
}

.achievement-card.locked .progress-bar {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.05);
}

.achievement-card.locked .progress-fill {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.5));
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.2);
}

.achievement-footer {
    display: flex;
    justify-content: flex-end;
}

.achievement-tier {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.achievement-tier.common {
    background: rgba(167, 139, 250, 0.2);
    color: #a78bfa;
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.achievement-tier.uncommon {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.achievement-tier.rare {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.achievement-tier.epic {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.achievement-tier.legendary {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(251, 191, 36, 0.2));
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    position: relative;
    overflow: hidden;
}

.achievement-tier.legendary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: legendary-shine 2s infinite;
}

@keyframes legendary-shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ===== LOADING STATES ===== */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    flex-direction: column;
    gap: 1rem;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(34, 211, 238, 0.3);
    border-top: 3px solid #22d3ee;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #94a3b8;
    font-size: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    color: #ef4444;
}

.error-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.error-message {
    color: #94a3b8;
    font-size: 1rem;
    max-width: 400px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .achievement-matrix-container {
        padding: 0 1rem;
    }
    
    .achievement-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }
    
    .user-level-info {
        gap: 1rem;
    }
    
    .category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .category-stats {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .achievement-matrix-container {
        margin-top: 80px;
        padding: 0 1rem;
    }
    
    .achievement-header {
        padding: 1.5rem;
    }
    
    .achievement-title {
        font-size: 2rem;
    }
    
    .achievement-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .filter-section {
        gap: 0.5rem;
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .user-level-info {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .level-display,
    .xp-display {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 480px) {
    .achievement-card {
        padding: 1rem;
    }
    
    .achievement-icon {
        font-size: 1.5rem;
        width: 40px;
        height: 40px;
    }
    
    .achievement-title {
        font-size: 1rem;
    }
    
    .achievement-description {
        font-size: 0.8rem;
    }
    
    .category-title {
        font-size: 1.25rem;
    }
    
    .completion-bar {
        width: 80px;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .achievement-card,
    .completion-fill,
    .progress-fill,
    .loading-spinner,
    .legendary-shine {
        transition: none;
        animation: none;
    }
}

.achievement-card:focus-within {
    outline: 2px solid #22d3ee;
    outline-offset: 2px;
}

.filter-btn:focus {
    outline: 2px solid #22d3ee;
    outline-offset: 2px;
}

/* ===== PRINT STYLES ===== */
@media print {
    .achievement-matrix-container {
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .achievement-header,
    .filter-section {
        display: none;
    }
    
    .achievement-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
        background: white;
        color: black;
    }
    
    .achievement-card.locked {
        opacity: 1;
        filter: none;
    }
}
