/* ===== CSS HOÀN CHỈNH - RESPONSIVE TỐI ƯU ===== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* ===== WRAPPER - FLEX LAYOUT ===== */
.wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER - RESPONSIVE ===== */
.header {
    background: rgba(0, 0, 0, 0.8);
    padding: clamp(0.5rem, 2vw, 1rem);
    text-align: center;
    backdrop-filter: blur(10px);
    position: relative;
}

.hamburger {
    position: absolute;
    left: clamp(0.5rem, 2vw, 1rem);
    top: 50%;
    transform: translateY(-50%);
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    color: white;
    cursor: pointer;
    z-index: 1000;
    display: none; /* ẨN DESKTOP */
    transition: opacity 0.3s;
}

/* ===== MAIN CONTENT - FLUID FLEX ===== */
.main-content {
    flex: 1;
    display: flex;
    padding: clamp(0.5rem, 2vw, 1rem);
    gap: clamp(0.5rem, 2vw, 1rem);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ===== SIDEBAR - RESPONSIVE ===== */
.sidebar {
    width: clamp(200px, 18vw, 250px);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: clamp(0.75rem, 2vw, 1rem);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    transition: transform 0.3s ease; /* ANIMATION MỚI */
    transform: translateX(-100%); /* ẨN BẰNG DEFAULT */
}

.sidebar.active {
    transform: translateX(0); /* HIỂN THỊ */
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar h3 {
    margin-bottom: clamp(0.75rem, 2vw, 1rem);
    color: #333;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
}

.sidebar ul { list-style: none; }
.sidebar ul li { margin-bottom: 0.5rem; }

.sidebar ul li a {
    text-decoration: none;
    color: #666;
    display: block;
    padding: clamp(0.4rem, 1.5vw, 0.5rem);
    border-radius: 5px;
    transition: all 0.3s;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
}

.sidebar ul li a:hover {
    background: #667eea;
    color: white;
}

/* ===== CENTER CONTENT - FLUID ===== */
.center-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: clamp(0.75rem, 2vw, 1rem);
    min-width: 0; /* Cho phép shrink */
}

.form-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: clamp(8px, 2vw, 10px);
    padding: clamp(1rem, 3vw, 1.5rem);
    backdrop-filter: blur(10px);
}

.form-container .card {
    background: transparent;
    border: none;
    box-shadow: none;
}

/* ===== FORM ELEMENTS - RESPONSIVE ===== */
.container { 
    max-width: 100%; 
    width: 100%;
    margin: clamp(1rem, 3vw, 2rem) auto;
    background: rgba(255,255,255,0.95);
    border-radius: clamp(10px, 3vw, 20px);
    padding: clamp(1rem, 3vw, 2rem);
    box-shadow: 0 clamp(10px, 3vw, 20px) clamp(20px, 5vw, 40px) rgba(0,0,0,0.1);
}

.card { 
    border: none; 
    border-radius: clamp(8px, 2vw, 15px); 
    box-shadow: 0 clamp(5px, 2vw, 10px) clamp(10px, 3vw, 30px) rgba(0,0,0,0.1);
}

.form-control, .form-select {
    border-radius: clamp(6px, 2vw, 10px);
    border: 2px solid #e9ecef;
    padding: clamp(0.6rem, 2vw, 0.75rem);
    font-size: clamp(0.85rem, 2.5vw, 1rem);
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* ===== BUTTONS - RESPONSIVE ===== */
.btn {
    border-radius: clamp(6px, 2vw, 10px);
    padding: clamp(0.6rem, 2vw, 0.75rem) clamp(1rem, 4vw, 1.5rem);
    font-weight: 600;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border: none;
}

.btn-success { background-color: #28a745; border-radius: clamp(6px, 2vw, 10px); }
.btn-danger { background-color: #dc3545; border-radius: clamp(6px, 2vw, 10px); }
.btn-info { background-color: #17a2b8; border-radius: clamp(6px, 2vw, 10px); }
.btn-warning { background-color: #ffc107; border-radius: clamp(6px, 2vw, 10px); }

#download-all { 
    border-radius: clamp(6px, 2vw, 10px);
    font-size: clamp(1rem, 3vw, 1.1em);
}

/* ===== PROMPT ITEMS - RESPONSIVE ===== */
#prompt-list { margin-top: clamp(1rem, 3vw, 1.25rem); }

.prompt-item { 
    padding: clamp(0.75rem, 2.5vw, 1rem); 
    border: 2px solid #ddd; 
    margin-bottom: clamp(0.5rem, 2vw, 0.625rem); 
    border-radius: clamp(8px, 2vw, 15px);
    transition: all 0.3s ease;
    position: relative;
}

.prompt-item:hover { transform: translateY(-2px); }



.progress { 
    height: clamp(4px, 1vw, 8px); 
    border-radius: clamp(2px, 1vw, 10px); 
}

.progress-bar { border-radius: clamp(2px, 1vw, 10px); }

/* ===== PLATFORMS - RESPONSIVE GRID ===== */
.platforms-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: clamp(8px, 2vw, 10px);
    padding: clamp(1rem, 3vw, 1.5rem);
    backdrop-filter: blur(10px);
}

.platforms-container h2 {
    margin-bottom: clamp(0.75rem, 2vw, 1rem);
    color: #333;
    font-size: clamp(1.1rem, 3vw, 1.25rem);
}

.platforms-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(120px, 22vw, 150px), 1fr));
    gap: clamp(0.75rem, 2vw, 1rem);
}

