/* ============================================================================
   Selenium Tables - Shared Styling for All Selenium Pages
   ============================================================================ */

/* Enhanced Table Base Styles */
.selenium-table-container {
    overflow-x: auto;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    background: white;
}

.dark .selenium-table-container {
    background: #1f2937;
}

.selenium-table {
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* Sticky Header */
.selenium-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f9fafb;
}

.dark .selenium-table thead {
    background: #374151;
}

/* Table Header Styles - Fixed Alignment */
.selenium-table thead th {
    padding: 0.75rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.dark .selenium-table thead th {
    color: #d1d5db;
    border-bottom-color: #4b5563;
}

/* Table Body Styles - Fixed Alignment */
.selenium-table tbody td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    color: #111827;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.dark .selenium-table tbody td {
    color: #f3f4f6;
    border-bottom-color: #374151;
}

/* Row Hover Effects */
.selenium-table tbody tr {
    transition: all 0.2s ease;
}

.selenium-table tbody tr:hover {
    background-color: #f9fafb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.dark .selenium-table tbody tr:hover {
    background-color: #374151;
}

/* Zebra Striping */
.selenium-table.striped tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

.dark .selenium-table.striped tbody tr:nth-child(even) {
    background-color: #1f2937;
}

/* Sortable Column Headers */
.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 2rem !important;
}

.sortable-header:hover {
    color: #3b82f6;
}

.dark .sortable-header:hover {
    color: #60a5fa;
}

.sortable-header::after {
    content: '⇅';
    position: absolute;
    right: 0.5rem;
    opacity: 0.3;
    font-size: 1rem;
}

.sortable-header.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: #3b82f6;
}

.sortable-header.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: #3b82f6;
}

/* Expandable Rows */
.expandable-row {
    cursor: pointer;
}

.expandable-row:hover {
    background-color: #eff6ff !important;
}

.dark .expandable-row:hover {
    background-color: #1e3a5f !important;
}

.expanded-content {
    background-color: #f0f9ff;
    border-left: 4px solid #3b82f6;
}

.dark .expanded-content {
    background-color: #1e293b;
    border-left-color: #60a5fa;
}

.expanded-content td {
    padding: 1.5rem !important;
}

.expanded-details {
    max-width: 100%;
    overflow-x: auto;
}

/* JSON Viewer in Expanded Row */
.json-viewer {
    background: #1f2937;
    color: #e5e7eb;
    padding: 1rem;
    border-radius: 0.375rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.json-viewer pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge i {
    margin-right: 0.25rem;
}

.status-badge.status-success,
.status-badge.status-completed,
.status-badge.status-active {
    background-color: #d1fae5;
    color: #065f46;
}

.dark .status-badge.status-success,
.dark .status-badge.status-completed,
.dark .status-badge.status-active {
    background-color: #064e3b;
    color: #6ee7b7;
}

.status-badge.status-running,
.status-badge.status-in_progress {
    background-color: #dbeafe;
    color: #1e40af;
    animation: pulse 2s infinite;
}

.dark .status-badge.status-running,
.dark .status-badge.status-in_progress {
    background-color: #1e3a8a;
    color: #93c5fd;
}

.status-badge.status-error,
.status-badge.status-failed {
    background-color: #fee2e2;
    color: #991b1b;
}

.dark .status-badge.status-error,
.dark .status-badge.status-failed {
    background-color: #7f1d1d;
    color: #fca5a5;
}

.status-badge.status-pending,
.status-badge.status-idle {
    background-color: #e5e7eb;
    color: #4b5563;
}

.dark .status-badge.status-pending,
.dark .status-badge.status-idle {
    background-color: #374151;
    color: #d1d5db;
}

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

.dark .status-badge.status-paused {
    background-color: #78350f;
    color: #fde68a;
}

/* Platform Badges */
.platform-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.platform-badge i {
    margin-right: 0.25rem;
}

.platform-badge.platform-twitter {
    background-color: #dbeafe;
    color: #1e40af;
}

.dark .platform-badge.platform-twitter {
    background-color: #1e3a8a;
    color: #93c5fd;
}

.platform-badge.platform-linkedin {
    background-color: #dbeafe;
    color: #0a66c2;
}

.dark .platform-badge.platform-linkedin {
    background-color: #1e3a8a;
    color: #60a5fa;
}

.platform-badge.platform-facebook {
    background-color: #dbeafe;
    color: #1877f2;
}

.dark .platform-badge.platform-facebook {
    background-color: #1e3a8a;
    color: #93c5fd;
}

.platform-badge.platform-instagram {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    color: white;
}

.platform-badge.platform-reddit {
    background-color: #fee2e2;
    color: #ff4500;
}

.dark .platform-badge.platform-reddit {
    background-color: #7f1d1d;
    color: #ff6b35;
}

.platform-badge.platform-tiktok {
    background-color: #1f2937;
    color: #00f2ea;
}

/* Tag Badges */
.tag-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    margin: 0.125rem;
    border-radius: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 500;
    background-color: #e0e7ff;
    color: #3730a3;
}

