/* ==============================================================================
   ENKV CLOUD PLATFORM - MODERN DESIGN SYSTEM (LIGHT BLUE / DARK MODE TOGGLE)
   Empower · Network · Knowledge · Vision | Connect · Innovate · Grow
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ==============================================================================
   1. COLOR TOKENS: TÔNG SÁNG TRẮNG XANH DƯƠNG NHẠT (MẶC ĐỊNH)
   ============================================================================== */
:root, [data-theme="light"] {
    --bg-base: #f0f5fa;                    /* Nền trắng ánh xanh dịu mắt */
    --bg-surface: #ffffff;                 /* Nền các thẻ Card, Navbar, Sidebar màu trắng tinh */
    --bg-surface-elevated: #f8fafc;        /* Nền phân cấp nhẹ cho input, header bảng */
    --bg-glass: rgba(255, 255, 255, 0.90); /* Hiệu ứng mờ nền kính trắng */
    
    --primary: #2563eb;                    /* Xanh dương chủ đạo (Royal Blue) */
    --primary-hover: #1d4ed8;
    --primary-glow: rgba(37, 99, 235, 0.20);
    
    --accent-cyan: #0284c7;                /* Xanh biển nhạt */
    --accent-emerald: #059669;             /* Xanh lá bảo mật */
    --accent-rose: #e11d48;                /* Đỏ cảnh báo */
    --accent-amber: #d97706;               /* Vàng cam thông báo */
    --accent-purple: #7c3aed;              /* Tím điểm nhấn */

    --text-primary: #0f172a;               /* Màu chữ chính đen than navy đậm nét */
    --text-secondary: #475569;             /* Màu chữ phụ xám chì */
    --text-muted: #64748b;                 /* Màu chú thích */

    --border: #e2e8f0;                     /* Đường viền xám sáng nhẹ nhàng */
    --border-highlight: rgba(37, 99, 235, 0.35);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --shadow-subtle: 0 4px 20px rgba(15, 23, 42, 0.05);
    --shadow-card: 0 10px 25px -5px rgba(37, 99, 235, 0.06), 0 8px 10px -6px rgba(37, 99, 235, 0.04);
    --shadow-glow: 0 0 25px rgba(37, 99, 235, 0.18);
    --shadow-red-glow: 0 0 25px rgba(225, 29, 72, 0.15);

    --sidebar-width: 260px;
    --header-h: 70px;                      /* Chiều cao thanh Header Desktop */
    --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    
    --bg-gradient: radial-gradient(circle at 15% 15%, rgba(186, 230, 253, 0.45) 0%, transparent 45%),
                    radial-gradient(circle at 85% 85%, rgba(224, 242, 254, 0.55) 0%, transparent 45%);
}

/* ==============================================================================
   2. COLOR TOKENS: CHẾ ĐỘ TỐI (DARK MODE)
   ============================================================================== */
[data-theme="dark"] {
    --bg-base: #0a0f1d;                    /* Nền đen midnight */
    --bg-surface: #111a2e;                 /* Thẻ card navy sẫm */
    --bg-surface-elevated: #18243e;        /* Nền phân cấp */
    --bg-glass: rgba(17, 26, 46, 0.88);
    
    --primary: #38bdf8;                    /* Xanh da trời dạ quang */
    --primary-hover: #0284c7;
    --primary-glow: rgba(56, 189, 248, 0.35);
    
    --accent-cyan: #38bdf8;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --accent-amber: #f59e0b;
    --accent-purple: #a855f7;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border: rgba(148, 163, 184, 0.14);
    --border-highlight: rgba(56, 189, 248, 0.35);

    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.25);
    --shadow-red-glow: 0 0 25px rgba(244, 63, 94, 0.25);

    --bg-gradient: radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
                    radial-gradient(circle at 85% 85%, rgba(59, 130, 246, 0.06) 0%, transparent 40%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: clip;
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-cyan);
}

