/**
 * Achievement System CSS Styles
 * Phase 3A: Gamification Achievement System
 * Requires Font Awesome for icons
 */

/* Achievement Badge Styling */
.achievement-badge {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 16px;
    margin: 8px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-width: 200px;
    max-width: 280px;
}

.achievement-badge:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Earned badge styling */
.achievement-badge.earned {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #4c63d2;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.achievement-badge.earned:hover {
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
}

/* Locked badge styling */
.achievement-badge.locked {
    opacity: 0.6;
    filter: grayscale(70%);
}

.achievement-badge.locked .badge-icon {
    opacity: 0.5;
}

/* Rarity-based styling */
.achievement-badge.rarity-common.earned {
    border-color: #94a3b8;
}

.achievement-badge.rarity-uncommon.earned {
    border-color: #10b981;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.achievement-badge.rarity-rare.earned {
    border-color: #3b82f6;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.achievement-badge.rarity-epic.earned {
    border-color: #8b5cf6;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.achievement-badge.rarity-legendary.earned {
    border-color: #f59e0b;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.6);
    animation: legendaryGlow 2s ease-in-out infinite;
}

/* Legendary glow animation */
@keyframes legendaryGlow {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(245, 158, 11, 0.6);
    }
    50% {
        box-shadow: 0 8px 30px rgba(245, 158, 11, 0.8);
    }
}

/* Badge content layout */
.badge-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.badge-icon-container {
    position: relative;
    margin-bottom: 8px;
}

.badge-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    display: block;
}

.earned-overlay {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border: 2px solid white;
}

.badge-info {
    flex: 1;
    min-height: 0;
}

.badge-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 4px;
    line-height: 1.2;
}

.badge-description {
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.3;
    margin-bottom: 8px;
}

.badge-category {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 8px;
}

.badge-reward {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.achievement-badge.earned .badge-reward {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.badge-earned-date {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 8px;
}

.badge-rarity-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.6rem;
    font-weight: 600;
}

/* Progress bar for almost-earned achievements */
.achievement-progress {
    margin-top: 8px;
    width: 100%;
}

.progress-bar {
    background: rgba(255, 255, 255, 0.3);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 3px;
    transition: width 0.6s ease;
}

.progress-text {
    font-size: 0.7rem;
    opacity: 0.8;
    text-align: center;
}

/* Achievement Notification */
.achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideInFromRight 0.5s ease-out;
    max-width: 300px;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.achievement-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.achievement-info h3 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 600;
}

.achievement-info h4 {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.achievement-info p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Achievement Celebration Modal */
.achievement-celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.achievement-celebration.show {
    opacity: 1;
}

.achievement-celebration.dismissing {
    opacity: 0;
}

.celebration-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.celebration-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 32px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    margin: 20px;
    position: relative;
    z-index: 1;
    animation: celebrationBounce 0.6s ease-out;
}

