/**
 * Gamified Dashboard Styles
 * Phase 3B: Enhanced Gamified Dashboard - Visual Design
 * Modern, engaging dashboard with gradients and animations
 */

/* Dashboard Layout and Grid */
.gamified-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    padding: 24px;
    min-height: 100vh;
}

/* Section Base Styles */
.dashboard-section {
    background: var(--card-background);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.dashboard-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.dashboard-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 16px 16px 0 0;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.section-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.completion-badge {
    background: linear-gradient(135deg, var(--success-color), #27ae60);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Achievement Overview Styles */
.achievement-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card.primary {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1), rgba(41, 128, 185, 0.1));
    border: 2px solid rgba(52, 152, 219, 0.3);
}

.stat-card.secondary {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.1), rgba(142, 68, 173, 0.1));
    border: 2px solid rgba(155, 89, 182, 0.3);
}

.stat-card.accent {
    background: linear-gradient(135deg, rgba(230, 126, 34, 0.1), rgba(211, 84, 0, 0.1));
    border: 2px solid rgba(230, 126, 34, 0.3);
}

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

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 4px;
}

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

/* Progress Bar Styles */
.progress-bar-container {
    margin-bottom: 24px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 4px;
    transition: width 0.8s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Featured Achievements */
.featured-achievements {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.featured-achievements h4 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.achievement-mini-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.achievement-mini-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.achievement-mini-badge:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(4px);
}

.achievement-mini-badge.almost-earned {
    border-color: var(--accent-color);
    background: rgba(230, 126, 34, 0.1);
}

.badge-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.badge-info {
    flex: 1;
}

.badge-name {
    font-size: 0.9rem;
    font-weight: 600;
    display: block;
}

.badge-date, .badge-progress {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
}

/* Engagement Metrics */
.engagement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.metric-card {
    background: var(--background-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.metric-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
}

.metric-card.streak-card {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(192, 57, 43, 0.1));
    border-color: rgba(231, 76, 60, 0.3);
}

.metric-card.sessions-card {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1), rgba(41, 128, 185, 0.1));
    border-color: rgba(52, 152, 219, 0.3);
}

.metric-card.duration-card {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.1), rgba(39, 174, 96, 0.1));
    border-color: rgba(46, 204, 113, 0.3);
}

.metric-card.record-card {
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.1), rgba(243, 156, 18, 0.1));
    border-color: rgba(241, 196, 15, 0.3);
}

.metric-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

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