code, .code-font {
    font-family: 'JetBrains Mono', monospace;
}

/* ==============================================================================
   NÚT CHUYỂN ĐỔI CHẾ ĐỘ SÁNG / TỐI (THEME TOGGLE BUTTON)
   ============================================================================== */
.theme-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 17px;
    color: var(--text-primary);
    box-shadow: var(--shadow-subtle);
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    transform: rotate(20deg) scale(1.08);
    border-color: var(--primary);
}

/* ==============================================================================
   NAVBAR (PUBLIC LANDING)
   ============================================================================== */
.landing-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 6%;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    width: 100%;
    box-sizing: border-box;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-logo-img {
    height: 38px;
    width: auto;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.15;
}

.brand-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.brand-title-accent {
    color: #2563eb;
}

.brand-slogan {
    font-size: 9.5px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.5px;
}

.nav-menu {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 15px;
    transition: var(--transition);
    text-decoration: none;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

.hide-on-desktop {
    display: none;
}

/* Tiện ích ẩn phần tử tuyệt đối */
.hidden {
    display: none !important;
}

.desktop-nav-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.desktop-guest-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.desktop-user-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.desktop-user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid var(--border);
    border-radius: 20px;
}

.desktop-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.desktop-user-meta {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.1;
}

.desktop-user-meta b {
    font-size: 12px;
    color: var(--text-primary);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.desktop-user-meta span {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-emerald);
}

.desktop-logout-btn {
    background: none;
    border: 1px solid var(--border);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: #ef4444;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.desktop-logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.brand-logo .brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-cyan) 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    box-shadow: 0 4px 15px var(--primary-glow);
}

/* ==============================================================================
   HERO SECTION (DESKTOP & TOÀN CỤC)
   ============================================================================== */
