/**
 * Mobile Theme - Dark Mobile-First Responsive Design
 * Target: Optimized for mobile viewing with dark professional aesthetics
 * Format: Stacked layout, large touch targets, readable dark typography
 * Colors: Dark enterprise palette with mobile-optimized contrast
 */

:root {
    /* Dark Mobile Professional Palette */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-surface: #21262d;
    --bg-header: #000000;
    --bg-accent: #1f2937;
    --bg-card: #161b22;
    --border-color: #30363d;
    --border-light: #373e47;
    --border-accent: #58a6ff;

    /* Dark Mobile Typography - High contrast for readability */
    --text-primary: #f0f6fc;
    --text-secondary: #c9d1d9;
    --text-muted: #8b949e;
    --text-accent: #58a6ff;
    --text-inverse: #0d1117;

    /* Professional Status Colors (Dark Mobile Optimized) */
    --status-completed: #3fb950;
    --status-progress: #f85149;
    --status-planned: #58a6ff;
    --status-hold: #8b949e;

    /* Mobile Layout Metrics - Touch-friendly with dark shadows */
    --touch-target: 44px;
    --shadow-subtle: 0 4px 8px -2px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 8px 16px -4px rgba(0, 0, 0, 0.5);
    --shadow-strong: 0 12px 24px -6px rgba(0, 0, 0, 0.6);
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Mobile Typography - Large and readable */
    --font-primary: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.875rem;
    --font-size-sm: 1rem;
    --font-size-md: 1.125rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Mobile line heights for better readability */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
}

/* Dark Mobile-First Layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: var(--line-height-normal);
    font-size: var(--font-size-sm);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
    padding: var(--spacing-md);
}

/* Dark Mobile Header */
.header {
    background: linear-gradient(135deg, #000000 0%, #161b22 100%);
    color: var(--text-primary);
    padding: var(--spacing-xl) var(--spacing-md);
    border-radius: var(--border-radius-lg);
    margin-bottom: var(--spacing-xl);
    text-align: center;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    position: relative;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(
        90deg,
        var(--status-completed) 0%,
        var(--status-progress) 50%,
        var(--status-planned) 100%
    );
    border-radius: 2px;
}

.header h1 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-sm);
    margin-top: var(--spacing-xs);
    line-height: var(--line-height-tight);
}

.header .subtitle {
    font-size: var(--font-size-md);
    opacity: 0.9;
    color: var(--text-secondary);
    line-height: var(--line-height-normal);
}

/* Dark Mobile Category Sections */
.category-section {
    margin-bottom: var(--spacing-2xl);
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
}

.category-header {
    background: linear-gradient(135deg, var(--bg-surface) 0%, #2d3748 100%);
    padding: var(--spacing-lg) var(--spacing-md);
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.category-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: var(--text-accent);
    border-radius: 1px;
}

.category-icon {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-xs);
    display: block;
    text-align: center;
    color: var(--text-accent);
}

.category-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    text-align: center;
    margin-bottom: var(--spacing-xs);
    line-height: var(--line-height-tight);
}

.project-count {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    background: var(--bg-accent);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
    text-align: center;
    display: inline-block;
    width: 100%;
    font-weight: var(--font-weight-medium);
}

/* Mobile Project Layout - Stacked Dark Cards */
.category-table-container {
    background: var(--bg-surface);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.projects-table {
    width: 100%;
    border-collapse: collapse;
    display: block;
}

.projects-table thead {
    display: none; /* Hide table headers on mobile */
}

.projects-table tbody {
    display: block;
}

/* Mobile Project Rows - Dark Cards */
.project-row {
    display: block;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-lg);
    padding: 0;
    box-shadow: var(--shadow-subtle);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
}

.project-row:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
    border-color: var(--border-accent);
}

.project-row:last-child {
    margin-bottom: 0;
}

.project-info {
    display: block;
    margin-bottom: 0;
    padding: var(--spacing-lg) var(--spacing-md);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-surface) 100%);
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.project-info::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: var(--spacing-md);
    width: 50px;
    height: 2px;
    background: var(--text-accent);
    border-radius: 1px;
}

.project-name {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    line-height: var(--line-height-tight);
    min-height: var(--touch-target);
    display: flex;
    align-items: center;
}

.project-name a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) 0;
    transition: color 0.2s ease;
}

.project-name a:hover,
.project-name a:focus {
    color: var(--text-accent);
    text-decoration: underline;
}

.project-name .issue-arrow {
    font-size: var(--font-size-xs);
    opacity: 0.7;
}

.project-meta {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    line-height: var(--line-height-normal);
    font-weight: var(--font-weight-medium);
}

