/* Ticket Dashboard Styles (Airport Departure Board Style) */

.td-header {
    background: var(--ink-1);
    color: var(--bg-card);
    font-family: var(--font-number);
    padding: var(--space-12) var(--space-16);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.td-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.td-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: pulse 2s infinite;
}

.td-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.td-last-updated {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Pulsing Animation for Live indicator */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

/* Filters bar */
.td-filters {
    position: sticky;
    top: 0;
    z-index: var(--z-filter, 40);
    background: var(--bg-base);
    padding: var(--space-12) var(--space-16);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border);
}

.td-filter-group {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    /* Firefox */
}

.td-filter-group::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* Reuse .filter-pill from global styles (style.css/trade.css) */
/* .filter-pill is standard in style.css #status-filter-shell etc. */
/* Inline override for dashboard usage if needed */

.td-search {
    max-width: 250px;
}

/* Desktop Table (Visible > 640px) */
.td-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.td-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-number);
}

.td-table thead {
    background: var(--bg-muted);
    position: sticky;
    top: 0;
    z-index: 30;
}

.td-table th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--ink-3);
    border-bottom: 2px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.td-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.td-table th.sortable:hover {
    color: var(--ink-1);
    background: rgba(0, 0, 0, 0.03);
}

.td-table th.sort-asc::after {
    content: " ↑";
    color: var(--primary-color);
}

.td-table th.sort-desc::after {
    content: " ↓";
    color: var(--primary-color);
}

.td-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--bg-muted);
    font-size: 0.9rem;
    vertical-align: middle;
}

/* Using adaptive-row like behavior, and specific style.css colors for tr[data-type] */
.td-table tbody tr {
    transition: all 0.2s;
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

.td-table tbody tr:hover {
    background: var(--bg-muted);
}

/* Column Width Constraints */
.td-col-type {
    width: 80px;
}

.td-col-title {
    width: auto;
    max-width: 300px;
}

.td-col-city {
    width: 70px;
}

.td-col-time {
    width: 140px;
}

.td-col-price {
    width: 80px;
}

.td-col-stock {
    width: 60px;
    text-align: center;
}

.td-col-updated {
    width: 90px;
    text-align: right;
}

.td-col-title .td-title-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    font-family: 'Noto Sans SC', sans-serif;
    font-weight: 500;
}

.td-city-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    background: var(--bg-tint);
    color: var(--primary-color);
    white-space: nowrap;
}

.td-ago {
    color: var(--ink-3);
    font-size: 0.85rem;
}

/* Grouping Expand/Collapse Styles */
.td-type-flex {
    display: flex;
    align-items: center;
    gap: 4px;
}

.td-parent-row {
    cursor: pointer;
}

.td-expand-icon {
    font-size: 18px;
    color: var(--ink-3);
    transition: transform 0.2s ease;
    user-select: none;
    line-height: 1;
}

.td-parent-row.expanded .td-expand-icon {
    transform: rotate(90deg);
}

.td-child-row {
    background-color: var(--bg-tint);
}

.td-child-indent {
    width: 14px;
    height: 14px;
    border-left: 2px solid var(--border);
    border-bottom: 2px solid var(--border);
    margin-left: 24px;
    border-bottom-left-radius: 4px;
    opacity: 0.6;
}

.td-child-text {
    font-size: 0.85rem;
    color: var(--ink-3);
    opacity: 0.85;
}

/* Empty State */
.td-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--ink-4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.td-empty .material-icons {
    font-size: 48px;
    opacity: 0.5;
}

/* Responsiveness (Compact Table for Mobile) */
@media (max-width: 640px) {
    .td-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .td-search {
        max-width: 100%;
    }

    .td-header {
        border-radius: 0;
    }

    /* Make table more compact on mobile */
    .td-table th {
        padding: 8px 6px;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .td-table td {
        padding: 10px 6px;
        font-size: 0.8rem;
    }

    /* Adjust specific columns */
    .td-col-title {
        min-width: 100px;
        max-width: 180px;
    }

    .td-col-title .td-title-text {
        -webkit-line-clamp: 3;
        line-clamp: 3;
        font-size: 0.85rem;
    }

    .td-col-time {
        min-width: 80px;
        white-space: normal;
        font-size: 0.75rem;
    }

    .td-col-price,
    .td-col-stock {
        min-width: 50px;
    }

    .td-col-type {
        min-width: 60px;
    }

    .td-city-tag {
        font-size: 0.7rem;
        padding: 2px 4px;
    }
}