/* Telematizzazione.it v2.6 - Custom stylesheet */

:root {
  --tele-sidebar-bg:     #1a2744;
  --tele-sidebar-hover:  rgba(13, 202, 240, 0.12);
  --tele-sidebar-active: #0dcaf0;
  --tele-sidebar-width:  240px;
  --tele-brand:          #0dcaf0;
  --tele-brand-dark:     #0aa2c0;
  --tele-header-bg:      #1a2744;
  --tele-content-bg:     #f0f4f8;
  --tele-card-shadow:    0 1px 4px rgba(0,0,0,.10);
  --tele-transition:     .18s ease;
}

/* ── LAYOUT ─────────────────────────────────────────── */

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: .9rem;
  background: var(--tele-content-bg);
  color: #212529;
}

#wrapper { display: flex; min-height: 100vh; }

/* ── SIDEBAR ─────────────────────────────────────────── */

#sidebar {
  width: var(--tele-sidebar-width);
  min-width: var(--tele-sidebar-width);
  background: var(--tele-sidebar-bg);
  color: #e0e6f0;
  display: flex;
  flex-direction: column;
  transition: width var(--tele-transition);
  z-index: 100;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

#sidebar .sidebar-brand {
  padding: 1.1rem 1rem;
  background: rgba(0,0,0,.2);
  border-bottom: 1px solid rgba(255,255,255,.07);
}
#sidebar .sidebar-brand img { height: 22px; }

.sidebar-logo-link { text-decoration: none; }
.sidebar-logo-link:hover .tl-name { color: #8ecff5; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  line-height: 1;
  user-select: none;
}
.sidebar-logo .bi {
  font-size: 15px;
  color: #4a9fd4;
  filter: drop-shadow(0 0 4px rgba(74,159,212,.45));
}
.sidebar-logo .tl-name {
  font-size: 11px;
  font-weight: 800;
  font-style: italic;
  color: #6ab4e8;
  -webkit-text-stroke: 0.4px rgba(160,215,255,.55);
  paint-order: stroke fill;
  letter-spacing: .01em;
  white-space: nowrap;
}
.sidebar-logo .tl-dot-it {
  font-size: 10px;
  font-style: normal;
  font-weight: 400;
  color: #8ecff5;
  -webkit-text-stroke: 0.3px rgba(160,215,255,.45);
}

#sidebar .sidebar-section-title {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  padding: .85rem 1rem .3rem;
  font-weight: 600;
}

#sidebar .nav-link {
  color: rgba(255,255,255,.75);
  padding: .48rem 1rem;
  border-radius: 6px;
  margin: 1px 6px;
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .855rem;
  transition: background var(--tele-transition), color var(--tele-transition);
  white-space: nowrap;
  overflow: hidden;
}
#sidebar .nav-link:hover {
  background: var(--tele-sidebar-hover);
  color: #fff;
  text-decoration: none;
}
#sidebar .nav-link.active {
  background: rgba(13, 202, 240, .18);
  color: var(--tele-brand);
  font-weight: 600;
}
#sidebar .nav-link i { font-size: 1rem; flex-shrink: 0; }

/* Company selector */
#sidebar .company-select-wrap {
  padding: .7rem .75rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
#sidebar .company-select-wrap select {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  color: #e0e6f0;
  font-size: .82rem;
  border-radius: 6px;
}
#sidebar .company-select-wrap select:focus {
  outline: none;
  border-color: var(--tele-brand);
  box-shadow: 0 0 0 2px rgba(13,202,240,.25);
}
#sidebar .company-select-wrap select option { color: #212529; background: #fff; }

/* Logout area at bottom of sidebar */
#sidebar .sidebar-footer {
  margin-top: auto;
  padding: .75rem;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: .8rem;
  color: rgba(255,255,255,.45);
}
#sidebar .sidebar-footer a {
  color: rgba(255,255,255,.55);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .4rem;
}
#sidebar .sidebar-footer a:hover { color: var(--tele-brand); }

/* ── MAIN CONTENT ─────────────────────────────────────── */

#content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top bar */
#topbar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: .6rem 1.2rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
#topbar .breadcrumb { margin-bottom: 0; font-size: .82rem; background: none; padding: 0; }
#topbar .breadcrumb-item.active { color: #64748b; }
#topbar .topbar-user {
  margin-left: auto;
  font-size: .82rem;
  color: #475569;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* Page content wrapper */
