/* Modern Dashboard CSS */
:root {
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --green-100: #dcfce7;
    --green-400: #4ade80;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --orange-100: #fed7aa;
    --orange-400: #fb923c;
    --orange-500: #f97316;
    --red-100: #fee2e2;
    --red-400: #f87171;
    --red-500: #ef4444;
    --blue-100: #dbeafe;
    --blue-400: #60a5fa;
    --blue-500: #3b82f6;
    --purple-100: #f3e8ff;
    --purple-400: #a855f7;
    --purple-500: #9333ea;
    --pink-100: #fce7f3;
    --pink-400: #f472b6;
    --pink-500: #ec4899;
    --yellow-100: #fef3c7;
    --yellow-400: #fbbf24;
    --yellow-500: #f59e0b;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: var(--gray-900);
    line-height: 1.5;
    font-feature-settings: 'cv11', 'ss01';
    font-variation-settings: 'opsz' 32;
    min-height: 100vh;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* Header Logo */
.header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    animation: fadeInUp 0.6s ease-out;
}

.logo-icon {
    width: 36px;
    height: 36px;
    color: white;
    stroke-width: 2.5;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    letter-spacing: -0.025em;
}

.header-subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 1.1rem;
    font-weight: 400;
    margin-top: 0.5rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.header-info {
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.15);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #22c55e;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
}

.last-sync {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.15);
}

.refresh-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    padding: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: rotate(180deg) scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.refresh-btn i {
    width: 18px;
    height: 18px;
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.05);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0,0,0);
    }
    40%, 43% {
        transform: translate3d(0, -5px, 0);
    }
    70% {
        transform: translate3d(0, -3px, 0);
    }
    90% {
        transform: translate3d(0, -1px, 0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    width: 100%;
}

.main-content.full-width {
    margin-left: 0;
    max-width: 100vw;
}

/* Header */
.header {
    margin-bottom: 3rem;
    background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 50%, #2563eb 100%);
    border-radius: var(--border-radius-xl);
    padding: 3rem 2.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.05) 100%);
    pointer-events: none;
}

.header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    z-index: 2;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
}



.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}



.last-sync i {
    width: 16px;
    height: 16px;
}



/* Stats Section */
.stats-section {
    margin-bottom: 3rem;
    position: relative;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.stats-grid .stat-card:nth-child(1) { animation-delay: 0.1s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.2s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.3s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gray-300), var(--gray-200));
    transition: all 0.3s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-8px) scale(1.02);
}

.stat-card:hover::before {
    background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
}

.stat-card.primary {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    position: relative;
    overflow: hidden;
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, var(--green-500), var(--green-600));
    color: white;
    border: none;
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    border: none;
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, var(--purple-500), var(--pink-500));
    color: white;
    border: none;
}

.stat-card.primary::before {
    background: linear-gradient(90deg, rgba(255,255,255,0.3), rgba(255,255,255,0.1));
}

.stat-card.primary::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

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

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius-lg);
    background-color: var(--gray-100);
    transition: all 0.3s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-card.primary .stat-icon,
.stat-card:nth-child(2) .stat-icon,
.stat-card:nth-child(3) .stat-icon,
.stat-card:nth-child(4) .stat-icon {
    background-color: rgba(255, 255, 255, 0.2);
}

.stat-icon i {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.stat-card.primary .stat-icon i,
.stat-card:nth-child(2) .stat-icon i,
.stat-card:nth-child(3) .stat-icon i,
.stat-card:nth-child(4) .stat-icon i {
    color: white;
}

.stat-trend i {
    width: 20px;
    height: 20px;
    color: var(--green-500);
}

.stat-card.primary .stat-trend i {
    color: rgba(255, 255, 255, 0.8);
}

.stat-content h3 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    letter-spacing: -0.025em;
    line-height: 1;
}

.stat-content p {
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.8;
}

.stat-unit {
    font-size: 0.75rem;
    opacity: 0.6;
    font-weight: 400;
}

/* Charts Section */
.charts-section {
    margin-bottom: 2rem;
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.chart-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    min-width: 0; /* Prevent flex items from overflowing */
    transition: all 0.3s ease;
    position: relative;
}

.chart-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.chart-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--blue-500), var(--purple-500), var(--pink-500));
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.chart-header {
    margin-bottom: 1.5rem;
}

.chart-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.chart-header p {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.chart-body {
    position: relative;
    height: 300px;
    overflow: hidden;
    padding: 0.5rem;
}

.chart-body canvas {
    max-height: 100% !important;
    width: 100% !important;
}

/* Heatmap */
.heatmap-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12px, 1fr));
    gap: 2px;
    margin-bottom: 1rem;
    max-width: 100%;
    padding: 0.5rem;
    justify-content: stretch;
    min-height: 120px;
    overflow: visible;
}

/* Desktop heatmap layout */
@media (min-width: 769px) {
    .heatmap-container {
        display: grid;
        grid-template-columns: repeat(13, 1fr);
        grid-template-rows: repeat(7, 1fr);
        gap: 4px;
        max-width: 100%;
        justify-content: stretch;
        align-content: stretch;
        height: 180px;
        overflow: visible;
        padding: 1rem;
    }
    
    .heatmap-day {
        width: 100%;
        height: 100%;
        min-width: 18px;
        min-height: 18px;
        aspect-ratio: 1;
    }
}

