/* CSS Document */

/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 16px;
  color: #291f56;
  background-color: #fcfcfc;
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ===== LAYOUT ===== */

.container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Toolbar con search e pulsante */
.toolbar {
  flex-shrink: 0;
  background-color: #fcfcfc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 2px solid #5361ab;
  position: sticky;
  top: 0;
  z-index: 20;
  height: 80px;
}

.tab_toolbar {
  flex-shrink: 0;
  background-color: #fcfcfc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0px 15px;
  position: sticky;
  top: 0;
  z-index: 20;
  height: 30px;
  margin-bottom: -1rem;
}

.form-actions {
  grid-column: span 12;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.btn-nuovo, .btn-back {
  background-color: #478ccb;
  color: white;
  font-weight: bold;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-left: 15px;
}

.btn-nuovo:hover, .btn-back:hover {
  background-color: #356b9c;
}

.btn-icon {
  background: none;
  border: none;
  padding: 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon img {
  width: 1.5rem;
  height: 1.5rem;
  pointer-events: none;
}

/* ===== HEADER ===== */
header {
  background: linear-gradient(to right, #291f56, #5361ab);
  color: #ffffff;
  padding: 1.2rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  height: 72px;
}

header h1 span {
  color: #83b1db;
}

/* ===== BUTTONS ===== */
.button {
  background: linear-gradient(to right, #5361ab, #478ccb);
  color: #ffffff;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(71, 140, 203, 0.3);
}

.button.secondary {
  background: linear-gradient(to right, #83b1db, #478ccb);
  color: #291f56;
}

.button.secondary:hover {
  background: #5361ab;
  color: #ffffff;
}

.button.danger {
  background: #cc3b3b;
  color: white;
  border: none;
}
.button.danger:hover {
  background: #a82828;
}

/* ===== CARDS ===== */
.card {
  background-color: #ffffff;
  border-left: 6px solid #478ccb;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(71, 140, 203, 0.2);
}

/* ===== SECTIONS ===== */
.section {
  background: linear-gradient(145deg, #fcfcfc, #f0f4ff);
  padding: 2rem;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  margin-bottom: 2rem;
}

/* ===== FORMS ===== */
input, select, textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 10px;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

label {
  font-weight: 600;
  margin-top: 1rem;
  color: #291f56;
  display: block;
}

input:focus, select:focus, textarea:focus {
  border-color: #478ccb;
  outline: none;
}

.form-group.checkbox {
  display: flex;
  align-items: left;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.form-group.checkbox label {
  display: flex;
  align-items: center;
  font-weight: 600;
  margin: 0;
  gap: 0.5rem;
}

.form-group.checkbox input[type="checkbox"] {
  margin: 0;
  width: auto;
}

.deceased-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  height: 34px; /* opzionale, per renderlo uniforme come un input */
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #291f56; /* colore del progetto */
  color: #fcfcfc;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.deceased-badge-small {
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background-color: #291f56; /* colore del progetto */
  color: #fcfcfc;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
}


/* ===== TABLES ===== */
/* Tabella con tbody scrollabile */
table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  margin-top: 1.5rem;
  font-size: 0.95rem;
  background-color: #ffffff;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.04);
}

thead {
  display: table;
  width: 100%;
}

thead th {
  position: sticky;
  top: 52px; /* sotto toolbar */
  background-color: #478ccb;
  color: white;
  z-index: 10;
  padding: 10px;
  border-bottom: 1px solid #ddd;
}

th, td {
  text-align: left;
}

tr:hover {
  background-color: #f2f8ff;
}

td .small {
  display: block;
}

.page-list-body {
  display: block;
  width: 100%;
  max-height: calc(100vh - (72px + 1.5rem + 80px + 1.5rem + 45.5px + 1.5rem + 30px)); /* toolbar + padding + footer */
  overflow-y: auto;
}

.modal-list-body {
  display: block;
  width: 100%;
  height: 500px;
  overflow-y: auto;
}

.page-list-body tr,
.modal-list-body tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

td {
  padding: 10px;
  border-bottom: 1px solid #ddd;
  background: #fff;
  display: table-cell;
}

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: bold;
  color: #fff;
}

.badge.success { background-color: #4caf50; }
.badge.warning { background-color: #ffa000; }
.badge.danger  { background-color: #e53935; }
.badge.info    { background-color: #478ccb; }

/* ===== ANIMATIONS ===== */
.fade-in {
  animation: fadeIn 0.4s ease-in-out;
}

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

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }

.rounded { border-radius: 8px; }
.shadow-sm { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); }
.shadow-md { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1); }

/* Toggle switch riutilizzabile */
.form-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background-color: #478ccb;
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

.switch-label {
    color: #291f56;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ===== GESTIONALE LAYOUT ===== */
.layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* Intestazione superiore (header già definita) */
/* Logo e nome utente */
.logo {
  font-weight: bold;
  font-size: 1.3rem;
}

.user-menu {
  position: relative;
}

.user-name {
  cursor: pointer;
  font-weight: bold;
}

.user-menu .dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background-color: #ffffff;
  color: #291f56;
  border: 1px solid #ccc;
  min-width: 160px;
  z-index: 100;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  border-radius: 10px;
}

.user-menu .dropdown a {
  display: block;
  padding: 0.75rem 1rem;
  color: inherit;
  text-decoration: none;
}

.user-menu .dropdown a:hover {
  background-color: #f0f4ff;
}

.user-menu:hover .dropdown {
  display: block;
}

/* Area centrale: Menu + contenuto */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Menu laterale */
.sidebar {
  width: 220px;
  background-color: #83b1db;
}

.sidebar p {
  color: #291f56;
  font-weight: 600;
}

/* Area contenuto */
.page-area {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

/* Search Input */

.search-container {
  position: relative;
  max-width: 300px;
  flex-grow: 1;
}

.search-container input {
  width: 100%;
  padding: 8px 30px 8px 35px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff url("/ico/ico-search.svg") no-repeat 8px center;
  background-size: 18px;
  font-size: 14px;
}

.div-textarea {
  margin-top: 20px;
}

/* Footer */
footer {
  height: 30px;
  background-color: #5361ab;
  color: #ffffff;
  text-align: center;
  line-height: 30px;
  font-size: 0.75rem;
}

/* Switch */

.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #d10000;
  transition: .4s;
  border-radius: 20px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
.switch input:checked + .slider { background-color: #4CAF50; }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* Details Pages */
.details-header {
    flex-shrink: 0;
    background-color: #fcfcfc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 2px solid #5361ab;
    position: sticky;
    top: 0;
    z-index: 20;
    height: 80px;
}

.details-title {
	position: relative;
    max-width: 600px;
    flex-grow: 1;
}

.details form {
	margin-top: 1.5rem;
	display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: 20px;
    align-items: start;
}

.details input,
.details select {
	padding: 0.5rem;
}

/* Tabs */
.tabbed {
	width: 100%;
	min-width: 400px;
	margin: 0 auto;
	margin-top: 10px;
	margin-bottom: 10px;
	border-bottom: 4px solid #000;
	overflow: hidden;
	transition: border 250ms ease;
}

.tabbed ul {
	margin: 0px;
	padding: 0px;
	overflow: hidden;
	float: left;
	display: flex;
	padding-left: 40px;
	list-style-type: none;
}

.tabbed ul * {
	margin: 0px;
	padding: 0px;
}

.tabbed ul li {
	display: block;
	float: none; /* ORIGINALE float: right; */
	padding: 10px 24px 8px;
	background-color: #FFF;
	margin-right: 40px;
	z-index: 2;
	position: relative;
	cursor: pointer;
	/* color: #777; */
	color: #291f56;
	text-transform: uppercase;
	font: 600 10px/20px roboto, "Open Sans", Helvetica, sans-serif;
	transition: all 250ms ease;
}

.tabbed ul li:before,
.tabbed ul li:after {
	display: block;
	content: " ";
	position: absolute;
	top: 0;
	height: 100%;
	width: 44px;  
	background-color: #FFF;
	transition: all 250ms ease;
}

.tabbed ul li:before {
	right: -24px;
	transform: skew(30deg, 0deg);
	box-shadow: rgba(0,0,0,.1) 3px 2px 5px, inset rgba(255,255,255,.09) -1px 0;
}

.tabbed ul li:after {
	left: -24px;
	transform: skew(-30deg, 0deg);
	box-shadow: rgba(0,0,0,.1) -3px 2px 5px, inset rgba(255,255,255,.09) 1px 0;
}

.tabbed ul li:hover,
.tabbed ul li:hover:before,
.tabbed ul li:hover:after {
	background-color: #F4F7F9;
	/* color: #444; */
	color: #5361ab;
}

.tabbed ul li.active {
	z-index: 3;
}
.tabbed ul li.active,
.tabbed ul li.active:before,
.tabbed ul li.active:after {
	background-color: #000;
	color: #fff;
}

/* Round Tabs */
.tabbed.round ul li {
	border-radius: 8px 8px 0 0;
}

.tabbed.round ul li:before {
	border-radius: 0 8px 0 0;
}

.tabbed.round ul li:after {
 	border-radius: 8px 0 0 0;
}

.tabbed.skin-nephritis {
 	/* border-bottom-color: #27AE60; */
	border-bottom-color: #5361ab;
}

.tabbed.skin-nephritis ul li,
.tabbed.skin-nephritis ul li:before,
.tabbed.skin-nephritis ul li:after {
 	/* background-color: #41C87A; */
	background-color: #478ccb;
}

.tabbed.skin-nephritis ul li:hover,
.tabbed.skin-nephritis ul li:hover:before,
.tabbed.skin-nephritis ul li:hover:after {
 	/* background-color: #4DD486; */
	background-color: #83b1db;
}

.tabbed.skin-nephritis ul li.active,
.tabbed.skin-nephritis ul li.active:before,
.tabbed.skin-nephritis ul li.active:after {
 	/* background-color: #27AE60; */
	background-color: #5361ab;
}

/* Dropdown btn */

.dropdown-btn .dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background-color: #ffffff;
  color: #291f56;
  border: 1px solid #ccc;
  min-width: 160px;
  z-index: 100;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  border-radius: 10px;
}

.dropdown-btn .dropdown a {
  display: block;
  padding: 0.75rem 1rem;
  color: inherit;
  text-decoration: none;
}

.dropdown-btn .dropdown a:hover {
  background-color: #f0f4ff;
}

.dropdown-btn:hover .dropdown {
  display: block;
}


/* Suggestions */

.suggestions-list {
  position: absolute;
  z-index: 1000;
  background: white;
  border: 1px solid #ccc;
  max-height: 200px;
  overflow-y: auto;
  width: 100%;
  margin-top: 2px;
  border-radius: 4px;
  box-shadow: 0px 4px 6px rgba(0,0,0,0.1);
}

.modal-content .suggestions-list {
  top: 69px;
}

.details .suggestions-list {
  top: 61px;
}

.suggestion-item {
  padding: 8px;
  cursor: pointer;
}

.suggestion-item:hover {
  background-color: #f0f0f0;
}

/* ===== MODALS ===== */
/* Modal layout */
.modal {
  display: none;
  position: fixed;
  z-index: 99;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: #fff;
  margin: auto;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  position: relative;
}

.modal-content h3 {
  margin-bottom: 1rem;
}

.form-group label {
  margin-top: 0;
}

.form-group input,
.form-group select {
  margin-top: 0.2rem;
  margin-bottom: 0.5rem;
}

.modal .close {
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 28px;
  color: #888;
  cursor: pointer;
}

.modal .close:hover {
  color: #000;
}

.form-group {
  display: flex;
  flex-direction: column;
}

/* LED status dot styling */
.status-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
}

.status-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    box-shadow:
        0 0 5px rgba(0, 0, 0, 0.2),
        0 0 8px rgba(0, 255, 0, 0.6);
}

.status-on {
    background-color: #00c800;
    box-shadow:
        0 0 5px rgba(0, 0, 0, 0.2),
        0 0 8px rgba(0, 255, 0, 0.8),
        0 0 15px rgba(0, 255, 0, 0.6);
}

.status-off {
    background-color: #d10000;
    box-shadow:
        0 0 5px rgba(0, 0, 0, 0.2),
        0 0 8px rgba(255, 0, 0, 0.7),
        0 0 15px rgba(255, 0, 0, 0.4);
}

/* Colonne personalizzate */
.col-12  { grid-column: span 12; position: relative; }
.col-11  { grid-column: span 11; position: relative; }
.col-10  { grid-column: span 10; position: relative; }
.col-9  { grid-column: span 9; position: relative; }
.col-8  { grid-column: span 8; position: relative; }
.col-7  { grid-column: span 7; position: relative; }
.col-6  { grid-column: span 6; position: relative; }
.col-5  { grid-column: span 5; position: relative; }
.col-4  { grid-column: span 4; position: relative; }
.col-3  { grid-column: span 3; position: relative; }
.col-2  { grid-column: span 2; position: relative; }
.col-1  { grid-column: span 1; position: relative; }

/* CCP MODAL */

.ccp-table .cap {
  text-align: left;
  width: 20%;
}

.ccp-table .comune {
  text-align: left;
  width: 70%;	
}

.ccp-table .prov {
  text-align: center;
  width: 10%;
}

#ccpTableBody td {
  cursor: pointer;
}

/* INPUT NUMER EURO */

.input-euro {
  position: relative;
  display: inline-block;
}
.input-euro span {
  position: absolute;
  left: 8px;
  top: 50%;
  padding-top: 1rem;
  transform: translateY(-50%);
  color: #555;
  pointer-events: none; /* non cliccabile */
}
.input-euro input {
  padding-left: 20px; /* lascia spazio per il simbolo */
}

/* Chrome, Safari, Edge */
.input-euro input[type=number]::-webkit-inner-spin-button,
.input-euro input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
.input-euro input[type=number] {
  -moz-appearance: textfield;
}

