* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #1a202c;
}

.dashboard-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.header .subtitle {
    color: #64748b;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.nav-links {
    margin-top: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    color: #64748b;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-total .stat-number { color: #3b82f6; }
.stat-queue .stat-number { color: #f59e0b; }
.stat-success .stat-number { color: #10b981; }
.stat-failed .stat-number { color: #ef4444; }
.stat-progress .stat-number { color: #8b5cf6; }

.controls {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.search-box, .filter-select, .email-input {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.search-box {
    flex: 1;
    min-width: 300px;
    padding-left: 45px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 15px center;
    background-size: 20px;
}

.search-box:focus, .filter-select:focus, .email-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-select {
    min-width: 150px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

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

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-2px);
}

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

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
}

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

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

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

.btn-info:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

.performance-info {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.table-wrapper {
    overflow-x: auto;
    max-height: 70vh;
}

table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 1800px;
}

thead {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Fixed column widths */
th:nth-child(1) { width: 50px; }   /* No. */
th:nth-child(2) { width: 200px; }  /* Drive ID */
th:nth-child(3) { width: 120px; }  /* App ID */
th:nth-child(4) { width: 120px; }  /* App Name */
th:nth-child(5) { width: 150px; }  /* App URL */
th:nth-child(6) { width: 120px; }  /* Encode ID */
th:nth-child(7) { width: 300px; }  /* Title */
th:nth-child(8) { width: 80px; }   /* Duration */
th:nth-child(9) { width: 80px; }   /* Size */
th:nth-child(10) { width: 140px; } /* Created */
th:nth-child(11) { width: 100px; } /* Status */
th:nth-child(12) { width: 100px; } /* Queued For */
th:nth-child(13) { width: 80px; }  /* Source */


.table-row {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

.table-row:hover {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    transform: scale(1.001);
}

td {
    padding: 12px;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Fixed column widths for td */
td:nth-child(1) { width: 50px; }   /* No. */
td:nth-child(2) { width: 200px; }  /* Drive ID */
td:nth-child(3) { width: 120px; }  /* App ID */
td:nth-child(4) { width: 120px; }  /* App Name */
td:nth-child(5) { width: 150px; }  /* App URL */
td:nth-child(6) { width: 120px; }  /* Encode ID */
td:nth-child(7) { width: 300px; }  /* Title */
td:nth-child(8) { width: 80px; }   /* Duration */
td:nth-child(9) { width: 80px; }   /* Size */
td:nth-child(10) { width: 140px; } /* Created */
td:nth-child(11) { width: 100px; } /* Status */
td:nth-child(12) { width: 100px; } /* Queued For */
td:nth-child(13) { width: 80px; }  /* Source */

/* Re-transcoding table specific column widths */
#retranscodeTable th:nth-child(1) { width: 50px; }   /* No. */
#retranscodeTable th:nth-child(2) { width: 200px; }  /* DriveId */
#retranscodeTable th:nth-child(3) { width: 120px; }  /* WacId */
#retranscodeTable th:nth-child(4) { width: 150px; }  /* App Name */
#retranscodeTable th:nth-child(5) { width: 300px; }  /* Title */
#retranscodeTable th:nth-child(6) { width: 100px; }  /* Video Size */
#retranscodeTable th:nth-child(7) { width: 100px; }  /* Status */
#retranscodeTable th:nth-child(8) { width: 120px; }  /* Action */

#retranscodeTable td:nth-child(1) { width: 50px; }   /* No. */
#retranscodeTable td:nth-child(2) { width: 200px; }  /* DriveId */
#retranscodeTable td:nth-child(3) { width: 120px; }  /* WacId */
#retranscodeTable td:nth-child(4) { width: 150px; }  /* App Name */
#retranscodeTable td:nth-child(5) { width: 300px; }  /* Title */
#retranscodeTable td:nth-child(6) { width: 100px; }  /* Video Size */
#retranscodeTable td:nth-child(7) { width: 100px; }  /* Status */
#retranscodeTable td:nth-child(8) { width: 120px; }  /* Action */

/* Ensure re-transcoding table has proper minimum width */
#retranscodeTable {
    min-width: 1240px;
}

/* Special handling for title column */
td:nth-child(7) {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.status-failed {
    background: #fef2f2;
    color: #991b1b;
}

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

.status-progress {
    background: #f3e8ff;
    color: #7c3aed;
}

.status-unknown {
    background: #f3f4f6;
    color: #374151;
}

.text-center { text-align: center; }
.font-mono { font-family: 'Monaco', 'Menlo', monospace; }
.font-medium { font-weight: 500; }
.text-sm { font-size: 0.875rem; }
.text-gray-600 { color: #4b5563; }
.text-blue-600 { color: #2563eb; }
.text-blue-800 { color: #1e40af; }
.max-w-xs { max-width: 20rem; }
.truncate { 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
}
.underline { text-decoration: underline; }

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #64748b;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
    display: none;
}

.no-results i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Email Management Styles */
.email-management {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.email-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f5f9;
}

.section-header h2 {
    color: #374151;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.email-count {
    background: #f3f4f6;
    color: #6b7280;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.email-form {
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    gap: 10px;
}

.email-input {
    flex: 1;
}

.email-list {
    max-height: 300px;
    overflow-y: auto;
}

.email-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.email-item:hover {
    background: #e2e8f0;
    transform: translateX(5px);
}

.email-address {
    font-family: 'Monaco', 'Menlo', monospace;
    color: #374151;
    font-size: 0.9rem;
}

.remove-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.remove-btn:hover {
    background: #fef2f2;
    transform: scale(1.1);
}

/* Settings Dropdown */
.settings-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.settings-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 4px;
}

.dropdown-item:hover {
    background: #f8fafc;
    color: #667eea;
    transform: translateX(5px);
}

.controls-row {
    position: relative;
}

.bulk-actions {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.bulk-actions h3 {
    color: #374151;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bulk-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.bulk-textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Monaco', 'Menlo', monospace;
    resize: vertical;
    transition: all 0.3s ease;
}

.bulk-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.bulk-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 10px;
    padding: 15px 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #10b981;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
    max-width: 400px;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-message {
    color: #374151;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .controls-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        min-width: auto;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .email-management {
        grid-template-columns: 1fr;
    }
    
    .bulk-buttons {
        flex-direction: column;
    }
    
    .input-group {
        flex-direction: column;
    }
}
/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    margin: 0;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #6b7280;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 25px;
}

.modal-body p {
    margin-bottom: 20px;
    color: #4b5563;
}

.video-info {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
}

.video-info p {
    margin-bottom: 10px;
    font-size: 14px;
}

.video-info p:last-child {
    margin-bottom: 0;
}

.video-info code {
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 25px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 15px 15px;
}


/* ================= ERROR COLUMN ================= */

/* ERROR column width & alignment */
th:nth-child(14),
td:nth-child(14) {
    width: 120px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

/* View Error button */
.error-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    line-height: 26px;
    padding: 0 12px;
    background: #dc2626;
    color: #ffffff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.1s ease;
}

.error-btn:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

/* Keep hidden error text for search/filter */
.error-hidden {
    display: none;
}


th:nth-child(15),
td:nth-child(15) {
    width: 120px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}


.context-menu {
    position: fixed;
    background: #111827;
    color: #fff;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0,0,0,.4);
    padding: 6px 0;
    z-index: 9999;
    display: none;
    min-width: 180px;
  }
  
  .context-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
  }
  
  .context-item:hover {
    background: #dc2626;
  }
  