/**
 * DLP Flow Admin Styles
 * Clean, modern WordPress admin styling
 */

/* Video Management Table */
.dlp-video-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1em;
}

.dlp-video-table th,
.dlp-video-table td {
    padding: 8px;
    border: 1px solid #ddd;
    text-align: left;
}

/* Ensure status column has adequate width */
.dlp-video-table th:nth-child(2),
.dlp-video-table td:nth-child(2) {
    min-width: 100px;
    width: 120px;
}

.dlp-video-table th {
    background-color: #f9f9f9;
    color: #000000;
    font-weight: bold;
}

.dlp-video-table tr:hover {
    background-color: #f5f5f5;
}

/* Action Buttons */
.dlp-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-right: 4px;
    font-size: 12px;
    line-height: 1.2;
}

.dlp-btn-primary {
    background: #007cba;
    color: #fff;
}

.dlp-btn-primary:hover {
    background: #005a87;
    color: #fff;
}

.dlp-btn-danger {
    background: #dc3232;
    color: #fff;
}

.dlp-btn-danger:hover {
    background: #a02222;
    color: #fff;
}

.dlp-btn-secondary {
    background: #666;
    color: #fff;
}

.dlp-btn-secondary:hover {
    background: #444;
    color: #fff;
}

.dlp-btn-warning {
    background: #f39c12;
    color: white;
}

.dlp-btn-warning:hover {
    background: #e67e22;
    transform: translateY(-1px);
}

.dlp-btn-success {
    background: #28a745;
    color: #fff;
}

.dlp-btn-success:hover {
    background: #218838;
    color: #fff;
}

/* Modal Styles */
.dlp-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.dlp-modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
}

.dlp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.dlp-modal-title {
    margin: 0;
    font-size: 24px;
}

.dlp-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

.dlp-close:hover {
    color: #000;
}

/* Form Styles */
.dlp-form-group {
    margin-bottom: 16px;
}

.dlp-form-label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
}

.dlp-form-input,
.dlp-form-textarea,
.dlp-form-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.dlp-form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Status Indicators */
.dlp-status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    /* Allow wrapping but prefer breaking at word boundaries (like underscores) */
    word-break: keep-all;
    overflow-wrap: break-word;
    /* Ensure minimum width to prevent single character wrapping */
    min-width: 60px;
    display: inline-block;
    text-align: center;
}

.dlp-status-completed {
    background: #d4edda;
    color: #155724;
}

.dlp-status-processing {
    background: #fff3cd;
    color: #856404;
}

.dlp-status-failed {
    background: #f8d7da;
    color: #721c24;
}

.dlp-status-pending {
    background: #d1ecf1;
    color: #0c5460;
}

