/*
 * Table Styles
 * Accessible, responsive table styling matching ECHO design system
 * Supports dark, light, and geek themes via CSS custom properties
 */

/* Table Container */
.ship-status-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm, 0.875rem);
    line-height: var(--line-height-snug, 1.375);
    color: var(--color-text);
    background: var(--color-bg-elevated);
}

/* Table Header */
.ship-status-table thead {
    background: var(--color-bg-elevated);
    position: sticky;
    top: 0;
    z-index: 1;
}

.ship-status-table th {
    padding: var(--space-2) var(--space-3);
    text-align: left;
    font-weight: var(--font-weight-semibold, 600);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--color-text-muted);
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}

/* Table Body */
.ship-status-table tbody {
    background: var(--color-bg-elevated);
}

.ship-status-table td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border-subtle);
    vertical-align: middle;
}

/* Row Hover */
.ship-status-table tbody tr:hover {
    background: var(--color-bg-hover);
}

/* Row Focus */
.ship-status-table tbody tr:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
    background: var(--color-bg-hover);
}

/* Alternating Row Colors */
.ship-status-table tbody tr:nth-child(even) {
    background: var(--color-bg);
}

.ship-status-table tbody tr:nth-child(even):hover {
    background: var(--color-bg-hover);
}

/* Status Badges in Table */
.ship-status-table .status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm, 4px);
    font-size: var(--font-size-xs, 0.75rem);
    font-weight: var(--font-weight-medium, 500);
}

.ship-status-table .status-badge--confirmed {
    background: rgba(var(--color-success-rgb), 0.2);
    color: var(--color-success);
}

.ship-status-table .status-badge--high-risk {
    background: rgba(var(--color-danger-rgb), 0.2);
    color: var(--color-danger);
}

.ship-status-table .status-badge--watchlist {
    background: rgba(var(--color-warning-rgb), 0.2);
    color: var(--color-warning);
}

/* Clickable Rows */
.ship-status-table tbody tr[role="button"] {
    cursor: pointer;
}

.ship-status-table tbody tr[role="button"]:active {
    transform: translateY(1px);
}

/* Ship Name Cell */
.ship-status-table td:first-child {
    font-weight: var(--font-weight-medium, 500);
}

/* IMO Cell (Code style) */
.ship-status-table td:nth-child(2) {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace);
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--color-text-muted);
}

/* Empty State */
.ship-status-table tbody:empty::after {
    content: "No vessels match the current filters";
    display: block;
    padding: var(--space-4);
    text-align: center;
    color: var(--color-text-muted);
    font-style: italic;
}

/* Scroll Container */
.ship-status-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 200px;
}

/* Focus Indicators */
.ship-status-table th:focus-visible,
.ship-status-table td:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

/* Theme-Specific Adjustments */

/* Light Theme */
[data-theme="light"] .ship-status-table {
    box-shadow: var(--shadow-sm, 0 1px 2px 0 rgba(0, 0, 0, 0.05));
}

[data-theme="light"] .ship-status-table th {
    border-bottom-color: var(--color-gray-300, #d1d5db);
}

/* Geek Theme (Terminal) */
[data-theme="geek"] .ship-status-table {
    border: 1px solid var(--color-border);
}

[data-theme="geek"] .ship-status-table th {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-text);
    text-transform: lowercase;
    letter-spacing: 0;
}

[data-theme="geek"] .ship-status-table td {
    border-bottom: 1px dotted var(--color-border);
}

[data-theme="geek"] .ship-status-table tbody tr:nth-child(even) {
    background: transparent;
}

[data-theme="geek"] .ship-status-table tbody tr:hover {
    background: var(--color-bg-elevated);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .ship-status-table th,
    .ship-status-table td {
        border-color: currentColor;
    }

    .ship-status-table tbody tr:hover {
        outline: 1px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .ship-status-table tbody tr[role="button"]:active {
        transform: none;
    }
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .ship-status-table th,
    .ship-status-table td {
        padding: var(--space-2);
        font-size: var(--font-size-xs, 0.75rem);
    }

    .ship-status-table th:nth-child(2),
    .ship-status-table td:nth-child(2) {
        /* Hide IMO on small screens */
        display: none;
    }
}