/* Mobile Quarter Cells - Stacked Dark Sections */
.quarter-cell {
    display: block;
    width: 100%;
    margin-bottom: 0;
    background: var(--bg-surface);
    border-radius: 0;
    padding: var(--spacing-lg) var(--spacing-md);
    border-left: none;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.quarter-cell:last-child {
    border-bottom: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.quarter-cell.next-quarter {
    background: linear-gradient(135deg, #21262d 0%, #2d3748 100%);
    border-left: 4px solid var(--status-planned);
    box-shadow: inset 0 0 0 1px rgba(88, 166, 255, 0.1);
}

.quarter-cell.past-quarter {
    background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
    border-left: 4px solid var(--border-color);
    opacity: 0.8;
}

.quarter-cell.empty {
    background: var(--bg-accent);
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
    padding: var(--spacing-2xl);
    border-style: dashed;
    border-left: 4px dashed var(--border-light);
}

/* Mobile Quarter Headers */
.quarter-cell::before {
    content: attr(data-quarter);
    display: block;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius);
    display: inline-block;
}

.quarter-cell.next-quarter::before {
    color: var(--status-planned);
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.2);
}

.quarter-cell.past-quarter::before {
    color: var(--text-muted);
    background: rgba(139, 148, 158, 0.1);
    border: 1px solid rgba(139, 148, 158, 0.2);
}

/* Mobile Status Badges - Large and Touch-friendly */
.status-badge {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-md);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-height: var(--touch-target);
    line-height: var(--line-height-tight);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

.status-badge.completed {
    background: rgba(63, 185, 80, 0.2);
    color: var(--status-completed);
    border: 2px solid rgba(63, 185, 80, 0.4);
    box-shadow: 0 0 0 1px rgba(63, 185, 80, 0.1);
}

.status-badge.in-progress {
    background: rgba(248, 81, 73, 0.2);
    color: var(--status-progress);
    border: 2px solid rgba(248, 81, 73, 0.4);
    box-shadow: 0 0 0 1px rgba(248, 81, 73, 0.1);
}

.status-badge.planned {
    background: rgba(88, 166, 255, 0.2);
    color: var(--status-planned);
    border: 2px solid rgba(88, 166, 255, 0.4);
    box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.1);
}

.status-badge.on-hold {
    background: rgba(139, 148, 158, 0.2);
    color: var(--status-hold);
    border: 2px solid rgba(139, 148, 158, 0.4);
    box-shadow: 0 0 0 1px rgba(139, 148, 158, 0.1);
}

.status-badge.no-info {
    background: transparent;
    color: var(--text-muted);
    border: 2px solid var(--border-color);
}

/* Mobile Quarter Content */
.quarter-content {
    line-height: var(--line-height-relaxed);
}

.quarter-description {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-md);
    line-height: var(--line-height-normal);
}

.quarter-details {
    margin-bottom: var(--spacing-md);
}

.detail-item {
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
    line-height: var(--line-height-normal);
    padding-left: var(--spacing-lg);
    position: relative;
    min-height: var(--touch-target);
    display: flex;
    align-items: center;
    font-size: var(--font-size-sm);
}

.detail-item::before {
    content: '→';
    position: absolute;
    left: var(--spacing-xs);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-accent);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-md);
}

/* Mobile Extra Info */
.extra-info {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 2px solid var(--border-color);
}

.extra-info > div {
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-accent);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
}

.extra-info > div:last-child {
    margin-bottom: 0;
}

.progress-info,
.metrics-info,
.risks-info,
.objectives-info,
.dependencies-info {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    line-height: var(--line-height-normal);
}

.progress-info strong,
.metrics-info strong,
.risks-info strong,
.objectives-info strong,
.dependencies-info strong {
    color: var(--text-secondary);
    font-weight: var(--font-weight-semibold);
    display: block;
    margin-bottom: var(--spacing-xs);
}

/* Dark Mobile Metrics Section */
.metrics-section {
    background: var(--bg-secondary);
    padding: var(--spacing-xl) var(--spacing-md);
    border-radius: var(--border-radius-lg);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
}

.metrics-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    line-height: var(--line-height-tight);
}

.metrics-content {
    display: block;
}

.kpis-list,
.risks-section {
    background: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-subtle);
    border: 1px solid var(--border-light);
}

.kpis-list:last-child,
.risks-section:last-child {
    margin-bottom: 0;
}

.kpis-list h3,
.risks-section h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    text-align: center;
    line-height: var(--line-height-tight);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.kpis-list h3::before {
    content: '📊';
}

.risks-section h3::before {
    content: '⚠️';
}

.kpi-item,
.risk-item {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    line-height: var(--line-height-normal);
    padding-left: var(--spacing-lg);
    position: relative;
    min-height: var(--touch-target);
    display: flex;
    align-items: center;
}

