/* Custom styles for Kling Video Pro Generator */

#kling-video-pro-generator-app {
    max-width: 900px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border: 1px solid #d4e3f4; /* Màu viền xanh nhạt để phân biệt với plugin cũ */
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#kling-video-pro-generator-app h2 {
    text-align: center;
    color: #2196f3; /* Màu xanh nổi bật hơn */
    margin-bottom: 20px;
}

/* Kế thừa và ghi đè các style chung từ kling-video nếu cần,
   hoặc giữ độc lập hoàn toàn */

.kling-video-pro-credit-display {
    text-align: right;
    margin-bottom: 20px;
    font-size: 1.1em;
    color: #555;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #444;
}

.form-group textarea,
.form-group input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
}

.form-group input[type="file"] {
    display: none;
}

#kling-video-pro-submit-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 1.1em;
    border-radius: 4px;
    cursor: pointer;
    background-color: #2196f3; /* Màu xanh cho nút submit */
    color: #fff;
    border: 1px solid #2196f3;
}

#kling-video-pro-submit-btn:hover {
    background-color: #1976d2;
    border-color: #1976d2;
}


#kling-video-pro-status {
    margin-top: 20px;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
}

/* Sử dụng các lớp tin nhắn chung nhưng có thể tùy chỉnh màu sắc */
#kling-video-pro-status.kling-video-message.processing {
    background-color: #e3f2fd; /* Light blue */
    color: #1565c0; /* Darker blue */
}

#kling-video-pro-status.kling-video-message.success {
    background-color: #e8f5e9;
    color: #2e7d32;
}

#kling-video-pro-status.kling-video-message.error {
    background-color: #ffebee;
    color: #c62828;
}


#kling-video-pro-result {
    margin-top: 20px;
    text-align: center;
}

#kling-video-pro-result video {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 10px;
}

.kling-estimated-cost {
    text-align: right;
    font-weight: bold;
    color: #333;
    font-size: 1.1em;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px dashed #eee;
}

/* Radio button group styles - có thể tái sử dụng hoặc tùy chỉnh */
.video-mode-options,
.video-duration-options,
.video-aspect-ratio-options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.video-mode-options label,
.video-duration-options label,
.video-aspect-ratio-options label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    color: #555;
    background-color: #f0f0f0;
    padding: 8px 15px;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease-in-out;
}

.video-mode-options label:hover,
.video-duration-options label:hover,
.video-aspect-ratio-options label:hover {
    background-color: #e5e5e5;
    border-color: #d0d0d0;
}

.video-mode-options input[type="radio"],
.video-duration-options input[type="radio"],
.video-aspect-ratio-options input[type="radio"] {
    margin-right: 8px;
    margin-bottom: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #aaa;
    border-radius: 50%;
    outline: none;
    cursor: pointer;
    position: relative;
    top: 1px;
    transition: all 0.2s ease-in-out;
}

.video-mode-options input[type="radio"]:checked,
.video-duration-options input[type="radio"]:checked,
.video-aspect-ratio-options input[type="radio"]:checked {
    border-color: #2196f3; /* Màu xanh cho radio checked */
    background-color: #2196f3;
}

.video-mode-options input[type="radio"]:checked::before,
.video-duration-options input[type="radio"]:checked::before,
.video-aspect-ratio-options input[type="radio"]:checked::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background-color: #fff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.video-mode-options input[type="radio"]:checked + span,
.video-duration-options input[type="radio"]:checked + span,
.video-aspect-ratio-options input[type="radio"]:checked + span {
    font-weight: bold;
    color: #333;
}


#kling-pro-image-preview {
    margin-top: 10px;
    padding: 20px;
    text-align: center;
    border-radius: 8px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #fcfcfc;
    border: 2px dashed #ccc;
    cursor: pointer;
    transition: border-color 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

#kling-pro-image-preview.drag-over {
    border-color: #2196f3; /* Màu xanh cho drag-over */
    background-color: #e3f2fd;
}

