/* ============================================================
   FUJI Apeos Monitor — Custom Styles
   Bootstrap 5.3 Dark Mode + Thai Font (Sarabun)
   ============================================================ */

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

html, body {
    height: 100%;
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.6;
}

body {
    background-color: #0f1117;
    color: #dee2e6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main#mainContent {
    flex: 1;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #1a1d23; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #666; }

/* ---------- Navbar ---------- */
#mainNav {
    background: #12151c !important;
    border-bottom-color: #2a2d35 !important;
}

#mainNav .navbar-brand {
    letter-spacing: 0.3px;
}

#mainNav .nav-link {
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    color: #adb5bd;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}

#mainNav .nav-link:hover,
#mainNav .nav-link.active {
    background: rgba(255,255,255,0.07);
    color: #fff;
}

/* ---------- Cards ---------- */
.card {
    background: #161b27;
    border-color: #2a2e3d !important;
    border-radius: 10px;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.card-header {
    background: rgba(255,255,255,0.03);
    border-bottom-color: #2a2e3d !important;
    font-size: 14px;
}

.card-footer {
    background: rgba(255,255,255,0.02);
    border-top-color: #2a2e3d !important;
}

/* ---------- Tables ---------- */
.table {
    color: #dee2e6;
    --bs-table-bg: transparent;
}

.table thead th {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #adb5bd;
    border-bottom-color: #2a2e3d !important;
    white-space: nowrap;
    padding: 10px 12px;
}

.table-dark thead th {
    background: #1a1f2e;
    color: #8d9bb5;
    border-color: #2a2e3d !important;
}

.table tbody tr {
    border-color: #1e2233 !important;
    transition: background 0.1s;
}

.table-hover tbody tr:hover {
    background: rgba(255,255,255,0.04) !important;
}

.table td {
    padding: 10px 12px;
    vertical-align: middle;
    border-color: #1e2233 !important;
}

/* ---------- Forms ---------- */
.form-control,
.form-select {
    background-color: #1c2130;
    border-color: #2e3448;
    color: #dee2e6;
    border-radius: 7px;
    font-size: 14px;
}

.form-control:focus,
.form-select:focus {
    background-color: #1e2438;
    border-color: #4b6edf;
    color: #fff;
    box-shadow: 0 0 0 3px rgba(75,110,223,0.15);
}

.form-control::placeholder { color: #5a637a; }

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: #8d9bb5;
    margin-bottom: 5px;
}

/* ---------- Buttons ---------- */
.btn {
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

.btn-primary {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.btn-sm { font-size: 12px; padding: 4px 10px; }

/* ---------- Badges ---------- */
.badge {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2px;
    border-radius: 5px;
    padding: 3px 8px;
}

/* ---------- Status Dot (navbar) ---------- */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    background: #6c757d;
}

.status-dot.online  { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.status-dot.offline { background: #6c757d; }

/* ---------- Toner Progress Bars ---------- */
.progress {
    background: #1e2438;
    border-radius: 4px;
}

.progress-bar { border-radius: 4px; transition: width 0.5s ease; }

/* ---------- SVG Circular Chart ---------- */
.circular-chart .circle {
    stroke-linecap: round;
    animation: progress 0.8s ease-out forwards;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

@keyframes progress {
    0%   { stroke-dasharray: 0, 100; }
}

/* ---------- Alert Boxes ---------- */
.alert {
    border-radius: 8px;
    font-size: 14px;
    border-width: 1px;
}

.alert-success  { background: rgba(34,197,94,0.1);  border-color: rgba(34,197,94,0.3);  color: #4ade80; }
.alert-danger   { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.3);  color: #f87171; }
.alert-warning  { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); color: #fbbf24; }
.alert-info     { background: rgba(6,182,212,0.1);  border-color: rgba(6,182,212,0.3);  color: #22d3ee; }
.alert-secondary{ background: rgba(100,116,139,0.1);border-color: rgba(100,116,139,0.2);color: #94a3b8; }

/* ---------- Nav Tabs ---------- */
.nav-tabs {
    border-bottom-color: #2a2e3d;
}

.nav-tabs .nav-link {
    color: #8d9bb5;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 8px 16px;
    font-size: 13px;
    transition: color 0.15s, border-color 0.15s;
}

.nav-tabs .nav-link:hover { color: #dee2e6; }

.nav-tabs .nav-link.active {
    color: #3b82f6;
    background: transparent;
    border-bottom-color: #3b82f6;
}

/* ---------- Nav Pills ---------- */
.nav-pills .nav-link {
    color: #8d9bb5;
    font-size: 13px;
    padding: 5px 14px;
    border-radius: 6px;
}

.nav-pills .nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }

.nav-pills .nav-link.active {
    background: #2563eb;
    color: #fff;
}

/* ---------- Dropdown Menus ---------- */
.dropdown-menu-dark {
    background: #1a1f2e;
    border-color: #2e3448;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    padding: 6px;
}

.dropdown-menu-dark .dropdown-item {
    border-radius: 5px;
    font-size: 13px;
    color: #c4cdd8;
    padding: 6px 10px;
}

.dropdown-menu-dark .dropdown-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.dropdown-divider { border-color: #2e3448; }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
    font-size: 13px;
    background: transparent;
    padding: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #4a5568;
    content: "/";
}

.breadcrumb-item a { color: #6c8ebf; }
.breadcrumb-item.active { color: #8d9bb5; }

/* ---------- Pagination ---------- */
.pagination { gap: 2px; }

.page-link {
    background: #1c2130;
    border-color: #2e3448;
    color: #8d9bb5;
    border-radius: 6px !important;
    font-size: 13px;
    padding: 5px 10px;
    transition: all 0.15s;
}

.page-link:hover {
    background: #2a3147;
    color: #fff;
    border-color: #3b4668;
}

.page-item.active .page-link {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.page-item.disabled .page-link { opacity: 0.4; }

/* ---------- Modal ---------- */
.modal-content {
    background: #161b27;
    border-color: #2a2e3d;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header, .modal-footer {
    border-color: #2a2e3d !important;
}

.modal-title { font-size: 16px; font-weight: 600; }

/* ---------- List Group ---------- */
.list-group-item {
    background: transparent;
    border-color: #1e2233;
    color: #dee2e6;
    font-size: 14px;
}

.list-group-item-action:hover {
    background: rgba(255,255,255,0.04) !important;
}

/* ---------- Tooltip & Popover ---------- */
code {
    background: rgba(255,255,255,0.08);
    color: #7dd3fc;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* ---------- Responsive adjustments ---------- */
@media (max-width: 576px) {
    .card-body { padding: 1rem; }
    .table td, .table th { padding: 7px 8px; font-size: 13px; }
    h4 { font-size: 1.1rem; }
}

/* ---------- Print Styles ---------- */
@media print {
    #mainNav, footer, .btn, .dropdown, .alert-dismissible .btn-close {
        display: none !important;
    }
    body { background: #fff !important; color: #000 !important; }
    .card { border: 1px solid #ddd !important; box-shadow: none !important; }
    .table { color: #000 !important; }
}

/* ---------- Loading Spinner ---------- */
.spinner-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ---------- Custom bg-dark-subtle fix for Bootstrap 5.3 ---------- */
[data-bs-theme="dark"] .bg-dark-subtle {
    background-color: #12151c !important;
}

[data-bs-theme="dark"] .bg-body-secondary {
    background-color: #1a1f2e !important;
}

[data-bs-theme="dark"] .bg-body-tertiary {
    background-color: #0d1017 !important;
}

/* ---------- Animate page load ---------- */
#mainContent {
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Supply circular chart text ---------- */
.circular-chart text.percentage {
    font-family: 'Sarabun', sans-serif;
    font-weight: 600;
}
