:root {
    /* Color Palette - Standardized */
    --color-primary: #6366F1;
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-danger: #EF4444;
    --color-info: #34D399;
    --color-muted: #9CA3AF;
    
    /* Background Colors */
    --color-bg-dark: #0A192F;
    --color-bg-card: #111827;
    --color-bg-tooltip: rgba(17, 24, 39, 0.9);
    
    /* Text Colors */
    --color-text-primary: #FFFFFF;
    --color-text-secondary: #D1D5DB;
    --color-text-muted: #9CA3AF;
    
    /* Border and Grid Colors */
    --color-border: #374151;
    --color-grid: #374151;
}

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--color-bg-dark);
    min-height: 100vh;
    padding: 20px;
    color: var(--color-text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
}

header {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    text-align: center;
    position: relative;
}

.stale-data-banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px;
    border-radius: 16px 16px 0 0;
    font-weight: 600;
    font-size: 0.875rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stale-data-banner.stale {
    background-color: var(--color-warning);
    color: var(--color-text-primary);
}

.stale-data-banner.very-stale {
    background-color: var(--color-danger);
    color: var(--color-text-primary);
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #6366F1, #34D399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--color-text-secondary);
    font-size: 1.125rem;
    margin-bottom: 24px;
}

.portfolio-badge {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.5);
    border-radius: 9999px;
    color: var(--color-primary);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.portfolio-note {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    padding: 16px;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-top: 16px;
    text-align: left;
}

.portfolio-note strong {
    display: block;
    color: var(--color-primary);
    margin-bottom: 8px;
    font-weight: 600;
}

.status-bar {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.status-item {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-secondary);
}

.status-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-info);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-item .dot.warning {
    background: #F59E0B;
}

.status-item .dot.error {
    background: #EF4444;
}

.tech-stack {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
}

.tech-stack h3 {
    color: var(--color-text-primary);
    margin-bottom: 16px;
    font-size: 1.25rem;
    font-weight: 600;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tech-tag {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.5);
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 600;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

/* Side-by-side card container for better alignment */
.side-by-side-container {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 0;
}

.card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

/* Ensure side-by-side cards have equal heights */
.side-by-side-container > .card {
    height: 100%;
    min-height: 450px;
}

/* Full-width cards */
.card.full-width {
    grid-column: 1 / -1;
}

/* Enhanced card styling for better visual appeal */
.side-by-side-container > .card {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.side-by-side-container > .card:hover {
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

/* Chart container improvements */
.chart-container {
    position: relative;
    width: 100%;
    margin-top: 16px;
}


.card h2 {
    color: var(--color-text-primary);
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}

/* Tooltip Styles */
.tooltip-container {
    position: relative;
    display: inline-block;
    margin-left: 8px;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.5);
    border-radius: 50%;
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: help;
    transition: all 0.2s ease;
}

.tooltip-icon:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: var(--color-primary);
    transform: scale(1.1);
}

.tooltip-content {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    width: 320px;
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 12px;
    padding: 16px;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.tooltip-container:hover .tooltip-content {
    opacity: 1;
    pointer-events: auto;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1F2937;
}

.tooltip-title {
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 8px;
    font-size: 0.9375rem;
}

.tooltip-section {
    margin-bottom: 12px;
}

.tooltip-section:last-child {
    margin-bottom: 0;
}

.tooltip-section-label {
    font-weight: 600;
    color: var(--color-primary);
    font-size: 0.8125rem;
    margin-bottom: 4px;
}

.tooltip-section-content {
    color: #9CA3AF;
    font-size: 0.8125rem;
}

.card h3 {
    color: var(--color-text-secondary);
    margin-bottom: 12px;
    font-size: 1rem;
    font-weight: 600;
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #374151;
}

.metric:last-child {
    border-bottom: none;
}

.metric-label {
    color: #9CA3AF;
    font-size: 0.875rem;
}

.metric-value {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text-primary);
}

.metric-value.workout-type {
    color: var(--color-primary);
}

.progress-bar {
    width: 100%;
    height: 32px;
    background: #374151;
    border-radius: 16px;
    overflow: hidden;
    margin: 16px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #6366F1, #34D399);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.workout-list {
    list-style: none;
}

.workout-item {
    padding: 12px;
    margin: 8px 0;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.workout-item:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--color-primary);
}

.workout-item.today {
    background: rgba(52, 211, 153, 0.2);
    border-color: #34D399;
    font-weight: 600;
}

.workout-type {
    font-weight: 600;
    color: var(--color-primary);
    font-size: 0.875rem;
}

