/* KnowAI Videos Frontend Styles */

.knowvid-generator {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.knowvid-generator h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.knowvid-field {
    margin-bottom: 20px;
}

.knowvid-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.knowvid-field input,
.knowvid-field select,
.knowvid-field textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.knowvid-field textarea {
    min-height: 100px;
    resize: vertical;
}

.char-counter {
    text-align: right;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.char-counter .current {
    font-weight: bold;
}

.char-counter.over-limit .current {
    color: #dc3232;
}

/* Upload Area */
.knowvid-upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    transition: border-color 0.3s ease;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.knowvid-upload-area:hover {
    border-color: #0073aa;
}

.knowvid-upload-area.dragover {
    border-color: #0073aa;
    background-color: #f0f8ff;
}

.upload-placeholder {
    cursor: pointer;
    pointer-events: auto;
}

.upload-placeholder span {
    display: block;
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
    cursor: pointer;
}

.upload-placeholder small {
    color: #666;
    font-size: 12px;
}

.upload-preview {
    position: relative;
    display: inline-block;
}

.upload-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.remove-image {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #dc3232;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.reference-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.reference-preview {
    position: relative;
    display: inline-block;
}

.reference-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Submit Button */
.knowvid-submit-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
}

.knowvid-submit-btn:hover {
    background: #005a87;
}

.knowvid-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-loading {
    display: none;
}

.knowvid-submit-btn.loading .btn-text {
    display: none;
}

.knowvid-submit-btn.loading .btn-loading {
    display: inline;
}

/* Gallery Styles */
.knowvid-gallery {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.gallery-header h3 {
    margin: 0;
    color: #333;
}

.gallery-controls {
    display: flex;
    gap: 10px;
}

.gallery-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
}

.gallery-filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.task-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.task-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.task-card.bulk-selected {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.2);
}

.task-preview {
    position: relative;
    height: 200px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-preview img,
.task-preview video {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.task-preview .placeholder {
    color: #666;
    font-size: 14px;
}

.bulk-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 20px;
    height: 20px;
    display: none;
}

.bulk-mode .bulk-checkbox {
    display: block;
}

.task-info {
    padding: 15px;
}

.task-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.task-prompt {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
}

.task-status {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-pending .status-indicator {
    background: #ffb900;
}

.status-running .status-indicator {
    background: #0073aa;
    animation: pulse 1.5s infinite;
}

.status-completed .status-indicator {
    background: #46b450;
}

.status-failed .status-indicator {
    background: #dc3232;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: #0073aa;
    transition: width 0.3s ease;
}

.task-actions {
    display: flex;
    gap: 10px;
}

.task-actions .button {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    font-size: 12px;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    cursor: pointer;
}

.task-actions .button:hover {
    background: #f5f5f5;
}

.task-actions .button.primary {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.task-actions .button.primary:hover {
    background: #005a87;
}

.task-actions .button.danger {
    background: #dc3232;
    color: white;
    border-color: #dc3232;
}

.task-actions .button.danger:hover {
    background: #c62d2d;
}

.gallery-pagination {
    text-align: center;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Notifications */
.knowvid-notifications {
    position: relative;
    display: inline-block;
}

.notification-bell {
    cursor: pointer;
    position: relative;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.notification-bell:hover {
    background: #f0f0f0;
}

.bell-icon {
    font-size: 18px;
}

.notification-count {
    position: absolute;
    top: 0;
    right: 0;
    background: #dc3232;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 11px;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: 320px;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.notification-header h4 {
    margin: 0;
    font-size: 14px;
    color: #333;
}

.mark-all-read {
    background: none;
    border: none;
    color: #0073aa;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
}

.notification-list {
    max-height: 250px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.notification-item:hover {
    background: #f9f9f9;
    transform: translateX(2px);
}

.notification-item::after {
    content: '→';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #0073aa;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.notification-item:hover::after {
    opacity: 1;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-title {
    font-weight: bold;
    font-size: 13px;
    color: #333;
    margin-bottom: 3px;
}

.notification-time {
    font-size: 11px;
    color: #999;
}

.no-notifications {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.notification-footer {
    padding: 10px 15px;
    border-top: 1px solid #eee;
    text-align: center;
}

.notification-footer a {
    color: #0073aa;
    text-decoration: none;
    font-size: 12px;
}

.notification-footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .knowvid-generator {
        margin: 10px;
        padding: 15px;
    }
    
    .gallery-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .gallery-filters {
        flex-direction: column;
        gap: 10px;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .task-actions {
        flex-direction: column;
    }
    
    .notification-dropdown {
        width: 280px;
        right: -20px;
    }
}

/* Error and Success Messages */
.knowvid-message {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

.knowvid-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.knowvid-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.knowvid-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Loading Spinner */
.knowvid-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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