.hero-section {
    padding: 70px 6% 60px;
    text-align: center;
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

/* Kiểu viên thuốc (Pill) cho nhãn CONNECT · INNOVATE · GROW */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 9999px;
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 18px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.hero-title {
    font-size: 38px;
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.hero-desc {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 680px;
    margin: 0 auto 28px;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}

/* ==============================================================================
   BUTTONS
   ============================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
    color: #ffffff !important;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 22px var(--primary-glow);
    transform: translateY(-2px);
    color: #ffffff !important;
}

.btn-outline {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(37, 99, 235, 0.08);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-emerald) 0%, #047857 100%);
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.25);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-rose) 0%, #be123c 100%);
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(225, 29, 72, 0.25);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(225, 29, 72, 0.4);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 6px;
}

/* ==============================================================================
   LAYOUT KHU VỰC QUẢN TRỊ & CLIENT COCKPIT (DASHBOARD)
   ============================================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: var(--transition);
}

.sidebar-header {
    height: 72px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav {
    list-style: none;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 12px 14px 6px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-nav-item i {
    font-size: 17px;
    width: 22px;
    text-align: center;
}

.sidebar-nav-item:hover {
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary);
}

.sidebar-nav-item.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.12) 0%, rgba(2, 132, 199, 0.04) 100%);
    color: var(--primary);
    border-left: 3px solid var(--primary);
    font-weight: 700;
}

.main-cockpit {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
    min-width: 0;
}

.topbar {
    height: 72px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    box-shadow: var(--shadow-subtle);
}

.topbar-title h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-subtle);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 14px;
}

/* ==============================================================================
   CARDS, METRICS & CONTAINERS
   ============================================================================== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px;
    width: 100%;
}

.grid-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.metric-card:hover {
    border-color: var(--border-highlight);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.1);
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.metric-info h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-info p {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 4px;
}

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-highlight);
}

/* ==============================================================================
   TABLES
   ============================================================================== */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    box-shadow: var(--shadow-card);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.custom-table th {
    background: var(--bg-surface-elevated);
    padding: 16px 20px;
    text-align: left;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.6px;
}

.custom-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.custom-table tr:hover td {
    background: rgba(37, 99, 235, 0.03);
}

/* ==============================================================================
   BADGES & STATUS
   ============================================================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.status-online {
    background: rgba(5, 150, 105, 0.12);
    color: var(--accent-emerald);
    border: 1px solid rgba(5, 150, 105, 0.25);
}

.status-offline {
    background: rgba(225, 29, 72, 0.12);
    color: var(--accent-rose);
    border: 1px solid rgba(225, 29, 72, 0.25);
}

.status-pending {
    background: rgba(217, 119, 6, 0.12);
    color: var(--accent-amber);
    border: 1px solid rgba(217, 119, 6, 0.25);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.pulse-online {
    background: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
}

.pulse-offline {
    background: var(--accent-rose);
}

.pulse-pending {
    background: var(--accent-amber);
    animation: blink 1.2s infinite;
}

@keyframes blink {
    50% { opacity: 0.3; }
}

/* ==============================================================================
   FORM CONTROLS & RANGE SLIDERS (CHECKOUT)
   ============================================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    background: var(--bg-surface);
}

.range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: var(--border);
    outline: none;
    margin: 14px 0;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary-glow);
    border: 2px solid #fff;
    transition: var(--transition);
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* ==============================================================================
   MODAL WINDOWS
   ============================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    padding: 32px;
    position: relative;
    animation: modalScale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
    from { transform: scale(0.93) translateY(15px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(225, 29, 72, 0.12);
    color: var(--accent-rose);
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    animation: toastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlide {
    from { transform: translateX(50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-success { border-left: 4px solid var(--accent-emerald); }
.toast-error { border-left: 4px solid var(--accent-rose); }
.toast-info { border-left: 4px solid var(--primary); }

/* --- FIX LỖI CO HẸP TRẠNG THÁI & BẢNG VPS TRÊN DASHBOARD --- */
.status-badge {
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: max-content;
    padding: 5px 12px;
}

/* ==========================================================================
   TỐI ƯU HÓA LAYOUT BẢNG - XÓA BỎ THANH TRƯỢT NGANG (FULL WIDTH TABLE)
   ========================================================================== */

/* 1. Mở rộng khung chứa chính để tận dụng tối đa chiều ngang màn hình */
.dashboard-main, .main-content, .main-cockpit, main {
    width: 100% !important;
    max-width: 100% !important;
    padding: 24px 28px !important;
    box-sizing: border-box !important;
}

.card {
    width: 100% !important;
    overflow-x: hidden !important; /* Triệt tiêu thanh cuộn ngang của card */
    box-sizing: border-box !important;
}

.table-responsive {
    width: 100% !important;
    overflow-x: auto; /* Chỉ bật khi màn hình thu nhỏ dưới 1024px */
    scrollbar-width: thin;
}

/* 2. Cấu trúc bảng co giãn tự động theo tỷ lệ */
table {
    width: 100% !important;
    table-layout: auto !important;
    border-collapse: collapse !important;
}

/* 3. Tinh chỉnh font chữ và khoảng đệm các ô để vừa vặn màn hình */
table th {
    font-size: 11.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px;
    padding: 12px 10px !important;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap !important;
}

table td {
    font-size: 13px !important;
    padding: 12px 10px !important;
    vertical-align: middle !important;
    border-bottom: 1px solid var(--border);
}

/* 4. Cho phép các cột thông tin dài tự động xuống dòng mềm mại */
table td.wrap-cell, 
table td:nth-child(2),
table td:nth-child(3) {
    white-space: normal !important;
    word-break: break-word !important;
}

/* 5. Cố định không xuống dòng cho các cột ngắn (Mã HĐ, Số tiền, Trạng thái, Thao tác) */
table td:first-child,
table td:nth-child(4),
table td:nth-child(5),
table td:last-child {
    white-space: nowrap !important;
}

/* 6. Thu gọn kích thước cụm nút bấm điều khiển VPS để không chiếm ngang */
.action-btn-group {
    display: inline-flex !important;
    gap: 4px !important;
    align-items: center !important;
    white-space: nowrap !important;
}

.action-btn-group .btn-sm {
    padding: 4px 8px !important;
    font-size: 11.5px !important;
    border-radius: 6px !important;
}

/* Nút "Thanh Toán QR" màu amber cho đơn hàng PENDING */
.btn-repay-qr {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-amber);
    border: 1.5px solid rgba(245, 158, 11, 0.40);
    padding: 5px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-repay-qr:hover {
    background: rgba(245, 158, 11, 0.22);
    border-color: var(--accent-amber);
    transform: translateY(-1px);
}

/* Modal QR thanh toán lại */
#repayQrModal .qr-img {
    border-radius: 12px;
    border: 3px solid var(--border);
    box-shadow: var(--shadow-card);
}

/* ==============================================================================
   TÍNH NĂNG ĐÓNG / MỞ THANH MENU BÊN TRÁI (COLLAPSIBLE SIDEBAR)
   ============================================================================== */
aside, .sidebar, .dashboard-sidebar {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.3s ease,
                padding 0.3s ease !important;
    overflow-x: hidden !important;
    white-space: nowrap !important;
    position: relative;
}

.main-content, .dashboard-main, .main-cockpit, main {
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    min-width: 0;
}

/* Nút bấm Bật/Tắt Sidebar */
.sidebar-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 14px;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

/* --- TRẠNG THÁI KHI THU GỌN (THU VỀ THANH ICON 76PX) --- */
body.sidebar-collapsed aside,
body.sidebar-collapsed .sidebar,
body.sidebar-collapsed .dashboard-sidebar,
html.sidebar-collapsed aside,
html.sidebar-collapsed .sidebar,
html.sidebar-collapsed .dashboard-sidebar {
    width: 76px !important;
    min-width: 76px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
}

/* Ẩn chữ tiêu đề, logo text, chữ menu, nhãn và thông số ESXi khi thu gọn */
body.sidebar-collapsed aside span,
body.sidebar-collapsed .sidebar span,
body.sidebar-collapsed aside small,
body.sidebar-collapsed .sidebar small,
body.sidebar-collapsed aside p,
body.sidebar-collapsed .sidebar p,
body.sidebar-collapsed .sidebar b,
body.sidebar-collapsed aside b,
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-section-title,
body.sidebar-collapsed .sidebar-footer,
html.sidebar-collapsed aside span,
html.sidebar-collapsed .sidebar span,
html.sidebar-collapsed .sidebar b,
html.sidebar-collapsed .sidebar-label,
html.sidebar-collapsed .sidebar-footer {
    opacity: 0 !important;
    width: 0 !important;
    display: none !important;
}

/* Căn giữa logo và các icon khi thu gọn */
body.sidebar-collapsed .sidebar-header,
html.sidebar-collapsed .sidebar-header {
    padding: 0 !important;
    justify-content: center !important;
}

body.sidebar-collapsed .sidebar-header a,
html.sidebar-collapsed .sidebar-header a {
    justify-content: center !important;
    gap: 0 !important;
}

body.sidebar-collapsed .sidebar-nav,
html.sidebar-collapsed .sidebar-nav {
    padding: 20px 4px !important;
}

body.sidebar-collapsed aside a,
body.sidebar-collapsed .sidebar a,
body.sidebar-collapsed .sidebar-item,
body.sidebar-collapsed .sidebar-nav-item,
body.sidebar-collapsed .nav-item,
html.sidebar-collapsed .sidebar-nav-item {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    text-align: center !important;
    gap: 0 !important;
}

body.sidebar-collapsed aside a i,
body.sidebar-collapsed .sidebar a i,
body.sidebar-collapsed .sidebar-nav-item i,
html.sidebar-collapsed .sidebar-nav-item i {
    margin-right: 0 !important;
    font-size: 18px !important;
    width: auto !important;
}

body.sidebar-collapsed .sidebar-nav-item.active,
html.sidebar-collapsed .sidebar-nav-item.active {
    border-left: none !important;
    background: rgba(37, 99, 235, 0.15) !important;
    border-radius: var(--radius-sm) !important;
}

/* Sửa badge phổ biến không bị tràn lên mép trên */
.pricing-card {
    position: relative;
    padding-top: 50px !important; /* Khoảng trống đủ lớn để badge nổi lên không bị cắt viền */
    overflow: visible !important;
}

.popular-badge {
    position: absolute;
    top: -14px;                   /* Nhô lên trên đỉnh card một chút */
    left: 50%;
    transform: translateX(-50%);
    background: #2563eb;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 18px;
    border-radius: 20px;
    white-space: nowrap;
    z-index: 10;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(37,99,235,0.4);
}

.renew-dur-btn.active {
    background: rgba(37, 99, 235, 0.15) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

/* ==========================================================================
   TRIỆT TIÊU TOÀN BỘ THANH CUỘN XÁM & FIX GIAO DIỆN BẢNG AUDIT LOGS
   ========================================================================== */
#tab-audit-logs,
#tab-content-admin-audit,
#tab-audit-logs .card,
#tab-content-admin-audit .card,
#tab-audit-logs .table-responsive,
#tab-content-admin-audit .table-responsive {
    overflow-x: hidden !important;   /* Chặn hoàn toàn thanh trượt đáy */
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

#tab-audit-logs table,
#tab-content-admin-audit table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;          /* Xóa bỏ min-width gây tràn */
    table-layout: fixed !important;   /* Ép các cột chia đều đúng 100% chiều ngang */
}

/* Chia tỷ lệ phần trăm vừa vặn cho 4 cột tinh gọn (Tổng 100%) */
#tab-audit-logs th:nth-child(1), #tab-audit-logs td:nth-child(1),
#tab-content-admin-audit th:nth-child(1), #tab-content-admin-audit td:nth-child(1) { 
    width: 18% !important; 
    white-space: nowrap !important;
    font-size: 13px !important;
} /* 1. THỜI GIAN */

