/* ========================================
   TABLE STYLES
   Tables, Status Badges, Findings Tables
   ======================================== */

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 24px;
    background: var(--card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.table:hover {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}

.table th,
.table td {
    padding: 20px 24px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 20px;
    transition: all 0.3s ease;
}

.table th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: #1e293b;
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    position: relative;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.table th:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #06b6d4 100%);
    pointer-events: none;
}

.table tr {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.table tr:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.table tr:last-child td {
    border-bottom: none;
}

/* Generic table container for horizontal overflow */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Ensure tasks table doesn't overflow card */
.tasks-table {
    min-width: 1000px;
}

.tasks-table th:last-child,
.tasks-table td:last-child {
    width: 180px;
    white-space: nowrap;
}

/* Edit form rows */
.table tr[id$="-edit"] {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
    border-left: 4px solid var(--primary);
}

.table tr[id$="-edit"]:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%) !important;
}

/* Ensure table cells with buttons are clickable */
.table td {
	position: relative;
	z-index: 1;
}

.table td:last-child {
	position: relative;
	z-index: 100;
}

/* Fix for any overlapping elements */
.table tr {
	position: relative;
	z-index: 1;
}

.table tr:hover {
	z-index: 2;
}

/* Professional spacing */
.table td strong {
    color: #1e293b;
    font-weight: 600;
}

.table td small.muted {
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.4;
    display: block;
    margin-top: 4px;
}

/* Action buttons container */
.table td:last-child {
    white-space: nowrap;
}

.table td:last-child button {
    margin-right: 8px;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 28px;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: 2px solid var(--valerin-red);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.status-badge:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Project Status Colors */
.status-badge.design {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-color: #93c5fd;
}

.status-badge.construction {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
    border-color: #86efac;
}

.status-badge.completed {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    color: #7c3aed;
    border-color: #c4b5fd;
}

.status-badge.planning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border-color: #fbbf24;
}

.status-badge.onhold {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    color: #991b1b;
    border-color: #f87171;
}

/* Task Status Colors */
.status-badge.notstarted {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #6b7280;
    border-color: #d1d5db;
}

.status-badge.inprogress {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-color: #93c5fd;
}

.status-badge.review {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border-color: #fbbf24;
}

/* Milestone Status Colors */
.status-badge.pending {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #6b7280;
    border-color: #d1d5db;
}

.status-badge.overdue {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    color: #991b1b;
    border-color: #f87171;
}

/* PROFESSIONAL Status Badges */
.status-planning {
	background: #fef3c7;
	color: #92400e;
}

.status-design {
	background: #dbeafe;
	color: #1e40af;
}

.status-construction {
	background: #fecaca;
	color: #dc2626;
}

.status-completed {
	background: #d1fae5;
	color: #065f46;
}

.status-on-hold {
	background: #f3f4f6;
	color: #6b7280;
}

.status-badge.status-in-progress {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-badge.status-planned {
    background: #fef3c7;
    color: #92400e;
}

/* Findings Table Styles */
.findings-table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.findings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

.findings-table th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.findings-table td {
    padding: 16px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.findings-table tbody tr:hover {
    background: #f8f9ff;
}

.finding-row.high-confidence-row {
    background: #f0fdf4;
}

.finding-row.low-confidence-row {
    background: #fefce8;
}

.field-name {
    font-weight: 600;
    color: var(--text);
    min-width: 120px;
}

.current-value {
    min-width: 150px;
}

.current {
    color: #6b7280;
    font-style: italic;
}

.suggested-value {
    min-width: 200px;
    max-width: 300px;
}

.suggested {
    line-height: 1.4;
}

.suggested-item {
    margin-bottom: 4px;
    padding: 4px 8px;
    background: #f3f4f6;
    border-radius: 4px;
    font-size: 0.85rem;
}

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

.funding-source {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.funding-source strong {
    color: var(--primary);
    font-weight: 600;
}

.amount {
    color: #059669;
    font-weight: 600;
    font-size: 0.9rem;
}

.item-name, .item-title, .item-value {
    font-weight: 500;
    color: var(--text);
}

.item-simple {
    color: var(--text);
    font-weight: 500;
}

.confidence-cell {
    text-align: center;
    min-width: 80px;
}

.confidence-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.confidence-badge.high {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.confidence-badge.low {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.context-cell {
    min-width: 200px;
    max-width: 250px;
}

.ai-context p, .source-text p {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.3;
    color: #6b7280;
}

.source {
    font-style: italic;
    color: #9ca3af;
}

.action-cell {
    text-align: center;
    min-width: 60px;
}

/* AI Findings Review - Enhanced Data Display */
.suggested {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggested-item {
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
}

.funding-source {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f0f9ff;
    border-radius: 6px;
    border-left: 3px solid #0ea5e9;
}

.funding-source strong {
    color: #0c4a6e;
    font-weight: 600;
}

.funding-source .amount {
    color: #059669;
    font-weight: 600;
    font-size: 0.9em;
}

.item-name, .item-title, .item-value, .item-simple {
    padding: 6px 10px;
    background: #f8fafc;
    border-radius: 4px;
    color: #374151;
    font-weight: 500;
}

.item-name {
    color: #1e40af;
    font-weight: 600;
}

.item-title {
    color: #7c3aed;
    font-weight: 600;
}

/* Project Table - Valerin Style */
.projects-table {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px var(--valerin-shadow);
}

.projects-table th {
    background: var(--valerin-primary);
    color: var(--valerin-text-light);
    font-weight: 600;
    text-transform: none;
    letter-spacing: -0.025em;
    padding: 16px;
}

.projects-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.projects-table tr:hover {
    background: var(--valerin-accent);
}

/* Badges */
.badge {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #94a3b8;
    display: inline-block;
}
