/* =========================================
   GIAO DIỆN LDT GLASS UI - MASTER STYLE (OPTIMIZED)
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: 1px solid rgba(255, 255, 255, 0.5);
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --text-main: #333;
    --text-muted: #666;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #f0f2f5;
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-main);
}

/* =========================================
   1. NAVBAR & HEADER
   ========================================= */
.navbar-glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.navbar-brand { color: white !important; font-weight: 800; letter-spacing: -0.5px; }
.nav-link, .nav-link-top { color: rgba(255,255,255,0.8) !important; font-weight: 500; transition: 0.2s; }
.nav-link:hover, .nav-link.active, .nav-link-top:hover { color: white !important; transform: translateY(-1px); text-shadow: 0 0 10px rgba(255,255,255,0.3); }

.dropdown-menu { 
    border-radius: 12px; border: none; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.15); 
    background: rgba(255, 255, 255, 0.95); 
    backdrop-filter: blur(10px); 
    z-index: 9999 !important;
}
.dropdown-item { color: #333; }
.dropdown-item:hover { background-color: rgba(0,0,0,0.05); }

.hero-header { padding: 3rem 0 4rem; color: white; text-align: center; }
.hero-title { font-size: 2.2rem; font-weight: 800; margin-bottom: 0.5rem; text-shadow: 0 2px 10px rgba(0,0,0,0.2); }
.hero-subtitle { font-size: 1.1rem; opacity: 0.9; font-weight: 300; }

/* =========================================
   2. GLASS CARDS & CONTAINERS (MAIN FIXES)
   ========================================= */
.main-card, .glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 24px;
    border: var(--glass-border);
    box-shadow: var(--card-shadow);
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    position: relative;
    overflow: hidden;
    
    /* [QUAN TRỌNG] Ép màu chữ bên trong thẻ này luôn là màu tối để dễ đọc */
    color: #333333 !important; 
}

/* Đảm bảo các thành phần bên trong thẻ Glass cũng tối màu */
.glass-card h1, .glass-card h2, .glass-card h3, .glass-card h4, .glass-card h5, .glass-card h6,
.main-card h1, .main-card h2, .main-card h3, .main-card h4, .main-card h5, .main-card h6 {
    color: #1a1a1a !important;
}

.glass-card label.form-label, .main-card label.form-label {
    color: #4b5563 !important; /* Màu xám đậm */
    font-weight: 700;
}

.glass-card .text-muted, .main-card .text-muted {
    color: #6c757d !important;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px 0 rgba(31, 38, 135, 0.2);
    background: rgba(255, 255, 255, 0.95);
}

/* =========================================
   3. BUTTONS & ICONS
   ========================================= */
.btn-modern, .btn-update, .btn-action, .btn-login {
    border: none; padding: 10px 20px; border-radius: 12px;
    font-weight: 700; width: 100%; transition: all 0.2s;
}
.btn-modern:hover, .btn-update:hover, .btn-login:hover { 
    transform: scale(1.02); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.15); 
}

.card-icon-wrapper, .stat-icon {
    width: 60px; height: 60px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    margin-bottom: 1rem;
}