.kpi-item::before {
    content: '▸';
    position: absolute;
    left: var(--spacing-xs);
    top: 50%;
    transform: translateY(-50%);
    color: var(--status-completed);
    font-weight: var(--font-weight-bold);
}

.risk-item::before {
    content: '▸';
    position: absolute;
    left: var(--spacing-xs);
    top: 50%;
    transform: translateY(-50%);
    color: var(--status-progress);
    font-weight: var(--font-weight-bold);
}

/* Dark Mobile Legend */
.legend-section {
    background: var(--bg-secondary);
    padding: var(--spacing-xl) var(--spacing-md);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
}

.legend-section h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    line-height: var(--line-height-tight);
    color: var(--text-primary);
}

.legend-grid {
    display: block;
    margin-bottom: var(--spacing-lg);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    background: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-subtle);
    min-height: var(--touch-target);
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.legend-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-status {
    width: 24px;
    height: 24px;
    border-radius: var(--border-radius);
    flex-shrink: 0;
    border: 2px solid transparent;
}

.legend-status.completed {
    background: var(--status-completed);
    border-color: var(--status-completed);
}

.legend-status.in-progress {
    background: var(--status-progress);
    border-color: var(--status-progress);
}

.legend-status.planned {
    background: var(--status-planned);
    border-color: var(--status-planned);
}

.legend-status.on-hold {
    background: var(--status-hold);
    border-color: var(--status-hold);
}

.next-quarters-info {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
    line-height: var(--line-height-normal);
    padding: var(--spacing-lg);
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
    margin-top: var(--spacing-lg);
}

/* Desktop Responsive - Progressive Enhancement */
@media (min-width: 768px) {
    .container {
        padding: var(--spacing-lg);
        max-width: 1200px;
    }

    .header h1 {
        font-size: var(--font-size-2xl);
    }

    .header::before {
        width: 120px;
    }

    .category-header {
        display: flex;
        align-items: center;
        gap: var(--spacing-md);
    }

    .category-header::after {
        left: var(--spacing-md);
        transform: none;
        width: 60px;
    }

    .category-icon {
        display: inline;
        text-align: left;
        margin-bottom: 0;
    }

    .category-title {
        flex: 1;
        text-align: left;
        margin-bottom: 0;
    }

    .project-count {
        display: inline-block;
        width: auto;
        text-align: center;
    }

    .project-row {
        margin-bottom: var(--spacing-xl);
    }

    .quarter-cell {
        padding: var(--spacing-xl);
    }
}

@media (min-width: 1024px) {
    .projects-table {
        display: table;
        border-collapse: collapse;
        background: var(--bg-surface);
        border-radius: var(--border-radius-lg);
        overflow: hidden;
        border: 1px solid var(--border-color);
    }

    .projects-table thead {
        display: table-header-group;
    }

    .projects-table tbody {
        display: table-row-group;
    }

    .project-row {
        display: table-row;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border-color);
        padding: 0;
        margin-bottom: 0;
        box-shadow: none;
        border-radius: 0;
        border: none;
    }

    .project-row:hover {
        background: var(--bg-surface);
        transform: none;
        box-shadow: none;
        border-color: transparent;
    }

    .project-info,
    .quarter-cell {
        display: table-cell;
        vertical-align: top;
        padding: var(--spacing-lg);
        border-right: 1px solid var(--border-color);
        margin-bottom: 0;
        border-radius: 0;
        border-left: none;
        border-bottom: none;
        background: transparent;
        box-shadow: none;
        transition: none;
    }

    .project-info {
        width: 20%;
        min-width: 20%;
    }

    .quarter-cell {
        width: 20%;
        min-width: 20%;
    }

    .project-info::after {
        display: none;
    }

    .quarter-cell:last-child {
        border-right: none;
    }

    .quarter-cell::before {
        display: none;
    }

    .quarter-cell.next-quarter {
        background: linear-gradient(135deg, #21262d 0%, #2d3748 100%);
        border-left: 3px solid var(--status-planned);
    }

    .quarter-cell.past-quarter {
        background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
        border-left: 3px solid var(--border-color);
    }

    .projects-table th {
        background: linear-gradient(135deg, #000000 0%, #161b22 100%);
        color: var(--text-primary);
        padding: var(--spacing-lg);
        text-align: left;
        font-weight: var(--font-weight-semibold);
        border-right: 1px solid var(--border-color);
        font-size: var(--font-size-sm);
    }

    .projects-table th:last-child {
        border-right: none;
    }

    .projects-table th.next-quarter {
        background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
        color: white;
    }

    .projects-table th.past-quarter {
        background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
        color: #d1d5db;
    }

    .metrics-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-xl);
    }

    .legend-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: var(--spacing-md);
    }

    .legend-item {
        margin-bottom: 0;
    }

    .next-quarters-info {
        margin-top: 0;
    }
}
