/* ==========================================================
   custom.css — vài lớp dùng lại nhiều nơi.
   Tailwind nạp qua CDN (không có bước build npm) nên các lớp
   ở đây được viết tay bằng CSS thuần, KHÔNG dùng @apply.
   ========================================================== */

html, body {
    font-family: 'Roboto', 'Segoe UI', Helvetica, Arial, sans-serif;
}

/* ── Nền lưới kỹ thuật cho toàn app ── */
.bg-grid { background-image: linear-gradient(rgba(59,130,246,.04) 1px,transparent 1px),linear-gradient(90deg,rgba(59,130,246,.04) 1px,transparent 1px); background-size: 40px 40px; }
html.dark .bg-grid { background-image: linear-gradient(rgba(59,130,246,.07) 1px,transparent 1px),linear-gradient(90deg,rgba(59,130,246,.07) 1px,transparent 1px); }

/* Card nền ĐẶC ở cả 2 chế độ — không trong suốt/blur để nội dung không bị lẫn với nền sau */
.glass { background: #ffffff; border: 1px solid #e2e8f0; box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 14px rgba(15,23,42,.06); }
.dark .glass { background: #111827; border: 1px solid rgba(255,255,255,0.10); box-shadow: none; }
.glass-light { background: rgba(255,255,255,0.85); backdrop-filter: blur(20px); border: 1px solid rgba(59,130,246,0.15); }
.glow { box-shadow: 0 0 40px rgba(59,130,246,0.3); }
.orb { border-radius: 50%; filter: blur(80px); position: absolute; }

/* color-scheme: dark áp dụng ngay từ html.dark để input/select/checkbox... không bị flash nền trắng trước khi vào dark mode */
.dark, html.dark, [data-theme="dark"] {
    color-scheme: dark;
}

.dark select,
html.dark select {
    color-scheme: dark;
}

.dark select option,
.dark option,
html.dark select option,
html.dark option {
    background-color: #0f172a !important;
    color: #f8fafc !important;
}

.dark select optgroup,
html.dark select optgroup {
    background-color: #0f172a !important;
    color: #94a3b8 !important;
}

.dark select option:checked,
.dark select option:hover,
html.dark select option:checked,
html.dark select option:hover {
    background-color: #1e293b !important;
    color: #38bdf8 !important;
}

/* ── Scrollbar mỏng toàn app ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 10px; }
html.dark ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); }

.glass-card { background: rgba(255,255,255,0.8); backdrop-filter: blur(10px); border: 1px solid rgba(0,0,0,0.05); transition: all .3s ease; }
.dark .glass-card { background: rgba(255,255,255,.05); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.09); transition: all .3s ease; }
.glass-card:hover { background: rgba(255,255,255,1); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,0.08); }
.dark .glass-card:hover { background: rgba(255,255,255,.08); transform: translateY(-2px); box-shadow: 0 20px 40px rgba(0,0,0,.3); }

/* Tone xanh chủ đạo #24A1FF / đậm #0B6FD0 / nền nhạt #EAF6FF — dùng cho sidebar & menu active */
.sidebar-link { transition: all .2s ease; border-left: 3px solid transparent; }
.sidebar-link.active { background: linear-gradient(135deg,rgba(36,161,255,.16),rgba(11,111,208,.06)); border-left: 3px solid #24A1FF; color: #0B6FD0 !important; }
html.dark .sidebar-link.active { background: linear-gradient(135deg,rgba(36,161,255,.22),rgba(11,111,208,.10)); color: #5FC0FF !important; }
.sidebar-link:hover:not(.active) { background: #EAF6FF; }
html.dark .sidebar-link:hover:not(.active) { background: rgba(36,161,255,.10); }

.badge-running { background: rgba(34,197,94,.15); color: #22c55e; border: 1px solid rgba(34,197,94,.3); }
.badge-stopped { background: rgba(239,68,68,.15); color: #ef4444; border: 1px solid rgba(239,68,68,.3); }
.badge-pending { background: rgba(234,179,8,.15); color: #eab308; border: 1px solid rgba(234,179,8,.3); }
.badge-info { background: rgba(59,130,246,.15); color: #60a5fa; border: 1px solid rgba(59,130,246,.3); }

.modal-backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(6px); }

@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.animate-slideup { animation: slideUp .4s ease-out; }

/* ── Nút dùng lại ── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover { background: linear-gradient(135deg, #2563eb, #1d4ed8); transform: translateY(-1px); box-shadow: 0 10px 25px rgba(37,99,235,0.4); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease-in-out;
}

.btn-secondary:hover { background: #f1f5f9; }

/* ── Ô nhập liệu dùng lại ── */
.form-input,
.input-field {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    color: #0f172a;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.form-input:focus,
.input-field:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

/* ==========================================================
   Dark mode cho nội dung trang — các trang/component dùng thẳng lớp
   Tailwind (bg-white, text-slate-900...) không tự đổi màu theo html.dark
   vì không có biến thể dark: đi kèm ở từng nơi. Thay vì sửa từng file,
   đè thẳng lên các lớp Tailwind hay dùng nhất ở đây cho gọn.
   ========================================================== */

/* ── Nền & viền trung tính ── */
html.dark .bg-white { background-color: #111827 !important; }
html.dark .bg-slate-50 { background-color: rgba(255,255,255,.03) !important; }
html.dark .bg-slate-100 { background-color: rgba(255,255,255,.07) !important; }
html.dark .bg-slate-200 { background-color: rgba(255,255,255,.12) !important; }
html.dark .border-slate-100 { border-color: rgba(255,255,255,.07) !important; }
html.dark .border-slate-200 { border-color: rgba(255,255,255,.12) !important; }
html.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]) { border-color: rgba(255,255,255,.07) !important; }
html.dark .divide-slate-200 > :not([hidden]) ~ :not([hidden]) { border-color: rgba(255,255,255,.12) !important; }
html.dark .hover\:bg-slate-50:hover { background-color: rgba(255,255,255,.06) !important; }
html.dark .hover\:bg-slate-100:hover { background-color: rgba(255,255,255,.10) !important; }
html.dark .hover\:text-slate-600:hover { color: #cbd5e1 !important; }
html.dark .hover\:text-slate-700:hover { color: #e2e8f0 !important; }
html.dark .hover\:text-slate-900:hover { color: #f8fafc !important; }

/* ── Chữ trung tính (các tông đủ tối để cần đổi, slate-400 trở xuống đã đủ sáng nên giữ nguyên) ── */
html.dark .text-slate-900 { color: #f8fafc !important; }
html.dark .text-slate-800 { color: #e2e8f0 !important; }
html.dark .text-slate-700 { color: #cbd5e1 !important; }
html.dark .text-slate-600 { color: #94a3b8 !important; }
html.dark .text-slate-500 { color: #94a3b8 !important; }

/* ── Badge/nhãn pastel màu (bg-{color}-50/100 + text-{color}-600/700) — hạ độ sáng nền, tăng độ sáng chữ ── */
html.dark .bg-blue-50 { background-color: rgba(59,130,246,.15) !important; }
html.dark .text-blue-600 { color: #93c5fd !important; }
html.dark .text-blue-700 { color: #bfdbfe !important; }
html.dark .border-blue-100 { border-color: rgba(59,130,246,.30) !important; }
html.dark .border-blue-200 { border-color: rgba(59,130,246,.40) !important; }
html.dark .hover\:bg-blue-50:hover { background-color: rgba(59,130,246,.22) !important; }

html.dark .bg-emerald-50 { background-color: rgba(16,185,129,.15) !important; }
html.dark .text-emerald-600 { color: #6ee7b7 !important; }
html.dark .text-emerald-700 { color: #a7f3d0 !important; }
html.dark .border-emerald-200 { border-color: rgba(16,185,129,.40) !important; }
html.dark .hover\:bg-emerald-50:hover { background-color: rgba(16,185,129,.22) !important; }

html.dark .bg-amber-50 { background-color: rgba(245,158,11,.15) !important; }
html.dark .bg-amber-100 { background-color: rgba(245,158,11,.20) !important; }
html.dark .text-amber-600 { color: #fcd34d !important; }
html.dark .text-amber-700 { color: #fde68a !important; }
html.dark .text-amber-800 { color: #fef3c7 !important; }
html.dark .border-amber-200 { border-color: rgba(245,158,11,.40) !important; }
html.dark .hover\:bg-amber-50:hover { background-color: rgba(245,158,11,.22) !important; }
html.dark .hover\:bg-amber-100:hover { background-color: rgba(245,158,11,.28) !important; }

html.dark .bg-red-50 { background-color: rgba(239,68,68,.15) !important; }
html.dark .bg-red-100 { background-color: rgba(239,68,68,.20) !important; }
html.dark .text-red-600 { color: #fca5a5 !important; }
html.dark .text-red-700 { color: #fecaca !important; }
html.dark .border-red-200 { border-color: rgba(239,68,68,.40) !important; }
html.dark .hover\:bg-red-50:hover { background-color: rgba(239,68,68,.22) !important; }
html.dark .hover\:bg-red-100:hover { background-color: rgba(239,68,68,.28) !important; }

html.dark .bg-violet-50 { background-color: rgba(139,92,246,.15) !important; }
html.dark .text-violet-600 { color: #c4b5fd !important; }
html.dark .text-violet-700 { color: #ddd6fe !important; }
html.dark .border-violet-200 { border-color: rgba(139,92,246,.40) !important; }

html.dark .bg-indigo-50 { background-color: rgba(99,102,241,.15) !important; }
html.dark .text-indigo-500 { color: #a5b4fc !important; }
html.dark .border-indigo-100 { border-color: rgba(99,102,241,.30) !important; }

html.dark .bg-green-50 { background-color: rgba(34,197,94,.15) !important; }
html.dark .bg-green-100 { background-color: rgba(34,197,94,.20) !important; }
html.dark .text-green-600 { color: #86efac !important; }
html.dark .text-green-700 { color: #bbf7d0 !important; }
html.dark .border-green-200 { border-color: rgba(34,197,94,.40) !important; }
html.dark .hover\:bg-green-100:hover { background-color: rgba(34,197,94,.28) !important; }
