/**
 * Cards Theme - Dark Professional Card-Based Layout
 * Target: Project overview with visual card separation for easy scanning
 * Format: Transform table rows into individual project cards
 * Colors: Dark enterprise palette with card-focused visual hierarchy
 */

:root {
    /* Dark Cards Professional Palette */
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f24;
    --bg-surface: #21262d;
    --bg-header: #000000;
    --bg-card: #161b22;
    --bg-card-hover: #21262d;
    --border-color: #30363d;
    --border-light: #373e47;
    --border-accent: #0969da;

    /* Dark Cards Typography */
    --text-primary: #e6edf3;
    --text-secondary: #c9d1d9;
    --text-muted: #7d8590;
    --text-accent: #58a6ff;
    --text-light: #656d76;

    /* Professional Status Colors (Dark Optimized) */
    --status-completed: #3fb950;
    --status-progress: #f85149;
    --status-planned: #0969da;
    --status-hold: #7d8590;

    /* Cards Visual Elements */
    --shadow-card: 0 8px 24px -6px rgba(0, 0, 0, 0.5), 0 4px 8px -4px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 12px 32px -8px rgba(0, 0, 0, 0.6), 0 8px 16px -4px rgba(0, 0, 0, 0.4);
    --shadow-subtle: 0 2px 8px -2px rgba(0, 0, 0, 0.3);
    --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;
    --card-gap: 1.5rem;

    /* Cards Typography */
    --font-primary: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
}

/* Dark Cards 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: 1.5;
    font-size: var(--font-size-sm);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

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

.header::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--border-radius-lg);
    padding: 1px;
    background: linear-gradient(
        135deg,
        var(--status-completed) 0%,
        var(--status-progress) 50%,
        var(--status-planned) 100%
    );
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: exclude;
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask-composite: exclude;
}

.header h1 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-sm);
    position: relative;
    z-index: 1;
}

.header .subtitle {
    font-size: var(--font-size-lg);
    opacity: 0.9;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
}

/* Dark Cards Category Sections */
.category-section {
    margin-bottom: var(--spacing-2xl);
}

.category-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-surface) 100%);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-subtle);
    border: 1px solid var(--border-light);
}

.category-icon {
    font-size: var(--font-size-xl);
    color: var(--text-accent);
}

.category-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    flex: 1;
}

.project-count {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
    font-weight: var(--font-weight-medium);
}

/* Transform Table to Cards - Hide Table Structure */
.category-table-container {
    background: transparent;
    border: none;
    box-shadow: none;
}

.projects-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 var(--card-gap);
    background: transparent;
}

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

/* Transform Rows into Cards */
.project-row {
    display: block;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: var(--card-gap);
}

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

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

.project-info::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: var(--spacing-lg);
    width: 60px;
    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: 1.3;
}

.project-name a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
}

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

.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);
    font-weight: var(--font-weight-medium);
}

/* Transform Quarter Cells to Mini-Cards Grid */
.quarter-cell {
    display: inline-block;
    vertical-align: top;
    width: 24%;
    margin-right: 1%;
    padding: var(--spacing-md);
    background: var(--bg-surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
    position: relative;
    transition: all 0.2s ease;
    min-height: 140px;
}

.quarter-cell:last-child {
    margin-right: 0;
}

/* Add quarter labels to cards dynamically (no hardcoded years) */
.quarter-cell::after {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    border: 1px solid var(--border-light);
    white-space: nowrap;
    z-index: 2;
}

/* Past quarters styling */
.quarter-cell.past-quarter::after {
    color: var(--text-muted);
    border-color: var(--border-light);
}

/* Next quarters styling */
.quarter-cell.next-quarter::after {
    color: var(--text-accent);
    border-color: var(--border-accent);
}

.quarter-cell.next-quarter {
    background: linear-gradient(135deg, var(--bg-surface) 0%, #21262d 100%);
    border-color: var(--status-planned);
    box-shadow: 0 0 0 1px rgba(9, 105, 218, 0.2);
}

.quarter-cell.past-quarter {
    background: linear-gradient(135deg, #0f1419 0%, var(--bg-secondary) 100%);
    border-color: var(--border-color);
    opacity: 0.7;
}

.quarter-cell:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-subtle);
}

.quarter-cell.empty {
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    border-style: dashed;
}

/* Status Indicators for Cards */
.quarter-cell::before {
    content: '';
    position: absolute;
    top: -1px;
    left: var(--spacing-md);
    right: var(--spacing-md);
    height: 3px;
    border-radius: 0 0 2px 2px;
    z-index: 2;
}

.quarter-cell.completed::before {
    background: var(--status-completed);
    box-shadow: 0 2px 8px rgba(63, 185, 80, 0.3);
}

.quarter-cell.in-progress::before {
    background: var(--status-progress);
    box-shadow: 0 2px 8px rgba(248, 81, 73, 0.3);
}

.quarter-cell.planned::before {
    background: var(--status-planned);
    box-shadow: 0 2px 8px rgba(9, 105, 218, 0.3);
}

.quarter-cell.on-hold::before {
    background: var(--status-hold);
    opacity: 0.5;
}

/* Cards Status Badges */
.status-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-md);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

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

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