.platform-item a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    padding: clamp(0.75rem, 2vw, 1rem);
    border: 2px solid #e0e0e0;
    border-radius: clamp(6px, 2vw, 10px);
    transition: all 0.3s;
}

.platform-item img {
    width: clamp(30px, 6vw, 40px);
    height: clamp(30px, 6vw, 40px);
    margin-bottom: 0.5rem;
}

/* ===== RIGHT SIDEBAR ===== */
.right-sidebar {
    width: clamp(200px, 18vw, 250px);
    flex-shrink: 0;
}

.right-sidebar h3 {
    margin-bottom: clamp(0.75rem, 2vw, 1rem);
    color: #333;
}

/* ===== AD BOXES - RESPONSIVE SIZES ===== */
.ad-box {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: clamp(6px, 2vw, 10px);
    padding: clamp(0.5rem, 2vw, 1rem);
    margin-bottom: clamp(0.5rem, 2vw, 1rem);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    overflow: hidden;
}

.ad-placeholder {
    color: #6c757d;
    font-style: italic;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    max-width: 100%;
    word-wrap: break-word;
}

/* SPECIFIC AD POSITIONS */
#sidebar-ad-left, #right-ad-1, #right-ad-2 {
    width: 100%;
    height: clamp(80px, 12vw, 120px);
    max-width: clamp(180px, 16vw, 230px);
}

#below-form-ad {
    width: 100%;
    height: clamp(90px, 15vw, 150px);
    max-width: 100%;
    margin: clamp(0.75rem, 2vw, 1rem) auto;
    background: #fff3cd;
    border-color: #ffeaa7;
}

#below-form-ad:hover { background: #fff8dc; border-color: #667eea; }

#footer-ad {
    width: 100%;
    height: clamp(60px, 10vw, 100px);
    max-width: 100%;
    background: #e8f5e8;
    border-color: #c3e6c3;
}

#footer-ad:hover { background: #d4edda; border-color: #28a745; }

/* ===== FOOTER ===== */
.footer {
    background: rgba(0, 0, 0, 0.8);
    padding: clamp(1rem, 4vw, 2rem) clamp(0.5rem, 2vw, 1rem);
    text-align: center;
    color: white;
    backdrop-filter: blur(10px);
}

.footer p { margin-bottom: clamp(0.5rem, 2vw, 1rem); }

.social-links {
    margin-top: clamp(0.5rem, 2vw, 1rem);
}

.social-links a {
    color: #fff;
    text-decoration: none;
    margin: 0 clamp(0.25rem, 1vw, 0.5rem);
    font-size: clamp(0.85rem, 2vw, 0.95rem);
}

/* ===== MOBILE FIRST BREAKPOINTS ===== */
@media (min-width: 1025px) {
    .sidebar {
        transform: translateX(0); /* HIỂN THỊ */
        position: relative;
    }
    .hamburger { display: none !important; }
}

@media (max-width: 1024px) {
    .main-content { flex-direction: column; gap: clamp(0.5rem, 3vw, 1rem); }
    .hamburger { display: block !important; }
    .sidebar { 
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 999;
        width: 80%;
        max-width: 300px;
        transform: translateX(-100%);
    }
    .center-content { width: 100%; }
}

