/* assets/css/index.css
   Tout le style de la page index est ici (page + modal + boutons + liste).
*/

:root{
  --bg: #0b1220;
  --card: rgba(255,255,255,0.06);
  --line: rgba(255,255,255,0.14);
  --text: #eaf0ff;
  --muted: rgba(234,240,255,0.70);
  --brand: #0a66ff;
  --danger: #ff5a5a;
  --shadow: 0 16px 50px rgba(0,0,0,0.45);
  --radius: 16px;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 500px at 10% 0%, rgba(10,102,255,0.18), transparent 60%),
    radial-gradient(900px 600px at 90% 10%, rgba(90,255,190,0.10), transparent 55%),
    var(--bg);
}

/* Layout */
.container{
  max-width: 980px;
  margin: 0 auto;
  padding: 18px;
}

.header{
  display:flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

h1{
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: .2px;
}
h2{
  margin: 0;
  font-size: 16px;
}
h3{
  margin: 0;
  font-size: 16px;
}

.muted{
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* Buttons */
.actions{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn{
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: .2px;
}
.btn:hover{
  border-color: rgba(255,255,255,0.22);
}
.btn.primary{
  background: rgba(10,102,255,0.92);
  border-color: rgba(10,102,255,0.35);
}
.btn.primary:hover{
  background: rgba(10,102,255,0.98);
}
.btn.danger{
  background: rgba(255,90,90,0.18);
  border-color: rgba(255,90,90,0.35);
}

/* Card */
.card{
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.18);
}

.card-title{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
  margin-bottom: 10px;
}

.badge{
  border: 1px solid rgba(255,255,255,0.16);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* Messages */
.msg{
  margin: 10px 0 0;
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}
.msg.ok{ color: rgba(90,255,190,0.95); }
.msg.err{ color: rgba(255,120,120,0.95); }

/* List */
.list{
  display:grid;
  gap: 10px;
}
.row{
  width: 100%;
  text-align: left;
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  cursor:pointer;
}
.row:hover{
  border-color: rgba(255,255,255,0.20);
  background: rgba(255,255,255,0.06);
}
.row-main{ min-width: 0; }
.row-title{
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color : white;
}
.row-meta{
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal */
.backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.60);
  z-index: 1000;
}

.modal{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  padding: 18px;
}

.modal-card{
  width: min(560px, 100%);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(15,18,25,0.96);
  box-shadow: var(--shadow);
  padding: 14px;
}

.modal-head{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.form{
  display:grid;
  gap: 10px;
  padding-top: 12px;
}

.field span{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input{
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  outline: none;
}
.field input:focus{
  border-color: rgba(10,102,255,0.55);
}

.modal-foot{
  display:flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* Mobile */
@media (max-width: 760px){
  .header{
    flex-direction: column;
    align-items: stretch;
  }
  .actions{
    justify-content: flex-start;
  }
}

/* Prevent scroll behind modal */
body.modal-open{
  overflow: hidden;
}
/* Force le comportement du booléen hidden, même si un reset CSS l'a cassé */
[hidden] {
  display: none !important;
}
.modal-body{
  padding: 14px 16px 0;
}

.modal-text{
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

/* Bouton confirm en mode "danger" (reset) */
.danger-confirm{
  background: #fff !important;
  border-color: rgba(239,68,68,0.45) !important;
  color: #b91c1c !important;
}
.danger-confirm:hover{
  background: rgba(239,68,68,0.06) !important;
  border-color: rgba(239,68,68,0.55) !important;
}
/* --- Ajouts légers : header + breadcrumb (index) --- */
.header--stack{
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.header-top{
  display:flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.breadcrumb{
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* --- Suggest machines (autocomplete) --- */
.suggest{
  margin-top: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  overflow: auto;
  max-height: 220px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.suggest-item{
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: baseline;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.suggest-item:hover{
  background: rgba(255,255,255,0.06);
}

.suggest-code{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(10,102,255,0.18);
  color: rgba(234,240,255,0.95);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .4px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.suggest-label{
  font-size: 13px;
  color: var(--muted);
  line-height: 1.25;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile: liste un peu plus compacte */
@media (max-width: 760px){
  .suggest{
    max-height: 180px;
  }
  .suggest-item{
    padding: 9px 10px;
  }
  .suggest-label{
    font-size: 12px;
  }
}
.btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}
.net-status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.net-status--online {
  background: #d1fae5;
  color: #065f46;
}

.net-status--offline {
  background: #fee2e2;
  color: #991b1b;
}

.sync-status {
  font-size: 12px;
  opacity: 0.7;
  margin-left: 8px;
}