.dark .tag-badge {
    background-color: #312e81;
    color: #c7d2fe;
}

/* Tooltips */
.has-tooltip {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted #9ca3af;
}

.has-tooltip .tooltip-content {
    visibility: hidden;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s;
}

.has-tooltip .tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

.has-tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Truncated Text */
.truncate-text {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.truncate-text-sm {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.truncate-text-lg {
    max-width: 500px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Icon Badges */
.icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.icon-badge.success {
    background-color: #d1fae5;
    color: #065f46;
}

.dark .icon-badge.success {
    background-color: #064e3b;
    color: #6ee7b7;
}

.icon-badge.error {
    background-color: #fee2e2;
    color: #991b1b;
}

.dark .icon-badge.error {
    background-color: #7f1d1d;
    color: #fca5a5;
}

.icon-badge.warning {
    background-color: #fef3c7;
    color: #92400e;
}

.dark .icon-badge.warning {
    background-color: #78350f;
    color: #fde68a;
}

.icon-badge.info {
    background-color: #dbeafe;
    color: #1e40af;
}

.dark .icon-badge.info {
    background-color: #1e3a8a;
    color: #93c5fd;
}

/* Progress Bars */
.progress-bar-container {
    width: 100%;
    height: 0.5rem;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.dark .progress-bar-container {
    background-color: #374151;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width 0.3s ease;
    border-radius: 9999px;
}

.progress-bar.success {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.progress-bar.error {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.progress-bar.warning {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 0.25rem;
}

.dark .skeleton {
    background: linear-gradient(90deg, #374151 0%, #4b5563 50%, #374151 100%);
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Performance Metrics */
.metric-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.dark .metric-card {
    background-color: #1f2937;
    border-color: #374151;
}

.metric-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    font-size: 1.25rem;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.dark .metric-value {
    color: #f3f4f6;
}

.metric-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dark .metric-label {
    color: #9ca3af;
}

/* Checkbox Styling */
.table-checkbox {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 2px solid #d1d5db;
    cursor: pointer;
    transition: all 0.2s;
}

.table-checkbox:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.dark .table-checkbox {
    border-color: #4b5563;
}

.dark .table-checkbox:checked {
    background-color: #60a5fa;
    border-color: #60a5fa;
}

/* Action Buttons */
.action-buttons {
    display: inline-flex;
    gap: 0.375rem;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    min-width: fit-content;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: all 0.15s;
    cursor: pointer;
    border: 1px solid transparent;
    min-width: 2rem;
    min-height: 2rem;
    height: auto;
    flex-shrink: 0;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn.primary {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.action-btn.primary:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}

.action-btn.secondary {
    background-color: #6b7280;
    color: white;
    border-color: #6b7280;
}

.dark .action-btn.secondary {
    background-color: #4b5563;
    color: #e5e7eb;
    border-color: #4b5563;
}

.action-btn.secondary:hover {
    background-color: #4b5563;
    border-color: #4b5563;
}

.dark .action-btn.secondary:hover {
    background-color: #374151;
    border-color: #374151;
}

.action-btn.success {
    background-color: #10b981;
    color: white;
    border-color: #10b981;
}

.action-btn.success:hover {
    background-color: #059669;
    border-color: #059669;
}

.action-btn.danger {
    background-color: #ef4444;
    color: white;
    border-color: #ef4444;
}

.action-btn.danger:hover {
    background-color: #dc2626;
    border-color: #dc2626;
}

.action-btn.info {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.action-btn.info:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}

.action-btn.warning {
    background-color: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

.action-btn.warning:hover {
    background-color: #d97706;
    border-color: #d97706;
}

/* Icon-only buttons */
.action-btn i {
    font-size: 0.875rem;
}

.action-btn i:only-child {
    margin: 0;
}

/* Empty State */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state-icon {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.dark .empty-state-icon {
    color: #4b5563;
}

.empty-state-text {
    font-size: 1rem;
    color: #6b7280;
}

.dark .empty-state-text {
    color: #9ca3af;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.dark .pagination {
    border-top-color: #374151;
}

.pagination-info {
    font-size: 0.875rem;
    color: #6b7280;
}

.dark .pagination-info {
    color: #9ca3af;
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
}

.pagination-btn {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    background-color: #f3f4f6;
    color: #374151;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #e5e7eb;
}

.dark .pagination-btn {
    background-color: #374151;
    color: #d1d5db;
    border-color: #4b5563;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #e5e7eb;
}

.dark .pagination-btn:hover:not(:disabled) {
    background-color: #4b5563;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .selenium-table thead th,
    .selenium-table tbody td {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .truncate-text {
        max-width: 150px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Accessibility */
.selenium-table:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.sortable-header:focus,
.action-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

