/* ========================================
   Table Components - DRY Refactored
   ======================================== */

/* ========================================
   1. VIDEO TABLE BASE STYLES
   ======================================== */

.video-table-container {
    overflow-x: auto;
    background-color: var(--color-bg-input);
    border-radius: var(--radius-xl);
    padding: 10px;
}

.video-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--color-bg-input);
    color: var(--color-text-primary);
    font-size: var(--text-body);
    line-height: var(--leading-normal);
}

.video-table thead {
    position: sticky;
    top: 0;
    background-color: var(--color-bg-tertiary);
    z-index: 10;
}

.video-table th {
    padding: 12px 10px;
    text-align: left;
    font-weight: var(--font-semibold);
    font-size: var(--text-body);
    line-height: var(--leading-tight);
    color: var(--color-brand-primary);
    border-bottom: 2px solid var(--color-brand-primary);
    white-space: nowrap;
}

.video-table tbody tr,
.video-table-row {
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--color-border-primary);
}

.video-table tbody tr:hover {
    background-color: var(--color-bg-darker);
    transform: scale(1.01);
}

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

.video-table td {
    padding: 10px;
    vertical-align: middle;
}

/* ========================================
   2. TABLE SORTING
   ======================================== */

.video-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color var(--transition-fast);
}

.video-table th.sortable:hover {
    background-color: var(--color-bg-darker);
}

.sort-icon {
    display: inline-block;
    margin-left: 5px;
    opacity: 0.3;
}

.sort-icon::after {
    content: '⇅';
    font-size: var(--text-body);
}

.video-table th.sort-asc .sort-icon {
    opacity: 1;
}

.video-table th.sort-asc .sort-icon::after {
    content: '↑';
}

.video-table th.sort-desc .sort-icon {
    opacity: 1;
}

.video-table th.sort-desc .sort-icon::after {
    content: '↓';
}

/* ========================================
   3. TABLE COLUMNS - SPECIFIC STYLES
   ======================================== */

/* Thumbnail Column */
.col-thumbnail {
    width: 80px;
    text-align: left;
}

.table-thumbnail {
    width: 70px;
    height: auto;
    border-radius: var(--radius-md);
    display: block;
    margin: 0;
}

/* Title Column */
.col-title {
    min-width: 180px;
    max-width: 220px;
}

.table-title {
    display: block;
    color: var(--color-text-muted);
    font-weight: var(--font-normal);
    font-size: var(--text-body);
    line-height: var(--leading-tight);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Channel Column */
.col-channel {
    min-width: 100px;
    max-width: 140px;
    color: var(--color-text-muted);
    font-weight: var(--font-normal);
}

.col-channel .channel-link {
    display: inline-block;
}

/* Date/Time Columns */
.col-published {
    width: 80px;
    white-space: nowrap;
    color: var(--color-text-muted);
}

.col-analyzed {
    width: 95px;
    white-space: nowrap;
}

.video-table tbody .col-analyzed {
    color: var(--color-text-muted);
    font-weight: var(--font-normal);
    line-height: var(--leading-tight);
}

/* Metric Columns - Shared base styles */
.col-views,
.col-duration,
.col-likes,
.col-comments,
.col-like-ratio,
.col-comment-ratio {
    width: 70px;
    text-align: left;
    color: var(--color-text-muted);
}

/* Specific metric column overrides */
.col-comment-ratio {
    width: 75px;
}

/* Analysis Columns */
.col-language {
    width: 65px;
    text-align: left;
}

.language-badge {
    display: inline-block;
    color: var(--color-text-muted);
    font-weight: var(--font-normal);
    line-height: var(--leading-tight);
    font-size: var(--text-body);
}

.col-sentiment {
    width: 85px;
    text-align: left;
}

.col-method {
    width: 70px;
    text-align: left;
}

/* Transcript Column */
.col-transcript {
    width: 110px;
    text-align: center;
}

/* Hide less critical columns to reduce table width */
.col-likes,
.col-comments {
    display: none;
}

/* ========================================
   4. TABLE RESPONSIVE
   ======================================== */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .video-table th,
    .video-table td {
        padding: 8px 6px;
        font-size: var(--text-small);
    }

    .col-title {
        min-width: 120px;
        max-width: 150px;
    }

    .col-channel {
        min-width: 80px;
        max-width: 100px;
    }
}