.heatmap-day {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    background-color: #ebedf0;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
}

.heatmap-day:hover {
    transform: scale(1.1) rotate(2deg);
    z-index: 1;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.heatmap-day.level-1 { 
    background-color: #c6e48b;
    box-shadow: 0 1px 2px rgba(34, 197, 94, 0.1);
}
.heatmap-day.level-2 { 
    background-color: #7bc96f;
    box-shadow: 0 1px 2px rgba(34, 197, 94, 0.2);
}
.heatmap-day.level-3 { 
    background-color: #239a3b;
    box-shadow: 0 1px 2px rgba(34, 197, 94, 0.3);
}
.heatmap-day.level-4 { 
    background-color: #196127;
    box-shadow: 0 1px 2px rgba(34, 197, 94, 0.4);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.legend-scale {
    display: flex;
    gap: 2px;
}

.legend-day {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-day.level-0 { background-color: #ebedf0; }
.legend-day.level-1 { background-color: #c6e48b; }
.legend-day.level-2 { background-color: #7bc96f; }
.legend-day.level-3 { background-color: #239a3b; }
.legend-day.level-4 { background-color: #196127; }

/* Activity Section */
.activity-section {
    margin-bottom: 2rem;
}

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

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
}

.section-header p {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.view-all-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-all-btn:hover {
    background-color: var(--gray-50);
    border-color: var(--gray-400);
}

.view-all-btn i {
    width: 16px;
    height: 16px;
}

.activity-feed {
    background: white;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.activity-feed:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    transition: background-color 0.2s ease;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background-color: var(--gray-50);
}

.activity-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, var(--green-100), var(--blue-100));
    color: var(--green-600);
    transition: all 0.3s ease;
}

.activity-item:nth-child(odd) .activity-icon {
    background: linear-gradient(135deg, var(--purple-100), var(--pink-100));
    color: var(--purple-600);
}

.activity-item:nth-child(even) .activity-icon {
    background: linear-gradient(135deg, var(--blue-100), var(--green-100));
    color: var(--blue-600);
}

.activity-item:hover .activity-icon {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.activity-icon i {
    width: 20px;
    height: 20px;
}

.activity-content {
    flex: 1;
}

.activity-content h4 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.activity-content p {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* Milestones Section */
.milestones-section {
    margin-bottom: 2rem;
}

.milestones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.milestone {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    text-align: center;
    border: 2px solid var(--gray-200);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.milestone:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.milestone.achieved {
    border-color: var(--green-500);
    background: linear-gradient(135deg, var(--green-50), white);
}

.milestone.achieved::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--green-400), var(--green-600));
}

.milestone-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.milestone.achieved .milestone-icon {
    filter: hue-rotate(0deg);
}

.milestone-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.milestone-progress {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.milestone.achieved .milestone-progress {
    color: var(--green-600);
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
        overflow-x: hidden;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chart-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chart-card {
        padding: 1rem;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .heatmap-container {
        display: flex;
        flex-wrap: wrap;
        gap: 2px;
        padding: 0.5rem;
        justify-content: center;
        max-width: 100%;
        overflow: hidden;
    }
    
    .heatmap-day {
        width: 12px;
        height: 12px;
        min-width: 12px;
        min-height: 12px;
        flex-shrink: 0;
    }
    
    .chart-body {
        height: 220px;
        padding: 0.25rem;
        width: 100%;
        overflow: hidden;
    }
    
    .chart-header h3 {
        font-size: 1rem;
    }
    
    .chart-header p {
        font-size: 0.75rem;
    }
    
    .heatmap-legend {
        font-size: 0.625rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .legend-day {
        width: 10px;
        height: 10px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .main-content {
        padding: 1rem;
    }
    
    .header {
        padding: 2rem 1.5rem;
        margin-bottom: 2rem;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1.5rem;
        align-items: flex-start;
    }
    
    .header-actions {
        flex-direction: row;
        align-items: center;
        width: 100%;
        justify-content: space-between;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-content h3 {
        font-size: 1.75rem;
    }
    
    .chart-card {
        padding: 0.75rem;
    }
    
    .heatmap-container {
        gap: 1px;
        padding: 0.25rem;
    }
    
    .heatmap-day {
        width: 10px;
        height: 10px;
        min-width: 10px;
        min-height: 10px;
    }
    
    .chart-body {
        height: 180px;
    }
    
    .activity-item {
        padding: 0.75rem 1rem;
    }
    
    .milestone {
        padding: 1rem;
    }
}

/* Loading States */
.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* GitHub Pages compatibility - ensure all animations work */
@media (prefers-reduced-motion: no-preference) {
    .bounce-on-load {
        animation: bounce 1s ease-in-out;
    }
    
    .success-pulse {
        animation: pulse 0.6s ease-in-out;
    }
}

/* Ensure GitHub Pages compatibility */
.github-pages-ready {
    /* All CSS is using standard properties compatible with GitHub Pages */
    /* No dynamic imports or server-side processing required */
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: var(--gray-800);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 20;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

/* Success animations */
.success-pulse {
    animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}