.status-badge.planned {
    background: rgba(9, 105, 218, 0.2);
    color: var(--status-planned);
    border: 1px solid rgba(9, 105, 218, 0.4);
}

.status-badge.on-hold {
    background: rgba(125, 133, 144, 0.2);
    color: var(--status-hold);
    border: 1px solid rgba(125, 133, 144, 0.4);
}

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

/* Cards Quarter Content */
.quarter-content {
    position: relative;
}

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

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

.detail-item {
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
    padding-left: var(--spacing-sm);
    position: relative;
    line-height: 1.4;
    font-size: var(--font-size-xs);
}

.detail-item::before {
    content: '▸';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--text-accent);
    font-weight: var(--font-weight-bold);
}

/* Cards Extra Info */
.extra-info {
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
}

.extra-info > div {
    margin-bottom: var(--spacing-xs);
}

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

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

.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);
}

/* Dark Cards Metrics Section */
.metrics-section {
    background: var(--bg-secondary);
    padding: var(--spacing-xl);
    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;
}

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

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

.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);
    display: flex;
    align-items: 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: 1.4;
    padding-left: var(--spacing-md);
    position: relative;
}

.kpi-item::before {
    content: '▸';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--status-completed);
    font-weight: var(--font-weight-bold);
}

.risk-item::before {
    content: '▸';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--status-progress);
    font-weight: var(--font-weight-bold);
}

/* Dark Cards Legend */
.legend-section {
    background: var(--bg-secondary);
    padding: var(--spacing-lg);
    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-md);
    text-align: center;
    color: var(--text-primary);
}

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

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-sm);
    background: var(--bg-card);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-subtle);
}

.legend-status {
    width: 16px;
    height: 16px;
    border-radius: var(--border-radius);
    flex-shrink: 0;
}

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

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

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

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

.next-quarters-info {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

/* Cards Responsive Design */
@media (max-width: 1200px) {
    .container {
        padding: var(--spacing-md);
    }

    .quarter-cell {
        width: calc((100% - 2 * var(--spacing-sm)) / 3);
        margin-right: var(--spacing-sm);
    }

    .quarter-cell:nth-child(3n) {
        margin-right: 0;
    }

    .quarter-cell:nth-child(4) {
        margin-top: var(--spacing-md);
        margin-right: var(--spacing-sm);
    }
}

@media (max-width: 768px) {
    .quarter-cell {
        width: calc((100% - var(--spacing-sm)) / 2);
        margin-bottom: var(--spacing-md);
    }

    .quarter-cell:nth-child(even) {
        margin-right: 0;
    }

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

    .legend-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: var(--spacing-sm);
    }

    .header {
        padding: var(--spacing-lg);
    }

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

    .category-header {
        padding: var(--spacing-md);
    }

    .quarter-cell {
        width: 100%;
        margin-right: 0;
        margin-bottom: var(--spacing-md);
    }

    .project-info,
    .quarter-cell {
        padding: var(--spacing-sm);
    }
}

/* Cards Animation Effects */
@keyframes card-entrance {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.project-row {
    animation: card-entrance 0.5s ease-out forwards;
}

.project-row:nth-child(even) {
    animation-delay: 0.1s;
}

.project-row:nth-child(3n) {
    animation-delay: 0.2s;
}