@keyframes celebrationBounce {
    0% {
        transform: scale(0.3) translateY(-100px);
        opacity: 0;
    }
    50% {
        transform: scale(1.05) translateY(0);
        opacity: 1;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.celebration-title {
    font-size: 1.8rem;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.celebration-badge {
    margin-bottom: 24px;
}

.badge-showcase {
    position: relative;
    display: inline-block;
    margin-bottom: 16px;
}

.showcase-icon {
    font-size: 4rem;
    display: block;
    position: relative;
    z-index: 2;
}

.rarity-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.6;
    animation: rarityPulse 2s ease-in-out infinite;
}

.rarity-glow.rarity-common {
    background: radial-gradient(circle, #94a3b8, transparent);
}

.rarity-glow.rarity-uncommon {
    background: radial-gradient(circle, #10b981, transparent);
}

.rarity-glow.rarity-rare {
    background: radial-gradient(circle, #3b82f6, transparent);
}

.rarity-glow.rarity-epic {
    background: radial-gradient(circle, #8b5cf6, transparent);
}

.rarity-glow.rarity-legendary {
    background: radial-gradient(circle, #f59e0b, transparent);
}

@keyframes rarityPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.3;
    }
}

.achievement-name {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.achievement-description {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 16px;
}

.achievement-rarity {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.rarity-label {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.rarity-stars {
    color: #ffd700;
    font-size: 1.2rem;
}

.celebration-rewards {
    background: rgba(255, 255, 255, 0.1);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.reward-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 600;
}

.celebration-message {
    font-style: italic;
    opacity: 0.9;
    margin-bottom: 24px;
}

.celebration-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.celebration-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.celebration-btn.primary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.celebration-btn.secondary {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.celebration-btn:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.3);
}

/* Celebration Particles */
.celebration-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.celebration-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.confetti-piece {
    position: absolute;
    width: 4px;
    height: 4px;
    pointer-events: none;
}

@keyframes particleFall {
    to {
        left: var(--end-x);
        top: var(--end-y);
        opacity: 0;
        transform: scale(0);
    }
}

@keyframes confettiFall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Achievement Gallery */
.achievements-container {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.achievements-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.achievements-header h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 12px;
}

.achievement-stats {
    font-size: 1.1rem;
    color: #4a5568;
    text-align: right;
}

.earned-count {
    font-weight: 700;
    color: #059669;
}

.total-count {
    font-weight: 600;
}

.progress-percentage {
    font-size: 0.9rem;
    color: #718096;
    margin-top: 4px;
}

.achievement-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.category-filter {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    color: #4a5568;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-filter:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.category-filter.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #4c63d2;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

/* Achievement Details Modal */
.achievement-details-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    margin: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #718096;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #2d3748;
}

.modal-body {
    padding: 24px;
}

.achievement-details {
    margin-bottom: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f7fafc;
}

.detail-label {
    font-weight: 600;
    color: #4a5568;
}

.detail-value {
    color: #2d3748;
    text-align: right;
}

.detail-value.rarity-legendary {
    color: #f59e0b;
    font-weight: 600;
}

.detail-value.rarity-epic {
    color: #8b5cf6;
    font-weight: 600;
}

.detail-value.rarity-rare {
    color: #3b82f6;
    font-weight: 600;
}

.detail-value.rarity-uncommon {
    color: #10b981;
    font-weight: 600;
}

.achievement-hint {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.achievement-hint i {
    color: #0284c7;
    margin-top: 2px;
}

.achievement-hint span {
    color: #0c4a6e;
    line-height: 1.4;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .achievements-grid {
        grid-template-columns: 1fr;
    }
    
    .achievement-badge {
        max-width: none;
        margin: 4px 0;
    }
    
    .achievements-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .achievement-categories {
        justify-content: center;
    }
    
    .category-filter {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .celebration-content {
        margin: 10px;
        padding: 24px;
    }
    
    .celebration-actions {
        flex-direction: column;
    }
    
    .achievement-notification {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .badge-icon {
        font-size: 2rem;
    }
    
    .showcase-icon {
        font-size: 3rem;
    }
    
    .celebration-title {
        font-size: 1.4rem;
    }
    
    .achievement-name {
        font-size: 1.2rem;
    }
}

/* Achievement Gallery Styles */
.achievement-gallery-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.achievement-gallery-header h3 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.achievement-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background: var(--card-background);
    color: var(--text-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.achievement-card {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.achievement-card.unlocked {
    border-color: var(--success-color);
    background: linear-gradient(135deg, var(--card-background) 0%, rgba(46, 160, 67, 0.1) 100%);
}

.achievement-card.locked {
    opacity: 0.7;
    filter: grayscale(0.3);
}

.achievement-card .achievement-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-align: center;
}

.achievement-card .achievement-name {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
}

.achievement-card .achievement-description {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
    line-height: 1.4;
}

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

.achievement-points {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--accent-color);
    font-weight: 600;
}

.achievement-rarity {
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.achievement-unlocked {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--success-color);
    font-weight: 600;
}

.achievement-locked {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Achievement Statistics Styles */
.achievement-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    width: 60px;
    text-align: center;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Mobile Responsive Design for Gallery */
@media (max-width: 768px) {
    .achievement-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .achievement-card {
        padding: 1rem;
    }
    
    .achievement-filter {
        justify-content: center;
    }
    
    .filter-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .achievement-stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        font-size: 2rem;
        width: 50px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}