#tab-audit-logs th:nth-child(2), #tab-audit-logs td:nth-child(2),
#tab-content-admin-audit th:nth-child(2), #tab-content-admin-audit td:nth-child(2) { 
    width: 12% !important; 
    text-align: center !important; 
    white-space: nowrap !important;
} /* 2. MỨC ĐỘ */

#tab-audit-logs th:nth-child(3), #tab-audit-logs td:nth-child(3),
#tab-content-admin-audit th:nth-child(3), #tab-content-admin-audit td:nth-child(3) { 
    width: 18% !important; 
    white-space: nowrap !important;
} /* 3. TÀI KHOẢN / IP */

#tab-audit-logs th:nth-child(4), #tab-audit-logs td:nth-child(4),
#tab-content-admin-audit th:nth-child(4), #tab-content-admin-audit td:nth-child(4),
#tab-audit-logs td.audit-detail-cell,
#tab-content-admin-audit td.audit-detail-cell,
#tab-audit-logs td:last-child,
#tab-content-admin-audit td:last-child { 
    width: 52% !important; 
    white-space: normal !important;      /* Tự động xuống dòng mềm mại */
    word-break: break-all !important;    /* Tự ngắt dòng khi chuỗi quá dài */
    overflow-wrap: anywhere !important;
    line-height: 1.45 !important;
    overflow: visible !important;
    text-overflow: clip !important;
} /* 4. NỘI DUNG NHẬT KÝ */