#page-content { padding: 1.25rem 1.5rem; flex: 1; }

/* ── CARDS ────────────────────────────────────────────── */

.tele-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--tele-card-shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.tele-card-header {
  background: var(--tele-sidebar-bg);
  color: #fff;
  padding: .75rem 1rem;
  font-size: .92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .5rem;
  border-radius: 10px 10px 0 0;
}
.tele-card-header .badge-version {
  margin-left: auto;
  font-size: .68rem;
  background: rgba(13,202,240,.25);
  color: var(--tele-brand);
  padding: .15rem .45rem;
  border-radius: 4px;
}
.tele-card-body { padding: 1rem; }

/* Keep original bg-info headers working but slightly updated */
.bg-info.rounded-top, .bg-info.p-3 {
  background: var(--tele-sidebar-bg) !important;
  border-radius: 10px 10px 0 0 !important;
}
.bg-info.rounded-top h1, .bg-info.rounded-top h2, .bg-info.rounded-top h3,
.bg-info.rounded-top h4, .bg-info.rounded-top h5, .bg-info.rounded-top a,
.bg-info.p-3 h1, .bg-info.p-3 h2, .bg-info.p-3 h3,
.bg-info.p-3 h4, .bg-info.p-3 h5, .bg-info.p-3 a {
  color: #fff !important;
}

/* ── TABLES ───────────────────────────────────────────── */