/* Enhanced Status System */
.dlp-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dlp-status-queued {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.dlp-status-ingesting {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fbbf24;
    animation: pulse 2s infinite;
}

.dlp-status-ready {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.dlp-status-failed {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #f87171;
}

.dlp-status-unknown {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

/* Progress Bar Styles */
.dlp-progress-container {
    width: 100%;
    height: 6px;
    background-color: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.dlp-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    border-radius: 3px;
    transition: width 0.3s ease;
    position: relative;
}

.dlp-progress-bar.ingesting {
    background: linear-gradient(90deg, #f59e0b, #d97706);
    animation: shimmer 2s infinite;
}

.dlp-progress-bar.ready {
    background: linear-gradient(90deg, #10b981, #059669);
}

.dlp-progress-bar.failed {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* Status Message */
.dlp-status-message {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
    font-style: italic;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes shimmer {
    0% { 
        background-position: -200% 0; 
    }
    100% { 
        background-position: 200% 0; 
    }
}

/* Disabled Button Styles */
.dlp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Video Management Table Container - Prevent Toolbar Overflow */
.dlp-video-table {
    width: 99% !important;
    max-width: 99%;
    table-layout: fixed;
}

/* Content Type Column Styles */
.dlp-content-type-cell {
    min-width: 140px;
    max-width: 160px;
    vertical-align: top;
    padding: 8px;
}

/* Table Column Width Adjustments */
.dlp-video-table th:nth-child(1), /* Title */
.dlp-video-table td:nth-child(1) {
    width: 20%;
    min-width: 150px;
}

.dlp-video-table th:nth-child(2), /* Status */
.dlp-video-table td:nth-child(2) {
    width: 15%;
    min-width: 120px;
}

.dlp-video-table th:nth-child(3), /* Content Type */
.dlp-video-table td:nth-child(3) {
    width: 15%;
    min-width: 140px;
}

.dlp-video-table th:nth-child(4), /* Uploader */
.dlp-video-table td:nth-child(4) {
    width: 12%;
    min-width: 100px;
}

.dlp-video-table th:nth-child(5), /* Date */
.dlp-video-table td:nth-child(5) {
    width: 10%;
    min-width: 80px;
    word-break: break-all;
    white-space: pre-line;
}

.dlp-video-table th:nth-child(6), /* Actions */
.dlp-video-table td:nth-child(6) {
    width: 13%;
    min-width: 120px;
}

.dlp-content-type-selector {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dlp-content-type-dropdown {
    font-size: 12px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: white;
}

.dlp-start-processing-btn {
    font-size: 11px !important;
    padding: 4px 8px !important;
    border-radius: 3px;
    background: #28a745;
    color: white;
    border: 1px solid #28a745;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dlp-start-processing-btn:hover:not(:disabled) {
    background: #218838;
    border-color: #1e7e34;
}

.dlp-start-processing-btn:disabled {
    background: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
}

.dlp-content-type-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    border: 1px solid #bbdefb;
}

.dlp-content-type-display {
    text-align: center;
}

/* Content Type Badge */
.dlp-content-type {
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
}

/* Thumbnail Preview */
.dlp-thumbnail-preview {
    margin-top: 8px;
}

.dlp-thumbnail-preview img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border: 2px solid #007cba;
    border-radius: 6px;
}

.dlp-thumbnail-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    border: none;
}

/* Thumbnail Action Buttons */
.dlp-thumbnail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dlp-thumbnail-actions .dlp-btn {
    font-size: 13px;
    padding: 6px 12px;
}

.dlp-btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.dlp-btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* Loading States */
.dlp-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: dlp-spin 1s linear infinite;
}

@keyframes dlp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Progress Bar */
.dlp-progress {
    width: 100%;
    background-color: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.dlp-progress-bar {
    height: 20px;
    background-color: #007cba;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
}

/* Approval Grid */
.dlp-approval-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.dlp-approval-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    display: flex;
    gap: 12px;
}

.dlp-approval-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dlp-approval-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.dlp-approval-content {
    flex: 1;
}

.dlp-approval-title {
    margin: 0 0 4px 0;
    font-size: 16px;
    line-height: 1.3;
}

.dlp-approval-meta {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.dlp-approval-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dlp-modal-content {
        width: 95%;
        padding: 15px;
    }
    
    .dlp-approval-grid {
        grid-template-columns: 1fr;
    }
    
    .dlp-video-table {
        font-size: 12px;
    }
    
    .dlp-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* Error Messages */
.dlp-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    margin: 16px 0;
}

.dlp-success {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
    margin: 16px 0;
}

.dlp-info {
    background: #d1ecf1;
    color: #0c5460;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #bee5eb;
    margin: 16px 0;
}

/* ENHANCED CONTENT TYPE DROPDOWN - TASK 2.2 */

/* Enhanced Content Type Selector Container */
.dlp-content-type-selector-enhanced {
    position: relative;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.dlp-content-type-selector-enhanced:hover {
    border-color: #007bff;
    box-shadow: 0 6px 16px rgba(0,123,255,0.15);
}

/* Enhanced Dropdown Container */
.dlp-content-type-dropdown-container {
    position: relative;
    margin-bottom: 8px;
}

.dlp-dropdown-animated {
    animation: dlp-dropdown-bounce 0.3s ease;
}

@keyframes dlp-dropdown-bounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Enhanced Dropdown Styling */
.dlp-content-type-dropdown-enhanced {
    width: 100%;
    padding: 8px 32px 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.dlp-content-type-dropdown-enhanced:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
    background: #ffffff;
}

.dlp-content-type-dropdown-enhanced:hover {
    border-color: #80bdff;
}

.dlp-dropdown-selected {
    border-color: #28a745 !important;
    background: linear-gradient(135deg, #d4edda, #ffffff);
}

/* Content Type Specific Dropdown Colors */
.dlp-content-type-youtube-short {
    border-left: 4px solid #ff6b6b;
}

.dlp-content-type-dlp---youtube {
    border-left: 4px solid #4ecdc4;
}

.dlp-content-type-dlp---no-youtube {
    border-left: 4px solid #45b7d1;
}

.dlp-content-type-bish---brown {
    border-left: 4px solid #f9ca24;
}

.dlp-content-type-dr--liau {
    border-left: 4px solid #6c5ce7;
}

.dlp-content-type-general {
    border-left: 4px solid #a0a0a0;
}

/* Dropdown Enhancement Indicator */
.dlp-dropdown-enhancement-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.dlp-dropdown-icon {
    font-size: 12px;
    color: #6c757d;
    transition: transform 0.3s ease;
}

.dlp-content-type-dropdown-enhanced:focus + .dlp-dropdown-enhancement-indicator .dlp-dropdown-icon {
    transform: rotate(180deg);
}

/* Content Type Information Panel */
.dlp-content-type-info-panel {
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    border: 1px solid #e1bee7;
    border-radius: 8px;
    padding: 10px;
    margin: 8px 0;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    font-size: 11px;
}

.dlp-info-panel-visible {
    opacity: 1;
    max-height: 200px;
}

.dlp-info-panel-content > div {
    margin-bottom: 6px;
    line-height: 1.4;
}

.dlp-info-panel-content > div:last-child {
    margin-bottom: 0;
}

.dlp-info-panel-content strong {
    color: #495057;
    font-weight: 600;
}

.dlp-info-description-text {
    color: #007bff;
    font-style: italic;
}

.dlp-info-features-text {
    color: #28a745;
    font-weight: 500;
}

.dlp-info-workflow-text {
    color: #6f42c1;
    font-weight: 500;
}

.dlp-info-hosts-text {
    color: #fd7e14;
    font-weight: 500;
}

/* Enhanced Start Processing Button */
.dlp-start-processing-container {
    margin-top: 8px;
}

.dlp-start-processing-btn-enhanced {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 8px rgba(40,167,69,0.3);
}

.dlp-start-processing-btn-enhanced:hover:not(:disabled) {
    background: linear-gradient(135deg, #218838, #1e7e34);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40,167,69,0.4);
}

.dlp-start-processing-btn-enhanced:disabled {
    background: linear-gradient(135deg, #6c757d, #adb5bd);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.dlp-btn-ready {
    animation: dlp-btn-ready-pulse 2s infinite;
}

@keyframes dlp-btn-ready-pulse {
    0% { box-shadow: 0 4px 8px rgba(40,167,69,0.3); }
    50% { box-shadow: 0 6px 16px rgba(40,167,69,0.5); }
    100% { box-shadow: 0 4px 8px rgba(40,167,69,0.3); }
}

.dlp-btn-processing {
    background: linear-gradient(135deg, #007bff, #6610f2) !important;
    animation: dlp-btn-processing 1s infinite;
}

@keyframes dlp-btn-processing {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.dlp-btn-icon {
    font-size: 14px;
}

.dlp-btn-loading {
    display: none;
}

.dlp-loading-spinner {
    animation: dlp-spin 1s linear infinite;
}

/* Enhanced Content Type Display */
.dlp-content-type-display-enhanced {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.dlp-content-type-badge-enhanced {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #007bff, #6610f2);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,123,255,0.3);
    margin-bottom: 8px;
}

.dlp-type-icon {
    font-size: 14px;
}

.dlp-type-name {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Content Type Workflow Info */
.dlp-content-type-workflow-info {
    margin-top: 8px;
}

.dlp-workflow-steps {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dlp-step-included,
.dlp-step-skipped {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    cursor: help;
    transition: all 0.3s ease;
}

.dlp-step-included {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border: 1px solid #c3e6cb;
}

.dlp-step-skipped {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.dlp-step-included:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(21,87,36,0.3);
}

.dlp-step-skipped:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(114,28,36,0.3);
}

/* Responsive Design for Content Type Dropdown */
@media (max-width: 768px) {
    .dlp-content-type-selector-enhanced {
        padding: 8px;
    }
    
    .dlp-content-type-dropdown-enhanced {
        font-size: 12px;
        padding: 6px 24px 6px 8px;
    }
    
    .dlp-start-processing-btn-enhanced {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .dlp-content-type-info-panel {
        font-size: 10px;
        padding: 8px;
    }
    
    .dlp-workflow-steps {
        flex-wrap: wrap;
        gap: 4px;
    }
}
