/* File: static/css/styles.css */

:root {
  --bg: #0f1115;
  --bg-elev: #171a21;
  --bg-elev-2: #1f2430;
  --border: #2a2f3a;
  --muted: #a6adbb;
  --text: #e7ecf3;
  --primary: #4f8cff;
  --primary-600: #3d72d9;
  --accent: #10B981;
  --danger: #EF4444;
}

body {
  background: radial-gradient(1200px 800px at 20% -10%, rgba(79,140,255,0.08), transparent 60%),
              radial-gradient(1000px 700px at 110% 10%, rgba(16,185,129,0.06), transparent 60%),
              var(--bg);
  color: var(--text);
  overflow: visible;
}
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Text contrast overrides for dark theme */
.text-muted { color: #cbd5e1 !important; opacity: 1 !important; }
.text-secondary, .text-secondary-emphasis { color: #d8dee9 !important; }
/* Sidebar lists use text-white-50; make it more legible there */
#folderList .text-white-50, #folderListMobile .text-white-50 { color: rgba(255,255,255,0.82) !important; }
.navbar.navbar-dark { box-shadow: 0 6px 18px rgba(0,0,0,0.35); }

/* Global scrollbar theme */
* { scrollbar-color: rgba(255,255,255,0.12) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
.dropdown-menu-end { right: 0; left: auto; }

.navbar-brand:hover {
  text-decoration: none;
  opacity: 0.8;
}

.navbar.navbar-dark {
  border-bottom: 1px solid var(--border);
  background-color: rgba(15,17,21,0.9) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Ensure dropdown overlays any transformed cards */
.navbar { position: relative; z-index: 1030 !important; }
.dropdown-menu { z-index: 1045 !important; }
.navbar .dropdown, .navbar .dropdown-toggle, #navbarMenuBtn { z-index: 1046; position: relative; }

/* Ensure overview does not create a higher stacking context */
#homeOverview { position: relative; z-index: auto !important; }
#homeOverview .card { position: relative; z-index: auto !important; overflow: visible; }

/* Generic elevated card */
.card,
.card.bg-secondary {
  background: linear-gradient(180deg, var(--bg-elev), var(--bg-elev-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.card .card-header {
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.card .card-footer {
  border-top: 1px solid var(--border);
  background: transparent;
}
.card:hover { box-shadow: 0 12px 30px rgba(0,0,0,0.35); transform: translateY(-1px); transition: box-shadow .2s ease, transform .2s ease; }

.table th,
.table td {
  vertical-align: middle;
}

.table-dark {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255,255,255,0.03);
  --bs-table-hover-bg: rgba(255,255,255,0.05);
  color: var(--text);
  border-color: var(--border);
}
.table.table-bordered { border-color: var(--border); }
.table thead th { color: #cbd5e1; font-weight: 600; }

.rotate-icon {
  transition: transform 0.3s ease;
}
.rotate-180 {
  transform: rotate(180deg);
}

/* Status dot utility */
.status-dot { display:inline-block; width:10px; height:10px; border-radius:50%; background: var(--dot-color, #34d399); box-shadow: 0 0 6px rgba(52,211,153,0.6); }

/* FAB styles */
/* Fab container */


/* Pulsante principale FAB */
.fab-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  z-index: 1000;
  width: auto;
  height: auto;
  pointer-events: none
}

.fab-main {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background-color: #0d6efd;
  color: white;
  font-size: 24px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.fab-main:hover {
  background-color: #0b5ed7;
  transform: scale(1.05);
}

.fab-options {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-bottom: 10px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  visibility: hidden;
  pointer-events: none; /* 👈 blocca clic */
}

.fab-options.show {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto; /* ✅ sblocca clic */
}
/*.fab-container:not(:has(.fab-options.show)) {
  pointer-events: none;
}*/

/* Offcanvas mobile sidebar size and polish */
@media (max-width: 768px) {
  #mobileSidebar.offcanvas-start {
    width: 80vw;
    max-width: 100%;
    border-right: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(23,26,33,0.95), rgba(23,26,33,0.9));
  }
}

/* Desktop sidebar */
#pcNavbar{
  overflow:visible;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(23,26,33,0.85), rgba(23,26,33,0.65));
  backdrop-filter: blur(6px);
}

.fab-main,
.fab-options,
.fab-options.show {
  pointer-events: auto; /* SOLO i bottoni/menù prendono i click! */
}


.fab-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #343a40;
  color: white;
  padding: 10px 14px;
  margin-bottom: 6px;
  border-radius: 30px;
  border: none;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.fab-option:hover {
  background: #495057;
  transform: translateX(-4px);
}

.fab-option i {
  font-size: 16px;
}

.tooltip.fade.show {
    opacity: 1;
    animation: fadeInUp 0.3s ease-out;
}

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

.view-toggle .btn.active {
  background-color: #666666;
  color: black;
  font-weight: 600;
  border-color: #666666;
}

.offline {
  border-left: 5px solid var(--danger);
}

.online {
  border-left: 5px solid var(--accent);
}

td.offline{
    border-left: 5px solid #EF4444;
}

td.online{
    border-left: 5px solid #10B981;
}

.modal-backdrop {
  pointer-events: none !important;
}

button.btn {
  z-index: 1000;
  position: relative;
}


iframe {
  width: 100%;
  height: 100vh;
  border: none;
}

@font-face {
  font-family: 'eon';
  src: url('/static/fonts/EONScreen-Head.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'montserrat';
  src: url('/static/fonts/Montserrat-Bold.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}


.knewave-regular {
  font-family: "montserrat", system-ui;
  font-weight: normal;
  font-style: normal;
  display: inline;
  font-size: 70px;
  color: #D50100
}
.knewave-regular-small {
  font-family: "montserrat", system-ui;
  font-weight: 1;
  font-style:normal;
  display: inline;
  font-size: x-large;
}

.montserrat-small {
  font-family: "montserrat", system-ui;
  font-weight: 1;
  font-style:normal;
  display: inline;
  font-size: x-large;
}

.montserrat{
  font-family: "montserrat", system-ui;
  font-weight: normal;
  font-style: normal;
  display: inline;
  font-size: 30px !important;
}

.montserrat-large{
  font-family: "montserrat", system-ui;
  font-weight: normal;
  font-style: normal;
  display: inline;
  font-size: 40px !important;
  color: #D50100 !important;
}

.zoom-110 {
  transform: scale(1.03);
  transition: transform 0.3s ease;
}

.zoom-hover:hover {
  transform: scale(1.02);
  transition: transform 0.3s ease;
}

.zoom-not-hover{
  transform: scale(1);
  transition: transform 0.3s ease;
}

.brand-logo {
  height: 6em;
}

.brand-logo-index{
  height: 3em;
}

/* Mini chart container to avoid overgrowth */
.mini-chart-wrap {
  position: relative;
  height: 120px; /* fixed height for stability */
  max-width: 100%;
}
.mini-chart-wrap canvas {
  /* Let Chart.js set the canvas size; only ensure layout block behavior */
  display: block;
}

/* Buttons */
.btn-outline-light { border-color: var(--border) !important; }
.btn-outline-light:hover { background: rgba(255,255,255,0.06); }
.btn-outline-info { border-color: var(--primary); color: var(--text); }
.btn-outline-info:hover { background: rgba(79,140,255,0.12); }
.btn-primary { background: var(--primary); border-color: var(--primary-600); }
.btn-primary:hover { background: var(--primary-600); }
button:focus-visible, .btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible { outline: 2px solid rgba(79,140,255,0.5); outline-offset: 2px; }
.btn:focus, .form-control:focus, .form-select:focus { box-shadow: 0 0 0 0.2rem rgba(79,140,255,0.25) !important; }
.form-control, .form-select { background: #0f131a; border-color: var(--border); color: var(--text); }
.form-control:focus, .form-select:focus { border-color: #3d72d9; background: #0f131a; color: var(--text); }

/* Sidebar folders (desktop and mobile) */
#folderList .folder-toggle,
#folderListMobile .folder-toggle {
  padding: .5rem .7rem;
  border-radius: 10px;
  transition: background .15s ease, transform .15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#folderList .folder-toggle:hover,
#folderListMobile .folder-toggle:hover {
  background: rgba(255,255,255,0.06);
}
#folderList .folder-toggle .left,
#folderListMobile .folder-toggle .left { flex: 1 1 auto; min-width: 0; }
#folderList .folder-toggle .folder-name,
#folderListMobile .folder-toggle .folder-name { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#folderList .folder-toggle.active,
#folderListMobile .folder-toggle.active { background: rgba(255,255,255,0.08); }
#folderList .folder-nodes li,
#folderListMobile .folder-nodes li {
  padding: .35rem .5rem;
  border-left: 2px solid var(--border);
}
#folderList .folder-nodes li + li,
#folderListMobile .folder-nodes li + li { border-top: 1px dashed rgba(255,255,255,0.06); }

/* Badges and status dots */
.badge { border-radius: 8px; }
.badge.bg-success, .badge.bg-danger, .badge.bg-secondary, .badge.bg-primary, .badge.bg-info { filter: saturate(1.15); }

/* Icons spacing */
.folder-nodes i { width: 1rem; text-align: center; }
.folder-nodes .sidebar-left { flex: 1 1 auto; min-width: 0; }
.folder-nodes .sidebar-name { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Scroll and density */
#pcNavbar { scrollbar-width: thin; }
#pcNavbar::-webkit-scrollbar { width: 8px; }
#pcNavbar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

/* Headings in content */
#contentArea h3 { font-weight: 700; letter-spacing: .3px; }

/* Settings modal polish */
#settingsModal .modal-content { box-shadow: 0 16px 48px rgba(0,0,0,0.45); }
#settingsModal .form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
#settingsModal .list-group-item { border: none; border-radius: 0; }
#settingsModal .list-group-item.active { background: rgba(79,140,255,0.15) !important; color: var(--text) !important; }
@media (max-width: 768px) {
  #settingsModal .border-end { border: none !important; }
}

/* Modal z-index higher than navbar */
.modal { z-index: 1050 !important; }
.modal-backdrop { z-index: 1040 !important; background-color: rgba(0,0,0,0.6); }

/* Cards rendered by main.js */
.card.bg-secondary .card-title { font-weight: 700; }
.card.bg-secondary .card-text { color: var(--muted); }
.card.bg-secondary .card-footer { background: transparent; border-top: 1px solid var(--border); }

/* Table polish for JS-generated tables */
.table-dark.table-hover tbody tr:hover { filter: brightness(1.05); }
.table-dark.table-striped tbody tr:nth-of-type(odd) { background-color: rgba(255,255,255,0.03); }

/* Dropdown menu theme */
.dropdown-menu.bg-dark { border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.dropdown-menu .dropdown-item { color: var(--text); }
.dropdown-menu .dropdown-item:hover { background: rgba(255,255,255,0.06); }

/* Toasts */
.toast.text-bg-dark { background: linear-gradient(180deg, #0f131a, #0c0f14) !important; border: 1px solid var(--border) !important; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.toast .toast-body { color: var(--text); }

/* Mobile fixes for overview section */
@media (max-width: 576px) {
  #homeOverview .card {
    border-radius: 0;
  }
  #homeOverview .card-body .row > [class^="col-"] {
    padding-left: 8px;
    padding-right: 8px;
  }
  #homeOverview .mini-chart-wrap {
    height: 160px; /* a bit taller for readability on small screens */
  }
  #homeOverview table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #homeOverview .table-responsive {
    overflow-x: auto;
  }
  #homeOverview .card-header .d-flex.flex-wrap > * {
    margin-bottom: 6px;
  }
  #homeOverview .card-header select.form-select {
    min-width: 0;
    flex: 1 1 160px;
  }
  main.col-md-9 {
    padding: 1rem !important;
  }
}

/* Overview contrast improvements */
#homeOverview .text-light { color: #e9eef6 !important; }
#homeOverview .small, #homeOverview .text-muted { color: #c5ccda !important; }
#homeOverview .btn.btn-outline-light { color: #dfe7f1; border-color: #6b7280; }
#homeOverview .btn.btn-outline-light:hover { background: rgba(255,255,255,0.08); }
#homeOverview .btn.btn-outline-info { border-color: var(--primary); color: var(--text); }
#homeOverview .btn.btn-outline-info:hover { background: rgba(79,140,255,0.12); }
#homeOverview .table-dark { color: #e7ecf3; }
#homeOverview .text-success { color: #34d399 !important; }

@media (max-width: 576px) {
  #homeOverview .card-header label { flex: 1 1 100%; }
  #homeOverview .card-header a.btn, #homeOverview .card-header button.btn { flex: 1 1 auto; }
}

/* Drag & drop handle and indicators for overview grid */
#homeOverview .ovw-drag-handle {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: grab;
  z-index: 2;
}
#homeOverview .ovw-drag-handle:hover { color: #e5e7eb; background: rgba(255,255,255,0.06); }
#homeOverview .overview-section.dragging { opacity: 0.6; }
#homeOverview .overview-section.drop-before { box-shadow: inset 0 3px 0 0 var(--primary); }
#homeOverview .overview-section.drop-after  { box-shadow: inset 0 -3px 0 0 var(--primary); }