/* CONTAINER & GENERAL */
.ldv-container { width: 100%; max-width: 900px; margin: 20px auto; background: #fff; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); overflow: hidden; font-family: Arial, sans-serif; position: relative; box-sizing: border-box; }
.ldv-container * { box-sizing: border-box; }
.ldv-header-info { padding: 15px 20px; background: #f1f3f5; display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: #444; }
.ldv-header-info strong { color: #ff0000; font-size: 16px; font-weight: bold; }
.ldv-btn-buy { display: inline-block; padding: 8px 15px; background-color: #ff9800; color: #fff !important; text-decoration: none !important; border-radius: 4px; font-weight: bold; font-size: 13px; transition: 0.3s; }
.ldv-btn-buy:hover { background-color: #f57c00; }

/* TABS */
.ldv-main-tabs { display: flex; border-bottom: 2px solid #e0e0e0; background: #fff; }
.ldv-main-tab-btn { flex: 1; padding: 15px; font-size: 15px; font-weight: bold; color: #666; background: #fff; border: none; cursor: pointer; transition: 0.3s; display: flex; justify-content: center; align-items: center; gap: 8px; }
.ldv-main-tab-btn:hover { background: #f9f9f9; color: #333; }
.ldv-main-tab-btn.active { color: #0277bd; border-bottom: 3px solid #0277bd; }
.ldv-view-section { display: none; padding: 20px; animation: fadeIn 0.4s; }
.ldv-view-section.active { display: block; }
.ldv-form-wrapper { max-width: 600px; margin: 0 auto; }
.ldv-sub-tabs { display: flex; margin-bottom: 20px; border-radius: 6px; overflow: hidden; border: 1px solid #ddd; }
.ldv-sub-tab-btn { flex: 1; padding: 10px; background: #f5f5f5; border: none; border-right: 1px solid #ddd; cursor: pointer; font-weight: 600; color: #555; }
.ldv-sub-tab-btn:last-child { border-right: none; }
.ldv-sub-tab-btn.active { background: #0277bd; color: #fff; }
.ldv-sub-tab-content { display: none; }
.ldv-sub-tab-content.active { display: block; animation: slideIn 0.3s; }

/* INPUTS */
.ldv-form-group { margin-bottom: 20px; }
.ldv-form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; position: relative; }
.ldv-file-upload { border: 2px dashed #ccc; padding: 30px; text-align: center; background: #fafafa; border-radius: 8px; position: relative; cursor: pointer; transition: all 0.2s ease; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ldv-file-upload:hover { border-color: #0277bd; background: #e1f5fe; }
.ldv-file-upload input { position: absolute; top:0; left:0; width:100%; height:100%; opacity:0; cursor: pointer; z-index: 2; }
.ldv-upload-content { pointer-events: none; z-index: 1; }
.ldv-upload-icon { font-size: 48px; width: 48px; height: 48px; color: #bbb; margin-bottom: 10px; transition: color 0.3s; display: block; margin-left: auto; margin-right: auto; }
.ldv-file-upload:hover .ldv-upload-icon { color: #0277bd; }
.ldv-file-name { margin: 0; color: #666; font-size: 14px; font-weight: 500; }
.ldv-preview-box { margin-top: 10px; background: #000; border-radius: 4px; overflow: hidden; display: none; }
.ldv-preview-box video, .ldv-preview-box img { width: 100%; max-height: 250px; object-fit: contain; display: block; }
.ldv-preview-box audio { width: 100%; margin-top: 4px; }
.ldv-est-cost { margin-top: 5px; padding: 8px; background: #fff3e0; color: #e65100; border-radius: 4px; font-size: 13px; display: none; }
.ldv-tooltip { display: inline-block; margin-left: 5px; color: #0277bd; cursor: help; position: relative; font-size: 16px; vertical-align: middle; z-index: 10; }
.ldv-tooltip-text { visibility: hidden; opacity: 0; width: 280px; background-color: #333; color: #fff; text-align: left; border-radius: 6px; padding: 10px; position: absolute; z-index: 100; bottom: 125%; left: 50%; transform: translateX(-50%); transition: opacity 0.3s; font-size: 13px; font-weight: normal; line-height: 1.5; box-shadow: 0 4px 10px rgba(0,0,0,0.2); pointer-events: none; }
.ldv-tooltip-text::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border-width: 5px; border-style: solid; border-color: #333 transparent transparent transparent; }
.ldv-tooltip:hover .ldv-tooltip-text { visibility: visible; opacity: 1; }
.ldv-btn-primary { width: 100%; padding: 12px; background: #0277bd; color: #fff; font-size: 16px; font-weight: bold; border: none; border-radius: 4px; cursor: pointer; margin-top: 10px; }
.ldv-btn-primary:hover { background: #01579b; }
.ldv-history-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.ldv-grid-item { background: #fff; border: 1px solid #eee; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.05); position: relative; }
.ldv-grid-item video { width: 100%; height: 160px; object-fit: contain; background: #000; display: block; }
.ldv-item-info { padding: 8px; text-align: center; font-size: 12px; line-height: 1.4; border-top: 1px solid #eee; }
.ldv-dl-btn { display: block; margin: 0 10px 10px; padding: 6px; background: #43a047; color: #fff !important; text-decoration: none !important; border-radius: 4px; text-align: center; font-size: 12px; }
.ldv-processing-grid { height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #f0f7ff; color: #0277bd; font-size: 12px; font-weight: 600; text-align: center; padding: 10px; }
.ldv-mini-bar { width: 60%; height: 6px; background: #e0e0e0; border-radius: 3px; margin-top: 8px; overflow: hidden; }
.ldv-mini-bar-inner { height: 100%; background: linear-gradient(90deg, #0277bd, #4fc3f7, #0277bd); background-size: 200% 100%; animation: shimmer 1.5s infinite linear; width: 100%; }
.ldv-mode-label { position: absolute; top: 8px; left: 8px; z-index: 5; padding: 3px 6px; border-radius: 3px; font-size: 10px; font-weight: bold; color: #fff; text-transform: uppercase; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.label-lipsync { background: #e91e63; } .label-talking { background: #9c27b0; }
.ldv-loading-overlay { position: absolute; top:0;left:0;right:0;bottom:0; background:rgba(255,255,255,0.95); z-index:99; display:flex; align-items:center; justify-content:center; }
.ldv-progress-wrapper { width: 80%; max-width: 400px; text-align: center; }
.ldv-progress-text { font-size: 16px; font-weight: bold; color: #333; margin-bottom: 10px; }
.ldv-progress-container { width: 100%; height: 12px; background: #e0e0e0; border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.ldv-progress-bar { height: 100%; background: linear-gradient(90deg, #0277bd, #00a2e8); width: 0%; transition: width 0.3s ease-out; border-radius: 6px; }
.ldv-progress-note { font-size: 13px; color: #666; font-style: italic; }
.ldv-error-msg { color: #d32f2f; text-align: center; margin-top: 10px; display: none; }
.ldv-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 10000; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.3s; }
.ldv-modal-content { background: #fff; width: 90%; max-width: 400px; padding: 30px; border-radius: 12px; text-align: center; box-shadow: 0 10px 25px rgba(0,0,0,0.2); position: relative; animation: slideUp 0.3s; }
.ldv-modal-icon { font-size: 50px; color: #ff9800; margin-bottom: 15px; }
.ldv-modal-icon .dashicons { width: 50px; height: 50px; font-size: 50px; }
#ldv-modal-title { margin: 0 0 10px; color: #333; font-size: 20px; }
#ldv-modal-message { color: #666; font-size: 15px; line-height: 1.5; margin-bottom: 20px; }
.ldv-modal-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ldv-modal-close-btn { width: auto !important; padding: 8px 25px !important; }

@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }
@keyframes slideUp { from{transform:translateY(20px);opacity:0;} to{transform:translateY(0);opacity:1;} }

/* --- RESPONSIVE OPTIMIZATION (MOBILE) --- */
@media (max-width: 600px) {
    /* Header gọn hơn */
    .ldv-header-info { padding: 12px 15px; }
    
    /* Tabs chính */
    .ldv-main-tab-btn { padding: 12px; font-size: 13px; }
    .ldv-main-tab-btn .dashicons { font-size: 16px; width: 16px; height: 16px; }

    /* Tabs con (Sub tabs) - Quan trọng */
    .ldv-sub-tab-btn {
        padding: 10px 5px; /* Giảm padding ngang */
        font-size: 13px;   /* Giảm cỡ chữ */
        white-space: nowrap; /* Cố gắng giữ 1 dòng */
    }
    
    /* Upload Box */
    .ldv-file-upload { padding: 20px; }
    .ldv-upload-icon { font-size: 32px; width: 32px; height: 32px; }
    
    /* Grid 1 cột */
    .ldv-history-grid { grid-template-columns: 1fr; }
}

/* Nếu màn hình quá nhỏ (iPhone 5/SE), cho phép xuống dòng nhẹ */
@media (max-width: 360px) {
    .ldv-sub-tab-btn { white-space: normal; line-height: 1.2; font-size: 12px; }
}
/* --- MOBILE OPTIMIZATION (V1) --- */
@media (max-width: 600px) {
    /* 1. Xử lý Header: Chia thành 2 dòng cho thoáng */
    .ldv-header-info {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px;
    }
    .ldv-header-left, .ldv-header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    /* 2. Tinh chỉnh Font chữ Header */
    .ldv-title { font-size: 16px !important; }
    .ldv-balance { font-size: 13px !important; }
    
    /* 3. Thu nhỏ nút Nạp Credit */
    .ldv-btn-buy {
        padding: 4px 10px !important;
        font-size: 11px !important;
    }

    /* 4. Tối ưu Tabs chính (Tạo Video / Kết quả) */
    .ldv-main-tab-btn {
        padding: 8px 5px !important;
        font-size: 13px !important;
        white-space: nowrap;
    }

    /* 5. Tối ưu Tabs con (Video Nhép / Ảnh Nói) */
    .ldv-sub-tabs {
        display: flex;
        gap: 5px;
    }
    .ldv-sub-tab-btn {
        flex: 1;
        padding: 8px 2px !important;
        font-size: 12px !important;
        text-align: center;
        white-space: nowrap;
    }
}