#kling-pro-image-preview p {
    margin: 5px 0;
    color: #555;
}

#kling-pro-image-preview .dashicons {
    font-size: 40px;
    color: #999;
    margin-bottom: 10px;
}

#kling-pro-image-preview img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    margin-top: 0;
}

/* History Grid Styles - Sử dụng các style chung từ kling-video để đảm bảo nhất quán */
#kling-video-pro-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.kling-video-pro-history-item { /* Lớp riêng để nếu muốn tùy chỉnh về sau */
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.kling-video-pro-history-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.kling-video-pro-history-item .video-thumbnail-placeholder {
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    position: relative;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kling-video-pro-history-item .video-thumbnail-placeholder video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #000;
}

.kling-video-pro-history-item .video-thumbnail-placeholder .loading-animation {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.kling-video-pro-history-item.status-failed .video-thumbnail-placeholder .loading-animation {
    border-top: 5px solid #dc3545;
    animation: none;
    background-color: rgba(220, 53, 69, 0.5);
    border-color: rgba(220, 53, 69, 0.3);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.kling-video-pro-history-item .item-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.kling-video-pro-history-item .item-prompt {
    font-weight: bold;
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    font-size: 0.95em;
    min-height: 40px; 
}

.kling-video-pro-history-item .item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8em;
    color: #777;
    margin-bottom: 10px;
}

.kling-video-pro-history-item .status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
}

.kling-video-pro-history-item.status-starting .status-badge,
.kling-video-pro-history-item.status-processing .status-badge {
    background-color: #2196f3; /* Màu xanh cho status process */
}

.kling-video-pro-history-item.status-succeeded .status-badge {
    background-color: #28a745;
}

.kling-video-pro-history-item.status-failed .status-badge,
.kling-video-pro-history-item.status-canceled .status-badge {
    background-color: #dc3545;
}

.kling-video-pro-history-item .item-actions {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.kling-video-pro-history-item .action-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.9em;
    color: #555;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.kling-video-pro-history-item .action-btn:hover {
    background-color: #e5e5e5;
    border-color: #ccc;
    color: #333;
}

.kling-video-pro-history-item .action-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
}

.kling-video-pro-load-more-container {
    text-align: center; 
    margin-top: 30px;
}

#kling-video-pro-load-more-btn {
    padding: 10px 20px;
    font-size: 1em;
    border-radius: 5px;
    background-color: #2196f3; /* Màu xanh cho nút load more */
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#kling-video-pro-load-more-btn:hover:not(:disabled) {
    background-color: #1976d2;
}

#kling-video-pro-load-more-btn:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
}

.kling-video-pro-loading-history {
    grid-column: 1 / -1; 
    text-align: center;
    padding: 20px;
    font-style: italic;
    color: #888;
}

#kling-video-pro-history-grid .no-videos,
#kling-video-pro-history-grid .no-videos-placeholder {
    grid-column: 1 / -1; 
    text-align: center;
    color: #888;
    padding: 20px;
    font-style: italic;
}

/* Responsive adjustments for the grid */
@media (min-width: 901px) { 
    #kling-video-pro-history-grid {
        grid-template-columns: repeat(4, 1fr); 
    }
}

@media (max-width: 900px) { 
    #kling-video-pro-history-grid {
        grid-template-columns: repeat(3, 1fr); 
    }
}

@media (max-width: 600px) { 
    #kling-video-pro-history-grid {
        grid-template-columns: repeat(2, 1fr); 
        gap: 15px;
    }
}

@media (max-width: 480px) { 
    #kling-video-pro-history-grid {
        grid-template-columns: 1fr; 
        gap: 15px;
    }
    .kling-video-pro-history-item .item-content {
        padding: 10px;
    }
    .kling-video-pro-history-item .item-prompt {
        font-size: 0.9em;
        min-height: auto;
    }
}