.workout-details {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
    margin-top: 20px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--color-text-muted);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
}

.loading::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading::after {
    content: 'Loading...';
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

/* Skeleton Loader (per spec) */
.skeleton-loader {
    background: linear-gradient(90deg, #1F2937 25%, #374151 50%, #1F2937 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: 8px;
    min-height: 200px;
}

.skeleton-loader.chart {
    height: 300px;
}

.skeleton-loader.text {
    height: 20px;
    margin-bottom: 12px;
}

.skeleton-loader.text:last-child {
    width: 60%;
}

@keyframes skeleton-pulse {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Traffic Light Component Styles */
.traffic-light {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    border: 3px solid;
    transition: all 0.3s ease;
}

.status-green {
    background: #10B981;
    border-color: #34D399;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    color: var(--color-text-primary);
}

.status-amber {
    background: #F59E0B;
    border-color: #FBBF24;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
    color: var(--color-text-primary);
}

.status-red {
    background: #EF4444;
    border-color: #F87171;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
    color: var(--color-text-primary);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
    }
    50% { 
        box-shadow: 0 0 30px rgba(239, 68, 68, 0.8);
    }
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #EF4444;
    padding: 16px;
    border-radius: 8px;
    margin: 10px 0;
}

.refresh-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: linear-gradient(135deg, #6366F1, #34D399);
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.5);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.6);
}

.refresh-btn:active {
    transform: translateY(0);
}

/* Mobile Breakpoints */
/* Small phones (320px - 374px) */
@media (max-width: 374px) {
    body {
        padding: 12px;
        font-size: 0.875rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    header {
        padding: 16px;
    }

    .card {
        padding: 16px;
        border-radius: 12px;
    }

    .tooltip-content {
        width: calc(100vw - 32px);
        max-width: 280px;
        font-size: 0.75rem;
        padding: 12px;
    }

    .refresh-btn {
        bottom: 16px;
        right: 16px;
        padding: 10px 16px;
        font-size: 0.6875rem;
    }

    .chart-container {
        height: 250px !important;
    }

    .metric {
        padding: 8px 0;
        font-size: 0.8125rem;
    }

    .status-bar {
        flex-direction: column;
        gap: 8px;
    }
}

/* Standard phones (375px - 413px) */
@media (min-width: 375px) and (max-width: 413px) {
    body {
        padding: 14px;
    }

    h1 {
        font-size: 1.75rem;
    }

    header {
        padding: 20px;
    }

    .card {
        padding: 18px;
    }

    .tooltip-content {
        width: 300px;
        font-size: 0.8125rem;
    }

    .chart-container {
        height: 280px !important;
    }
}

/* Large phones (414px - 767px) */
@media (min-width: 414px) and (max-width: 767px) {
    body {
        padding: 16px;
    }

    h1 {
        font-size: 2rem;
    }

    header {
        padding: 24px;
    }

    .card {
        padding: 20px;
    }

    .tooltip-content {
        width: 320px;
    }

    .chart-container {
        height: 300px !important;
    }
}

/* Tablets and small screens (768px and below) */
@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* Stack side-by-side cards on mobile */
    .side-by-side-container {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .side-by-side-container > .card {
        min-height: auto;
    }

    h1 {
        font-size: 2rem;
    }

    header {
        padding: 24px;
    }

    .card {
        padding: 20px;
    }

    .tooltip-content {
        width: 280px;
        font-size: 0.8125rem;
        /* Improve tooltip positioning on mobile */
        left: 50%;
        transform: translateX(-50%);
        margin-bottom: 8px;
    }

    .tooltip-container:hover .tooltip-content {
        /* Ensure tooltip is visible on touch devices */
        opacity: 1;
        pointer-events: auto;
    }

    .refresh-btn {
        bottom: 20px;
        right: 20px;
        padding: 12px 20px;
        font-size: 0.75rem;
    }

    /* Improve touch interactions */
    .card {
        -webkit-tap-highlight-color: rgba(99, 102, 241, 0.1);
    }

    button, .refresh-btn {
        -webkit-tap-highlight-color: rgba(99, 102, 241, 0.2);
        touch-action: manipulation;
    }

    /* Mobile-specific chart adjustments */
    .chart-container {
        height: 300px;
        margin-top: 12px;
    }

    /* Reduce spacing on mobile */
    .metric {
        padding: 10px 0;
    }

    .progress-bar {
        height: 28px;
    }

    /* Improve readability on small screens */
    .subtitle {
        font-size: 1rem;
    }

    .portfolio-note {
        font-size: 0.8125rem;
        padding: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}