.metric-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.metric-status {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.metric-status.active {
    background: rgba(46, 204, 113, 0.2);
    color: var(--success-color);
}

.metric-trend {
    font-size: 0.8rem;
    font-weight: 600;
}

.metric-trend.up {
    color: var(--success-color);
}

.metric-trend.down {
    color: var(--error-color);
}

.metric-comparison, .metric-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Progress Visualization */
.milestones-section, .streak-visualization {
    margin-bottom: 24px;
}

.milestones-section h4, .streak-visualization h4 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.milestones-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.milestone-card:hover {
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.milestone-icon {
    font-size: 2rem;
    width: 48px;
    text-align: center;
}

.milestone-info {
    flex: 1;
}

.milestone-target {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.milestone-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.milestone-progress-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.milestone-remaining {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Streak Calendar */
.streak-calendar {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.streak-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    min-width: 44px;
}

.streak-day.active {
    background: rgba(46, 204, 113, 0.1);
    border: 2px solid rgba(46, 204, 113, 0.3);
}

.streak-day.inactive {
    background: rgba(149, 165, 166, 0.1);
    border: 2px solid rgba(149, 165, 166, 0.3);
}

.day-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.day-indicator {
    font-size: 1.2rem;
}

/* Insights Panel */
.insights-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.insight-card {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.insight-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.insight-card.productivity {
    border-left: 4px solid var(--primary-color);
}

.insight-card.pattern {
    border-left: 4px solid var(--accent-color);
}

.insight-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    width: 32px;
    text-align: center;
}

.insight-content h5 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.insight-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Recommendations */
.recommendations h4 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.recommendation-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.recommendation-card:hover {
    border-color: var(--accent-color);
    background: rgba(230, 126, 34, 0.05);
}

.rec-icon {
    font-size: 1.2rem;
    color: var(--accent-color);
    width: 32px;
    text-align: center;
}

.rec-content {
    flex: 1;
}

.rec-content h6 {
    margin: 0 0 4px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}

.rec-content p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.rec-action {
    padding: 6px 12px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.rec-action:hover {
    background: #d35400;
    transform: translateY(-1px);
}

/* Quick Actions */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn.primary {
    background: var(--primary-color);
    color: white;
}

.action-btn.primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.action-btn.secondary {
    background: var(--background-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.action-btn.secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.action-btn.accent {
    background: var(--accent-color);
    color: white;
}

.action-btn.accent:hover {
    background: #d35400;
    transform: translateY(-2px);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Streak Widget Integration within Gamified Dashboard */
.gamified-dashboard .streak-widget {
    background: var(--card-background);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
    margin-top: 1rem;
}

.gamified-dashboard .streak-widget .streak-header {
    background: linear-gradient(135deg, var(--achievement-gold), var(--achievement-gold-light));
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.gamified-dashboard .streak-widget .streak-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.1) 75%);
    background-size: 20px 20px;
    animation: slideBackground 20s linear infinite;
}

.gamified-dashboard .streak-widget .streak-flame {
    font-size: 2.5rem;
    animation: flicker 2s ease-in-out infinite alternate;
    position: relative;
    z-index: 2;
}

.gamified-dashboard .streak-widget .streak-count {
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
}

.gamified-dashboard .streak-widget .streak-label {
    font-size: 1rem;
    font-weight: 600;
    opacity: 0.9;
    position: relative;
    z-index: 2;
}

.gamified-dashboard .streak-widget .streak-longest {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--background-secondary);
    border-radius: 8px;
}

.gamified-dashboard .streak-widget .streak-calendar {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.gamified-dashboard .streak-widget .streak-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition-fast);
    cursor: default;
    min-width: 50px;
    background: var(--background-tertiary);
}

.gamified-dashboard .streak-widget .streak-day.active {
    background: var(--primary-color-alpha);
    border: 1px solid var(--primary-color);
}

.gamified-dashboard .streak-widget .streak-day.inactive {
    background: var(--background-tertiary);
    border: 1px solid var(--border-color);
}

.gamified-dashboard .streak-widget .day-name {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.gamified-dashboard .streak-widget .day-indicator {
    font-size: 1.2rem;
    line-height: 1;
}

.gamified-dashboard .streak-widget .streak-day.active .day-name {
    color: var(--primary-color);
}

/* Responsive adjustments for streak widget in dashboard */
@media (max-width: 768px) {
    .gamified-dashboard .streak-widget {
        padding: 1rem;
    }
    
    .gamified-dashboard .streak-widget .streak-header {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .gamified-dashboard .streak-widget .streak-flame {
        font-size: 2rem;
    }
    
    .gamified-dashboard .streak-widget .streak-count {
        font-size: 1.5rem;
    }
    
    .gamified-dashboard .streak-widget .streak-calendar {
        gap: 4px;
        padding: 0.5rem;
    }
    
    .gamified-dashboard .streak-widget .streak-day {
        min-width: 40px;
        padding: 6px;
    }
}

@keyframes flicker {
    0%, 100% { transform: scale(1) rotate(-1deg); }
    50% { transform: scale(1.1) rotate(1deg); }
}

@keyframes slideBackground {
    0% { transform: translateX(0); }
    100% { transform: translateX(20px); }
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .gamified-dashboard {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }
    
    .dashboard-section {
        padding: 16px;
    }
    
    .achievement-stats-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .featured-achievements {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .engagement-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .insight-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .streak-calendar {
        gap: 4px;
    }
    
    .streak-day {
        min-width: 36px;
        padding: 6px;
    }
}

@media (max-width: 480px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .completion-badge {
        align-self: flex-end;
    }
    
    .engagement-grid {
        grid-template-columns: 1fr;
    }
    
    .milestone-card {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
}