#tab-audit-logs td,
#tab-content-admin-audit td {
    padding: 12px 10px !important;
    vertical-align: middle !important;
}

/* ==============================================================================
   RESPONSIVE DESIGN SYSTEM (MOBILE 390PX, TABLET 768PX, DESKTOP >992PX)
   ============================================================================== */

/* 1. Ngăn chặn triệt để hiện tượng vỡ trang và tràn ngang */
html, body {
    max-width: 100vw !important;
    width: 100% !important;
    overflow-x: clip !important;
    position: relative;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-padding-top: var(--header-h) !important;
    scroll-behavior: smooth;
}

#hero, #pricing, #security {
    scroll-margin-top: var(--header-h) !important;
}

*, *::before, *::after {
    box-sizing: border-box;
}

code, pre {
    word-break: break-all;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.container, .app-layout, .main-cockpit {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Các thành phần Mobile Header ẩn trên Desktop */
.mobile-header-controls {
    display: none;
}

.mobile-menu-auth {
    display: none;
}

.nav-toggle-btn {
    display: none;
}

/* 2. Responsive Navbar & Hamburger Menu dưới 992px */
@media (max-width: 991.98px) {
    :root {
        --header-h: 60px;                  /* Chiều cao thanh Header Mobile */
    }

    .landing-navbar {
        padding: 10px 14px !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
        background: var(--bg-surface) !important;
        border-bottom: 1px solid var(--border) !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Ẩn dòng slogan thương hiệu để không chèn dòng trên mobile */
    .brand-slogan {
        display: none !important;
    }

    /* Ẩn khối tài khoản desktop trên thanh header top */
    .desktop-nav-actions {
        display: none !important;
    }

    /* Hiển thị cụm nút theme và nút hamburger bên phải */
    .mobile-header-controls {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        margin-left: auto !important;
    }

    .nav-toggle-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 38px !important;
        height: 38px !important;
        border-radius: var(--radius-sm) !important;
        border: 1px solid var(--border) !important;
        background: var(--bg-surface-elevated) !important;
        color: var(--text-primary) !important;
        cursor: pointer !important;
        font-size: 16px !important;
        transition: var(--transition) !important;
    }

    .nav-toggle-btn:hover,
    .nav-toggle-btn:focus {
        background: rgba(37, 99, 235, 0.1) !important;
        color: var(--primary) !important;
        border-color: var(--primary) !important;
    }

    /* Menu dropdown trên mobile */
    .nav-menu {
        display: none !important;
        flex-direction: column !important;
        width: 100% !important;
        padding: 12px !important;
        margin-top: 10px !important;
        background: var(--bg-surface) !important;
        border: 1px solid var(--border) !important;
        border-radius: 12px !important;
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35) !important;
        box-sizing: border-box !important;
        order: 10 !important;
    }

    .nav-menu.show {
        display: flex !important;
    }

    .nav-links {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 4px !important;
        padding: 0 !important;
        margin: 0 !important;
        list-style: none !important;
    }

    .nav-links li {
        width: 100% !important;
    }

    .nav-links a {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        padding: 11px 14px !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        color: var(--text-primary) !important;
        border-radius: var(--radius-sm) !important;
        box-sizing: border-box !important;
        text-decoration: none !important;
        transition: var(--transition) !important;
    }

    .nav-links a:hover,
    .nav-links a.active {
        background: rgba(37, 99, 235, 0.1) !important;
        color: var(--primary) !important;
    }

    /* Khối tài khoản gom vào menu mobile */
    .mobile-menu-auth {
        display: block !important;
        width: 100% !important;
        margin-top: 12px !important;
        padding-top: 12px !important;
        border-top: 1px solid var(--border) !important;
        box-sizing: border-box !important;
    }

    .mobile-auth-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .mobile-auth-btn {
        width: 100% !important;
        padding: 12px !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }

    .mobile-user-profile-badge {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 14px;
        background: rgba(59, 130, 246, 0.08);
        border: 1px solid var(--border);
        border-radius: 8px;
        margin-bottom: 6px;
    }

    .mobile-user-avatar {
        width: 32px !important;
        height: 32px !important;
        border-radius: 50% !important;
        background: var(--primary) !important;
        color: #fff !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 14px !important;
        font-weight: bold !important;
    }

    .mobile-user-details {
        display: flex !important;
        flex-direction: column !important;
        line-height: 1.2 !important;
    }

    .mobile-user-details b {
        font-size: 13px !important;
        color: var(--text-primary) !important;
    }

    .mobile-user-details span {
        font-size: 10px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        color: var(--accent-emerald) !important;
    }

    /* 3. Responsive Hero Section dưới 992px */
    .hero-section {
        padding: 44px 14px 36px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Kiểu viên thuốc (Pill) co giãn vừa vặn trên điện thoại */
    .hero-badge {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        padding: 6px 16px !important;
        background: rgba(37, 99, 235, 0.1) !important;
        border: 1px solid rgba(37, 99, 235, 0.3) !important;
        border-radius: 9999px !important;
        color: var(--primary) !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        letter-spacing: 0.5px !important;
        margin-bottom: 20px !important;
        max-width: 95% !important;
        box-sizing: border-box !important;
        white-space: nowrap !important;
    }

    .hero-title {
        font-size: clamp(22px, 5.5vw, 34px) !important;
        line-height: 1.3 !important;
        word-break: break-word !important;
    }

    .hero-desc {
        font-size: 15px !important;
        padding: 0 6px !important;
    }

    .hero-actions {
        flex-direction: column !important;
        width: 100% !important;
        max-width: 340px !important;
        margin: 0 auto !important;
        gap: 10px !important;
        align-items: stretch !important;
    }

    .hero-actions .btn,
    .btn-hero {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 12px 18px !important;
        font-size: 15px !important;
        box-sizing: border-box !important;
        white-space: normal !important;
    }

    /* Khung chứa & Padding toàn cục */
    .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    section {
        padding-left: 12px !important;
        padding-right: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .grid-metrics {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
        width: 100% !important;
    }

    .card {
        padding: 18px 14px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 576px) {
    .brand-title {
        font-size: 16px !important;
    }

    .hide-on-mobile {
        display: none !important;
    }
}

/* 4. Responsive Bảng Dữ Liệu (Table Responsive) */
.table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    display: block !important;
    margin-bottom: 16px !important;
    border-radius: var(--radius-sm);
}

.table-responsive table {
    min-width: 540px !important;
    border-collapse: collapse;
}

/* 5. Responsive Sidebar Dashboard (Off-canvas trên mobile) */
@media (max-width: 991px) {
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        z-index: 1050 !important;
        width: 270px !important;
        min-width: 270px !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 0 0 35px rgba(0,0,0,0.4) !important;
    }

    html.mobile-sidebar-open .sidebar,
    body.mobile-sidebar-open .sidebar {
        transform: translateX(0) !important;
    }

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        backdrop-filter: blur(2px);
    }

    .main-cockpit {
        width: 100% !important;
        min-width: 0 !important;
    }

    .topbar {
        padding: 12px 16px !important;
        height: auto !important;
        min-height: 60px !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    .topbar > div:first-child {
        margin-bottom: 0 !important;
    }

    #topbar-heading {
        font-size: 18px !important;
    }

    .grid-metrics {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
}

/* 6. Responsive Checkout Grid */
.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 28px;
    align-items: start;
    width: 100%;
}

@media (max-width: 991px) {
    .checkout-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

/* 7. Responsive VPS Detail Grid */
.vps-detail-grid {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 24px;
    max-width: 1300px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 991px) {
    .vps-detail-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

@media (max-width: 576px) {
    .vps-detail-body {
        padding: 14px 10px !important;
    }
}

/* 8. Responsive Modals */
.modal-box {
    max-width: 95% !important;
    box-sizing: border-box !important;
}

@media (max-width: 576px) {
    .modal-box {
        padding: 18px 14px !important;
        width: 95% !important;
    }
}

/* 9. Utility Class - Tiện ích ẩn phần tử tuyệt đối */
.hidden {
    display: none !important;
}