/* Nút Sửa/Xóa nhỏ gọn */
.btn-icon, .action-btn {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; border: none;
    transition: all 0.2s ease; color: white;
}
.btn-icon:hover, .action-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
.btn-edit-user { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); } 
.btn-delete-user { background: linear-gradient(135deg, #ff9966 0%, #ff5e62 100%); }

/* Nút Quick Access */
.quick-link { display: flex; align-items: center; padding: 12px; border-radius: 12px; transition: all 0.2s; text-decoration: none; color: #333; border: 1px solid transparent; }
.quick-link:hover { background: rgba(255,255,255,0.8); border-color: rgba(0,0,0,0.05); transform: translateX(5px); }
.quick-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; margin-right: 15px; background: #f0f2f5; color: #666; }

/* Pricing Button */
.btn-pricing { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; border: none; }
.btn-pricing:hover { color: #fff; filter: brightness(1.1); }

/* =========================================
   4. TABLES & TABS
   ========================================= */
.card-header-custom {
    background: rgba(255,255,255,0.5);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 1.5rem;
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px;
}

/* Nav Pills (Menu Tab con) */
.nav-pills .nav-link {
    border-radius: 50rem; padding: 8px 20px;
    color: #555 !important; /* Màu xám đậm để hiện trên nền trắng */
    font-weight: 600;
    background: transparent; border: 1px solid transparent;
}
.nav-pills .nav-link.active {
    background: #1877f2 !important; 
    color: white !important;
    box-shadow: 0 4px 10px rgba(24, 119, 242, 0.3);
}

.table { --bs-table-bg: transparent; }
.table thead th { 
    background: rgba(0,0,0,0.03); border-bottom: none; 
    color: #666; font-weight: 700; text-transform: uppercase; font-size: 0.8rem; 
    padding: 1rem;
}
.table tbody td { padding: 1rem; vertical-align: middle; border-bottom: 1px solid rgba(0,0,0,0.05); }
.table-hover tbody tr:hover { background-color: rgba(24, 119, 242, 0.05); }

/* Fix màu chữ trong bảng cho các trang quản lý */
.table-glass td { color: #333 !important; }
.table-glass th { color: #6c757d; }

/* =========================================
   5. PROFILE & LOGIN
   ========================================= */
.profile-avatar {
    width: 80px; height: 80px; background: var(--primary-gradient);
    color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; margin-bottom: 1rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.info-label { font-size: 0.85rem; text-transform: uppercase; color: #666; font-weight: 700; margin-bottom: 0.2rem; }
.info-value { font-size: 1.1rem; font-weight: 500; color: #111; margin-bottom: 1.5rem; }

.login-card { max-width: 420px; width: 100%; padding: 20px; }
.logo-icon {
    font-size: 3rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block; margin-bottom: 0.5rem;
}
body.login-page {
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
}

/* =========================================
   6. FORMS
   ========================================= */
.form-control, .form-select {
    border-radius: 12px; border: 1px solid #e0e0e0;
    padding: 12px 15px; background: rgba(255,255,255,0.5);
}
.form-control:focus {
    background: white; border-color: #1877f2;
    box-shadow: 0 0 0 4px rgba(24, 119, 242, 0.1);
}
.input-group-text {
    background: rgba(255,255,255,0.5); border: 1px solid #e0e0e0; border-right: none; color: #667eea;
}

/* =========================================
   7. STATS (Admin)
   ========================================= */
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; margin-bottom: 0.2rem; color: #333; }
.stat-label { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; color: #666; letter-spacing: 0.5px; }

/* =========================================
   8. AUTO VIDEO MANAGEMENT (SPECIFIC STYLES)
   ========================================= */
/* Grid Header & User Card */
.grid-header {
    display: grid;
    grid-template-columns: 220px 1fr 1fr 1fr 140px 100px;
    gap: 1.5rem;
    background: #1e293b; /* Nền tối hẳn cho header bảng */
    color: #fff !important;
    padding: 1rem 1.5rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px 12px 0 0;
}

.user-card {
    background: #fff; /* Nền trắng cho từng user */
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: grid;
    grid-template-columns: 220px 1fr 1fr 1fr 140px 100px;
    gap: 1.5rem;
    align-items: start;
    transition: background 0.2s;
    color: #333 !important;
}
.user-card:hover { background: #f8fafc; }

/* Resource Boxes (Chat/Img/Vid) */
.res-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    position: relative;
}
.res-box.chat { border-left: 4px solid #3b82f6; }
.res-box.img { border-left: 4px solid #8b5cf6; }
.res-box.vid { border-left: 4px solid #ec4899; }

/* Custom Switch & Toggle */
.custom-switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.custom-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #4b5563; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #10b981; }
input:checked + .slider:before { transform: translateX(16px); }

.toggle-wrap { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.toggle-label { font-size: 0.75rem; font-weight: 700; color: #64748b; text-transform: uppercase; }

/* =========================================
   9. FACEBOOK SPECIFIC (Token Card)
   ========================================= */
.token-card {
    background: #f8f9fa; 
    border: 1px solid #e9ecef;
    border-radius: 12px; 
    padding: 15px 30px;
    display: inline-flex; 
    align-items: center; 
    gap: 40px; 
    margin-bottom: 20px;
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.bg-valid { background-color: #31a24c; } 
.bg-invalid { background-color: #dc3545; }
/* =========================================
   12. REGISTER PAGE BUTTON
   ========================================= */
.btn-register {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 114, 255, 0.3);
}

.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 114, 255, 0.4);
    color: white;
}
/* CSS làm xám vùng cấu hình khi tắt đăng ký */
.disabled-config {
    opacity: 0.5;
    pointer-events: none; /* Chặn click */
    filter: grayscale(100%);
    position: relative;
}
/* Icon khóa hiện lên khi disabled */
.disabled-overlay {
    display: none;
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10;
    align-items: center; justify-content: center;
}
.disabled-config .disabled-overlay {
    display: flex;
}

/* =========================================
   PAGE: MODEL & PRICING MANAGEMENT (NEW DESIGN)
   ========================================= */

/* 1. Layout & Glass Card Override */
.equal-row { display: flex; flex-wrap: wrap; }
.equal-col { display: flex; flex-direction: column; }
.glass-card-full-height { 
    height: 100%; 
    display: flex; 
    flex-direction: column; 
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

/* 2. Custom Scrollbar for Table */
.table-scroll-area {
    flex-grow: 1;
    overflow-y: auto;
    max-height: 75vh; /* Giới hạn chiều cao để form không bị trôi */
    padding-right: 5px;
}
.table-scroll-area::-webkit-scrollbar { width: 6px; }
.table-scroll-area::-webkit-scrollbar-track { background: #f1f5f9; }
.table-scroll-area::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.table-scroll-area::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* 3. Badges & Indicators */
.badge-prov { width: 80px; text-align: center; font-weight: 700; letter-spacing: 0.5px; }
.badge-gemini { background: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; }
.badge-chatgpt { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-kling { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

.badge-srv { padding: 6px 12px; border-radius: 8px; font-size: 0.75rem; font-weight: 700; min-width: 90px; display: inline-block; text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.03); }
.srv-chat { color: #0369a1; background: #e0f2fe; border: 1px solid #bae6fd; }
.srv-image { color: #7e22ce; background: #f3e8ff; border: 1px solid #e9d5ff; }
.srv-edit { color: #0f766e; background: #ccfbf1; border: 1px solid #99f6e4; }
.srv-video { color: #be185d; background: #fce7f3; border: 1px solid #fbcfe8; }

.price-display { 
    font-family: 'Consolas', 'Monaco', monospace; 
    font-weight: 700; 
    color: #15803d; 
    background: #f0fdf4; 
    padding: 4px 10px; 
    border-radius: 6px; 
    border: 1px dashed #86efac;
}

/* 4. MODERN RADIO TILES (Giao diện chọn Loại dịch vụ) */
.radio-tile-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.radio-tile-input { display: none; }

.radio-tile-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    color: #64748b;
}

.radio-tile-label i { font-size: 1.5rem; margin-bottom: 6px; transition: 0.2s; }
.radio-tile-label span { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; }

.radio-tile-label:hover { border-color: #cbd5e1; background: #f8fafc; transform: translateY(-2px); }

/* Active States (Màu sắc riêng cho từng loại khi chọn) */
/* Chat: Blue */
.radio-tile-input[value="chat"]:checked + .radio-tile-label {
    border-color: #3b82f6; background: #eff6ff; color: #2563eb;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}
/* Image: Purple */
.radio-tile-input[value="image"]:checked + .radio-tile-label {
    border-color: #9333ea; background: #faf5ff; color: #7e22ce;
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.25);
}
/* Edit: Teal */
.radio-tile-input[value="edit"]:checked + .radio-tile-label {
    border-color: #14b8a6; background: #f0fdfa; color: #0d9488;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.25);
}
/* Video: Pink */
.radio-tile-input[value="video"]:checked + .radio-tile-label {
    border-color: #f43f5e; background: #fff1f2; color: #e11d48;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.25);
}

/* Checkmark icon nhỏ ở góc */
.radio-tile-input:checked + .radio-tile-label::after {
    content: "\F26B"; /* Bootstrap Icon Check code */
    font-family: "bootstrap-icons";
    position: absolute; top: 6px; right: 6px;
    font-size: 0.8rem;
}