.table thead th {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #64748b;
  white-space: nowrap;
}
.table tbody tr:hover { background: #f0f9ff; }
.table td { vertical-align: middle; font-size: .87rem; }

/* ── FORMS ────────────────────────────────────────────── */

.form-control, .form-select {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: .875rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--tele-brand);
  box-shadow: 0 0 0 3px rgba(13,202,240,.2);
}
.form-label { font-size: .82rem; font-weight: 600; color: #374151; margin-bottom: .25rem; }

/* ── BUTTONS ──────────────────────────────────────────── */

.btn-info {
  background-color: var(--tele-brand);
  border-color: var(--tele-brand);
  color: #1a2744;
  font-weight: 600;
}
.btn-info:hover {
  background-color: var(--tele-brand-dark);
  border-color: var(--tele-brand-dark);
  color: #fff;
}

/* ── LOGIN BOX (sidebar) ──────────────────────────────── */

.login-box {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: .9rem;
  margin: .75rem;
}
.login-box h5, .login-box h6 { color: var(--tele-brand); font-size: .85rem; margin-bottom: .6rem; }
.login-box .form-control {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.2);
  color: #fff;
  font-size: .82rem;
}
.login-box .form-control::placeholder { color: rgba(255,255,255,.4); }
.login-box .form-control:focus {
  background: rgba(255,255,255,.15);
  border-color: var(--tele-brand);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(13,202,240,.25);
}
.login-box label { color: rgba(255,255,255,.7); font-size: .78rem; }
.login-box .btn-login {
  background: var(--tele-brand);
  border: none;
  color: #1a2744;
  font-weight: 700;
  font-size: .83rem;
  padding: .45rem .9rem;
  border-radius: 6px;
  width: 100%;
}
.login-box .btn-login:hover { background: var(--tele-brand-dark); color: #fff; }
.login-box .btn-forgot { color: rgba(255,255,255,.45); font-size: .75rem; }
.login-box .btn-forgot:hover { color: var(--tele-brand); }
.login-box .user-info { color: rgba(255,255,255,.8); font-size: .82rem; }
.login-box .user-name { color: #fff; font-weight: 700; }
.login-box .user-role { color: var(--tele-brand); font-size: .78rem; }

/* ── RESPONSIVE ───────────────────────────────────────── */

@media (max-width: 768px) {
  #sidebar { width: 100%; min-width: 100%; height: auto; position: relative; }
  #wrapper  { flex-direction: column; }
  #page-content { padding: .9rem; }
}

/* ── UTILITIES ────────────────────────────────────────── */

.text-muted-sm { color: #94a3b8 !important; font-size: .78rem; }
.badge-stato { font-size: .72rem; padding: .25em .55em; }
.section-divider { border-top: 1px solid #e2e8f0; margin: 1rem 0; }

/* Abbonamento scadenza alert */
.alert-abbonamento { border-left: 4px solid; border-radius: 8px; font-size: .88rem; }

/* DataTables override */
#jquerydataTable_filter input { border-radius: 6px; border: 1px solid #cbd5e1; }
#jquerydataTable_wrapper .dataTables_paginate .paginate_button { border-radius: 4px !important; }

/* ── MIGLIORAMENTI v2.6.1 ────────────────────────────── */

/* Sidebar scroll verticale */
#sidebar { overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

/* Topbar migliorato */
#topbar { min-height: 50px; }
#topbar .breadcrumb-item + .breadcrumb-item::before { color: #94a3b8; }

/* Badge versione nel topbar */
.topbar-version { font-size: .7rem; background: rgba(13,202,240,.15); color: var(--tele-brand); padding: .1rem .4rem; border-radius: 4px; margin-left: .5rem; }

/* Tele card hover */
.tele-card { transition: box-shadow .2s; }
.tele-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.12); }

/* Messaggi di stato login */
.login-error { background: rgba(220,53,69,.15); border: 1px solid rgba(220,53,69,.35); color: #ff8a8a; border-radius: 6px; padding: .4rem .6rem; font-size: .76rem; margin-bottom: .5rem; }
.login-success { background: rgba(25,135,84,.15); border: 1px solid rgba(25,135,84,.35); color: #6ee79a; border-radius: 6px; padding: .4rem .6rem; font-size: .76rem; margin-bottom: .5rem; }

/* Sidebar mobile overlay */
#sidebar.mobile-open { display: flex !important; position: fixed; top:0; left:0; height:100%; z-index: 1050; box-shadow: 4px 0 20px rgba(0,0,0,.4); }
.sidebar-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:1049; }
.sidebar-overlay.active { display:block; }

/* ── Telefono in verticale: topbar che non sborda ──────── */
/* Il blocco utente (Assistenza + nome + tipo account) è in flex senza a capo:
   sotto i 576px sporgeva oltre il bordo destro e faceva scorrere di lato tutta
   la pagina (ben visibile su Archivio ADM, dove l'iframe occupa tutto lo schermo). */
@media (max-width: 575.98px) {
  #topbar { padding-left: .6rem; padding-right: .6rem; gap: .4rem; }
  #topbar nav[aria-label="breadcrumb"] { min-width: 0; overflow: hidden; }
  #topbar .breadcrumb { flex-wrap: nowrap; }
  #topbar .breadcrumb-item.active { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #topbar .topbar-user { min-width: 0; gap: .35rem; }
  #topbar .topbar-user > span:not(.badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 8.5rem; }
  #topbar .topbar-user .badge { display: none; }  /* tipo account: ridondante su schermo piccolo */
  #topbar .topbar-user .btn { white-space: nowrap; }
  #topbar .topbar-user .btn.me-3 { margin-right: .35rem !important; }
  /* Solo icona: le scritte "Assistenza" e "Administration" sono nodi di testo nudi,
     l'unico modo di nasconderle è azzerare il carattere sul bottone e ripristinarlo
     sull'icona. Senza questo il bottone Administration (visibile ai soli utenti
     interni) sporgeva oltre il bordo destro e faceva scorrere di lato tutta la
     pagina — ben visibile su Archivio ADM, dove l'iframe occupa tutto lo schermo. */
  #topbar .topbar-user .btn { font-size: 0; padding-left: .5rem; padding-right: .5rem; }
  #topbar .topbar-user .btn > i { font-size: .95rem; margin-right: 0 !important; }
}

/* Topbar mobile toggle */
#sidebarToggle { border-color: #dee2e6; }

/* Alerts migliorati */
.alert { border-radius: 8px; border-left-width: 4px; }

/* Loading state per le tabelle */
.table-loading { opacity: .5; pointer-events: none; }

/* Responsive migliorato */
@media (max-width: 991px) {
  #sidebar { display: none; position: fixed; height: 100%; z-index: 1050; }
  #wrapper  { flex-direction: row; }
  #page-content { padding: .85rem; }
  .tele-card-header { font-size: .82rem; }
}
@media (min-width: 992px) {
  #sidebarToggle { display: none; }
}
