/**
 * Dashboard Table Styles
 * Sortable/filterable table view for all specifications
 */

/* Layout Optimization - Hide right sidebar and maximize content width */
.md-sidebar--secondary {
    display: none;
}

.md-content {
    max-width: none !important;
}

.md-content__inner {
    max-width: 100% !important;
    margin-left: 0;
    margin-right: 0;
}

/* Table Container */
.specs-table-container {
    width: 100%;
    overflow-x: auto;
    margin: 2rem 0;
    padding: 0 0.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Table Base Styles */
.specs-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.8rem;
    table-layout: fixed;
}

.specs-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.specs-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    position: relative;
}

/* Center-align numeric column headers */
.specs-table th[data-sort="commits"],
.specs-table th[data-sort="prs"] {
    text-align: center;
}

.specs-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.specs-table th.sortable:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Sort Indicators */
.specs-table th.sortable::after {
    content: '⇅';
    opacity: 0.3;
    margin-left: 0.5rem;
    font-size: 0.8em;
}

.specs-table th.sort-asc::after {
    content: '▲';
    opacity: 1;
}

.specs-table th.sort-desc::after {
    content: '▼';
    opacity: 1;
}

/* Table Body */
.specs-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s ease;
}

.specs-table tbody tr:hover {
    background-color: #f9fafb;
    cursor: pointer;
}

.specs-table td {
    padding: 0.875rem 1rem;
}

/* Specific Column Styles */
.spec-id {
    width: 400px;
    min-width: 400px;
    max-width: 400px;
    white-space: nowrap;
}

.spec-id a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    font-family: 'Roboto Mono', monospace;
}

.spec-id a:hover {
    text-decoration: underline;
}

.spec-status {
    width: 200px;
    min-width: 200px;
}

.spec-commits,
.spec-prs {
    width: 100px;
    min-width: 100px;
    text-align: center;
    font-weight: 500;
    color: #6b7280;
}

.spec-updated {
    width: auto;
    min-width: 120px;
    color: #6b7280;
    font-size: 0.85rem;
}

/* Ensure header columns match data column widths */
.specs-table th:nth-child(1) {
    width: 400px;
    min-width: 400px;
    max-width: 400px;
}

.specs-table th:nth-child(2) {
    width: 200px;
    min-width: 200px;
}

.specs-table th:nth-child(3),
.specs-table th:nth-child(4) {
    width: 100px;
    min-width: 100px;
}

.specs-table th:nth-child(5) {
    width: auto;
    min-width: 120px;
}

.spec-assignee {
    font-weight: 500;
    color: #374151;
}

/* Badge Styles */
.spec-state-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.spec-state-draft {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    color: white;
}

.spec-state-in-progress {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: white;
}

.spec-state-completed {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    color: white;
}

.spec-state-archived {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    color: white;
}

.priority-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.priority-low {
    background-color: #dbeafe;
    color: #1e40af;
}

.priority-medium {
    background-color: #fef3c7;
    color: #92400e;
}

.priority-high {
    background-color: #fed7aa;
    color: #9a3412;
}

.priority-critical {
    background-color: #fecaca;
    color: #991b1b;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .specs-table {
        font-size: 0.85rem;
    }

    .specs-table th,
    .specs-table td {
        padding: 0.75rem;
    }

    .spec-title {
        max-width: 200px;
    }
}

@media (max-width: 768px) {
    .specs-table-container {
        margin: 1rem -1rem;
        border-radius: 0;
    }

    .specs-table {
        font-size: 0.8rem;
    }

    .specs-table th,
    .specs-table td {
        padding: 0.5rem;
    }

    .spec-title {
        max-width: 150px;
    }

    /* Hide less important columns on mobile */
    .specs-table th:nth-child(5),
    .specs-table td:nth-child(5) {
        display: none;
    }
}

/* Empty State */
.specs-table tbody td[colspan] {
    text-align: center;
    padding: 3rem 1rem;
    color: #9ca3af;
    font-style: italic;
}

/* Hover Effect for Clickable Rows */
.spec-row {
    position: relative;
    transition: background-color 0.2s ease;
}

.spec-row:hover {
    border-left: 4px solid;
    border-left-color: #667eea;
}

/* Animation for Initial Load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spec-row {
    animation: fadeInUp 0.3s ease forwards;
}

.spec-row:nth-child(1) { animation-delay: 0.05s; }
.spec-row:nth-child(2) { animation-delay: 0.1s; }
.spec-row:nth-child(3) { animation-delay: 0.15s; }
.spec-row:nth-child(4) { animation-delay: 0.2s; }
.spec-row:nth-child(5) { animation-delay: 0.25s; }

/* ===== ACTIVITY GRAPH STYLES ===== */

#activity-graph-container {
    position: relative;
}

.activity-graph {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Axis Styles */
.time-axis path,
.time-axis line {
    stroke: #e5e7eb;
}

.time-axis text {
    fill: #6b7280;
    font-size: 12px;
}

/* Branch Labels */
.branch-label {
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
}

/* Node Hover Effects */
.spec-node:hover path,
.commit-node:hover circle,
.pr-node:hover rect {
    opacity: 0.8;
    transform: scale(1.1);
    transition: all 0.2s ease;
}

/* Tooltip */
.activity-graph-tooltip {
    line-height: 1.4;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.activity-graph-tooltip strong {
    display: block;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 4px;
}

/* Legend Styles */
.legend text {
    fill: #374151;
    font-size: 12px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #activity-graph-container {
        min-height: 400px;
        overflow-x: auto;
    }

    .activity-graph {
        min-width: 800px;
    }
}