@media (max-width: 768px) {
    .hamburger { display: block; }
    
    .form-container, .platforms-container {
        padding: clamp(0.75rem, 3vw, 1rem);
    }
    
    .platforms-list {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: clamp(0.5rem, 3vw, 0.75rem);
    }
}

@media (max-width: 480px) {
    .sidebar { width: 85%; }
    .platforms-list {
        grid-template-columns: 1fr;
    }
    
    .container {
        margin: 0;
        border-radius: 0;
        padding: clamp(0.5rem, 4vw, 1rem);
    }
    
    #prompt-list { margin-top: clamp(0.75rem, 4vw, 1rem); }
    
    .prompt-item {
        padding: clamp(0.5rem, 4vw, 0.75rem);
        margin-bottom: clamp(0.25rem, 2vw, 0.5rem);
    }
}

/* ===== LOADING ANIMATION ===== */
.ad-placeholder::before {
    content: "📺 ";
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== MODAL RESPONSIVE ===== */
@media (max-width: 576px) {
    .modal-dialog {
        margin: clamp(0.25rem, 2vw, 0.5rem);
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: clamp(6px, 2vw, 10px);
    }
    
    .card-body { padding: clamp(0.5rem, 3vw, 1rem); }
}

.horizontal-card {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 800px;
    height: 120px;
    border-radius: 8px;
    padding: 12px;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 12px;
}

.horizontal-card.status-pending { background: #f5f5f5; }
.horizontal-card.status-processing { background: #fff3cd; }
.horizontal-card.status-done { background: #d4edda; }
.horizontal-card.status-error { background: #f8d7da; }
.horizontal-card.status-deleted { background: #d3d3d3; }

.thumbnail-container {
    position: relative;
    flex-shrink: 0;
}

.thumbnail {
    width: 160px;
    height: 116px;
    background: #ddd;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    cursor: default;
}

.thumbnail.thumbnail-clickable {
    cursor: pointer;
}

/* .status-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    pointer-events: none;
} */

.status-overlay {
    
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.5); /* Nền tối nhẹ để nổi bật văn bản */
    color: white;
    font-weight: bold;
    font-size: 1.5em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); /* Bóng để dễ đọc */
    pointer-events: none;
}

.prompt-section {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.prompt-text {
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    overflow: hidden;
    max-height: 80px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
}

.progress {
    height: 10px;
    margin-top: 4px;
    display: none;
}

.buttons-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 100px;
}

.btn {
    padding: 0 12px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    height: 28px;
    line-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-retry { background: #FF6B6B; color: white; }
.btn-retry:hover { background: #FF5252; }
.btn-download { background: #4CAF50; color: white; }
.btn-download:hover { background: #45a049; }
.btn-edit { background: #2196F3; color: white; }
.btn-edit:hover { background: #1976D2; }
.btn-delete { background: #dc3545; color: white; }
.btn-delete:hover { background: #c82333; }





.cropper-container {
    max-width: 100%;
    max-height: 60vh; /* Giới hạn chiều cao */
    margin: 0 auto;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
}

.cropper-container img {
    max-width: 100%;
    display: block;
}



.cropper-container {
    width: 100%;
    height: 60vh;           /* ĐÃ SỬA: max-height → height */
    max-height: 70vh;
    margin: 0 auto;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
    position: relative;
}

.cropper-container img {
    max-width: 100%;
    display: block;
}


/* Mode Switcher - Hàng ngang */
.mode-switcher {
    display: flex;
    flex-wrap: nowrap;                   /* luôn nằm ngang */
    justify-content: center;
    align-items: center;
    gap: 15px;
    width: 100%;                         /* container chiếm hết chiều rộng */
}

/* Nâng cao nút mode */
.mode-btn {
    min-width: 120px;                     /* tối thiểu */
    min-height: 50px;
    padding: 0.8rem 1.5rem;
    font-weight: 700;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    border: 2px solid #555;
    border-radius: 12px;
    background: linear-gradient(145deg, #222, #333);
    color: #ccc;
    transition: all 0.25s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 5px 10px rgba(0,0,0,0.3);

    width: clamp(120px, 40%, 180px);      /* tự co theo container nhưng không vượt quá 40% mỗi nút */
    box-sizing: border-box;
}

/* Hover */
.mode-btn:hover:not(.active) {
    background: #444;
    border-color: #666;
    color: #fff;
}

.mode-btn:hover {
    background: linear-gradient(145deg, #444, #555);
    color: #fff;
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 15px rgba(0,123,255,0.4);
}

/* Active */
.mode-btn.active {
    background: linear-gradient(145deg, #007bff, #0056b3);
    color: #fff !important;
    border-color: #007bff;
    box-shadow: 0 0 20px rgba(0, 123, 255, 0.6), 0 0 30px rgba(0, 123, 255, 0.3) inset;
    transform: translateY(-1px) scale(1.05);
}

/* Click */
.mode-btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

/* Spinner */
.mode-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 12px;
}

.mode-loading img {
    width: 32px;
    height: 32px;
    filter: brightness(0) invert(1);
    animation: spin 1s linear infinite;
}

/* Animation quay spinner */
@keyframes spin {
    0% { transform: rotate(0deg);}
    100% { transform: rotate(360deg);}
}

/* Modal body */
.modal-body {
    padding: 1rem;
    background: #f8f9fa;
    position: relative;
}



.toast-item {
    /* Vị trí cố định sát phải */
    position: fixed; 
    right: 20px; /* Khoảng cách lề phải cho màn hình lớn */
    z-index: 9999;

    /* Kích thước và hình thức mặc định */
    min-width: 300px;
    max-width: 400px; 
    font-size: 16px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    margin-bottom: 10px;

    /* Transition cho hiệu ứng mượt mà (top, opacity, transform) */
    transition: 
        top 0.5s ease-out, 
        opacity 0.3s ease-in-out, 
        transform 0.3s ease-in-out; 
    
    /* Trạng thái mặc định (Ẩn và thu nhỏ) */
    opacity: 0; 
    transform: scale(0.5); 
}

/* TRẠNG THÁI XUẤT HIỆN */
.toast-item.show {
    opacity: 1; 
    transform: scale(1); 
}

/* TRẠNG THÁI BIẾN MẤT */
.toast-item.closing {
    opacity: 0; 
    transform: scale(0.5);
}

/* ========================================================== */
/* MEDIA QUERY: Tối ưu hóa cho màn hình nhỏ (Mobile) */
/* ========================================================== */
@media (max-width: 600px) {
    .toast-item {
        /* Đảm bảo toast không bao giờ lớn hơn 40% chiều rộng màn hình */
        max-width: 40%;
        min-width: unset; /* Cho phép nó co lại nếu nội dung nhỏ */

        /* Giảm khoảng cách lề phải */
        right: 10px; 
        
        /* Giảm kích thước chữ */
        font-size: 13px;
    }
    
    /* TRẠNG THÁI MẶC ĐỊNH trên mobile */
    .toast-item {
        /* Chỉ scale, không cần dịch chuyển (translateX) vì đã dùng 'right' */
        transform: scale(0.5); 
    }

    /* TRẠNG THÁI XUẤT HIỆN trên mobile */
    .toast-item.show {
        transform: scale(1); 
    }

    /* TRẠNG THÁI BIẾN MẤT trên mobile */
    .toast-item.closing {
        transform: scale(0.5);
    }
}





#upload-box-1, #upload-box-2 {
    position: relative; 
    overflow: hidden; /* Cần thiết nếu ảnh to hơn khung */
    padding: 10px; /* Thêm padding để nút X không bị dính sát mép */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%; /* Giả sử bạn có chiều cao cố định cho hộp này */
}

/* Định vị nút xóa ở góc trên bên phải */
.remove-image-btn {
    position: absolute;
    top: 5px; 
    right: 5px; 
    z-index: 10; /* Đảm bảo nút nằm trên ảnh */
    opacity: 0.9;
    background-color: white; /* Thêm nền trắng để dễ nhìn trên mọi ảnh */
    border-radius: 50%;
    width: 25px; /* Tăng kích thước chút */
    height: 25px;
    padding: 0;
    line-height: 1; /* Căn giữa dấu X */
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

/* Tùy chỉnh dấu X của Bootstrap để trông rõ ràng hơn */
.remove-image-btn:hover {
    opacity: 1;
}

/* Đảm bảo nút X của Bootstrap có màu sắc và hiển thị đúng */
.btn-close:before {
    color: black;
    /* Dấu X của Bootstrap là background image, không phải content: "\00d7" */
}


.form-check-label i {
        cursor: pointer;
        opacity: 0.6;
        transition: opacity 0.2s;
    }
.form-check-label i:hover {
    opacity: 1;
    color: #0d6efd;
}
