body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f4f4f4;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 30px auto;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

h1, h2, h3 {
    text-align: center;
    color: #0056b3;
}

/* --- Style cho Tab --- */
.tabs {
    display: flex;
    justify-content: center;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
}

.tab-link {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 18px;
    color: #555;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-link:hover {
    color: #0056b3;
}

.tab-link.active {
    color: #007bff;
    border-bottom: 3px solid #007bff;
    font-weight: bold;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}
/* --- Kết thúc Style cho Tab --- */

.input-section, .output-section {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    min-height: 150px;
    box-sizing: border-box;
}

button {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    margin-right: 10px;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #0056b3;
}

button#clearButton {
    background-color: #dc3545;
}

button#clearButton:hover {
    background-color: #c82333;
}

#outputDisplay {
    background-color: #e9ecef;
    padding: 15px;
    border-radius: 5px;
    min-height: 100px;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #ced4da;
}

.scene {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-left: 5px solid #007bff;
    border-radius: 3px;
}

.scene-header {
    font-weight: bold;
    color: #0056b3;
    margin-bottom: 5px;
}

.hidden {
    display: none;
}

#scriptLoadingIndicator, #storyLoadingIndicator {
    text-align: center;
    font-style: italic;
    color: #6c757d;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

button#copyButton {
    background-color: #28a745;
    float: right;
    margin-top: 10px;
}

button#copyButton:hover {
    background-color: #218838;
}

/* --- Style cho phần Tạo truyện --- */
.story-output-section {
    margin-top: 20px;
}
#storyOutput {
    background-color: #fdfdff;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
    white-space: pre-wrap; /* Giữ định dạng xuống dòng */
}

#storyOutput h2, #storyOutput h3 {
    color: #333;
}

#charactersOutput h3 {
    border-top: 2px solid #007bff;
    padding-top: 20px;
}

.character-profile {
    background-color: #f8f9fa;
    border-left: 5px solid #28a745;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 5px;
}

.character-profile strong {
    color: #0056b3;
}
/* --- STYLE MỚI CHO FORM PHÂN TÁCH KỊCH BẢN --- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Tạo 3 cột bằng nhau */
    gap: 20px; /* Khoảng cách giữa các ô */
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 15px;
    background-color: #f9f9f9;
    box-sizing: border-box;
}

.form-group-checkbox {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    grid-column: span 1; /* Chiếm 1 cột */
    padding-top: 25px; /* Căn chỉnh với các ô khác */
}

.form-group-checkbox input {
    margin-right: 10px;
    width: auto;
}

.form-group-checkbox label {
    margin-bottom: 0;
    font-weight: normal;
}

/* Class để một ô chiếm toàn bộ chiều rộng (3 cột) */
.form-group-full {
    grid-column: 1 / -1;
}

.action-buttons {
    text-align: center;
    margin-bottom: 25px;
}

/* --- STYLE MỚI CHO HEADER CỦA OUTPUT --- */
.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.output-header h3 {
    margin: 0;
}

.output-header div button {
    margin-top: 0;
    margin-left: 10px;
}

button#exportButton {
    background-color: #1D6F42; /* Màu xanh của Excel */
}
button#exportButton:hover {
    background-color: #144E2E;
}
/* --- STYLE MỚI CHO NÚT COPY VÀ CONTAINER --- */
.output-container {
    position: relative; /* Quan trọng để định vị nút con */
    background-color: #fdfdff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    margin-top: 20px;
}

.copy-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 20px; /* Làm cho emoji to hơn */
    line-height: 1;
    z-index: 10;
    transition: background-color 0.2s ease;
}

.copy-btn:hover {
    background-color: #5a6268;
}

/* Điều chỉnh lại padding cho các kết quả bên trong */
#storyOutput {
    padding: 10px;
    margin-bottom: 0;
    border: none; /* Bỏ border cũ nếu có */
}
/* --- THÊM STYLE MỚI CHO CONTAINER CỦA HỒ SƠ NHÂN VẬT --- */
.character-output-container {
    position: relative; /* Quan trọng để định vị nút copy bên trong */
    margin-top: 20px; /* Tạo khoảng cách với phần truyện ở trên */
}

/* Điều chỉnh lại nút copy để không bị đè lên tiêu đề "Hồ sơ nhân vật" */
.character-output-container .copy-btn {
    top: 5px; /* Đẩy nút copy lên gần đỉnh hơn */
}

/* --- STYLE CHO TAB YOUTUBE SUBTITLE --- */
.youtube-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
    margin-bottom: 10px; /* Thêm khoảng cách với nút bên dưới */
}

#rewrittenOutput {
    background-color: #e9ecef;
    padding: 15px;
    border-radius: 5px;
    min-height: 150px;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #ced4da;
}

/* Ghi đè lại style cho nút trong output-header để nhất quán */
#rewrittenSection .output-header div button {
    margin-top: 0;
    margin-left: 10px;
    background-color: #28a745;
}

#rewrittenSection .output-header div button:hover {
    background-color: #218838;
}
/* Style cho hộp hiển thị kết quả phân tích video */
.output-display-box {
    background-color: #e9ecef;
    padding: 15px;
    border-radius: 5px;
    min-height: 150px;
    white-space: pre-wrap; /* Giữ nguyên các định dạng xuống dòng và khoảng trắng */
    word-wrap: break-word;
    border: 1px solid #ced4da;
    line-height: 1.6; /* Tăng khoảng cách dòng cho dễ đọc */
}

.output-display-box h3, .output-display-box h4 {
    color: #0056b3;
}

.output-display-box strong {
    color: #333;
}
/* Style cho dropdown menu lựa chọn tác vụ */
.form-group-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
    margin-bottom: 10px;
    background-color: #f9f9f9;
    appearance: none; /* Bỏ giao diện mặc định */
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: .8em auto;
}
/* --- Responsive Design cho Mobile --- */
@media (max-width: 768px) {
    .form-grid {
        /* Trên màn hình nhỏ, chuyển layout từ 3 cột thành 1 cột */
        grid-template-columns: 1fr;
    }

    .form-group-checkbox {
        /* Sắp xếp lại mục checkbox để không bị lệch */
        grid-column: 1 / -1; /* Đảm bảo nó chiếm trọn 1 dòng */
        padding-top: 0;      /* Bỏ khoảng đệm không cần thiết trên mobile */
    }

    /* Giảm padding và margin của container chính để giao diện thoáng hơn trên mobile */
    .container {
        padding: 15px;
        margin: 10px;
    }

    /* Cho phép các nút trong tabs xuống dòng nếu không đủ chỗ */
    .tabs {
        flex-wrap: wrap;
    }
}
/* Thêm vào cuối file style.css */

/* Style cho hộp hiển thị phụ đề gốc */
.transcript-box {
    max-height: 250px; /* Giới hạn chiều cao tối đa */
    overflow-y: auto; /* Thêm thanh cuộn dọc nếu nội dung dài hơn */
    background-color: #f8f9fa; /* Màu nền hơi khác để phân biệt */
}