/* ============================================================
   COSTRUZIONI FERRARA — Admin Panel
   Eredita token da ../css/00-base.css
   ============================================================ */

/* ── hidden override — prevents display:grid/flex from overriding [hidden] ── */
[hidden] { display: none !important; }

/* ── reset body ── */
.adm-body {
  min-height: 100vh;
  background: var(--ink);
  overflow-x: hidden;
}

/* ── shared emblem ── */
.adm-emblem { width: 36px; height: 36px; flex-shrink: 0; }
.adm-wm { font-family: var(--font-display); font-size: 13px; letter-spacing: .04em; }
.adm-wm .c { display: block; font-size: 9px; letter-spacing: .18em; color: var(--fog-dim); line-height: 1.2; }
.adm-wm .o { display: block; color: var(--orange); line-height: 1; }

/* ── loader ── */
.adm-loader {
  position: fixed;
  inset: 0;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity .3s;
}
.adm-loader.done { opacity: 0; pointer-events: none; }
.adm-loader-emblem { width: 56px; height: 56px; animation: adm-pulse 1.4s ease-in-out infinite; }
@keyframes adm-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── login ── */
.adm-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}
.adm-login-box {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 40px 36px;
}
.adm-login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.adm-login-kicker {
  color: var(--orange);
  margin-bottom: 8px;
}
.adm-login-title {
  font-family: var(--font-display);
  font-size: 28px;
  text-transform: uppercase;
  margin: 0 0 28px;
  line-height: 1;
}

/* ── layout ── */
.adm-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

/* ── sidebar ── */
.adm-sidebar {
  background: var(--anthracite);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.adm-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.adm-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.adm-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  background: none;
  border: none;
  color: var(--fog);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .15s, color .15s;
  width: 100%;
}
.adm-nav-item:hover { background: var(--surface); color: var(--white); }
.adm-nav-item.active { background: var(--orange-soft); color: var(--orange); }
.adm-sidebar-foot {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}
.adm-user-email {
  display: block;
  font-size: 12px;
  color: var(--fog);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.adm-user-role {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--orange-soft);
  color: var(--orange);
  margin-bottom: 12px;
}
.adm-logout-btn {
  background: none;
  border: none;
  color: var(--fog-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  transition: color .2s;
}
.adm-logout-btn:hover { color: var(--orange); }

/* ── main ── */
.adm-main {
  background: var(--ink);
  min-height: 100vh;
  overflow-y: auto;
}
.adm-panel {
  padding: clamp(24px, 4vw, 48px);
  max-width: 1100px;
}
.adm-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.adm-panel-head h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.5vw, 32px);
  text-transform: uppercase;
  margin: 0;
  line-height: 1;
}

/* ── buttons ── */
.adm-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s, opacity .2s;
  white-space: nowrap;
}
.adm-btn-primary:hover { background: var(--orange-deep); }
.adm-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.adm-btn-primary.full { width: 100%; justify-content: center; }

.adm-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--fog);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .2s, color .2s;
  white-space: nowrap;
}
.adm-btn-ghost:hover { border-color: var(--orange); color: var(--orange); }

.adm-inline-btn {
  background: none;
  border: none;
  color: var(--orange);
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font-family: inherit;
}

/* ── form fields ── */
.adm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.adm-field label {
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fog-dim);
}
.adm-field input,
.adm-field select,
.adm-field textarea {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .2s;
  width: 100%;
}
.adm-field input:focus,
.adm-field select:focus,
.adm-field textarea:focus {
  border-color: var(--orange);
}
.adm-field select option { background: var(--surface-2); }
.adm-field textarea { resize: vertical; min-height: 80px; }
.adm-field-check { justify-content: center; padding-top: 8px; }

.adm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}
.adm-col2 { grid-column: 1 / -1; }
.adm-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* login form */
.adm-form { max-width: none; }
#loginForm { display: flex; flex-direction: column; gap: 16px; }
#loginForm .adm-btn-primary { margin-top: 4px; }

/* checkboxes */
.adm-checks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.adm-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--fog);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.adm-check-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--orange);
  flex-shrink: 0;
  cursor: pointer;
}

/* ── error msg ── */
.adm-error {
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .3);
  color: #f87171;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  margin: 0;
}

/* ── list table ── */
.adm-list-wrap { overflow-x: auto; }
.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.adm-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--fog-dim);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.adm-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--white);
}
.adm-table tr:last-child td { border-bottom: none; }
.adm-table tr:hover td { background: rgba(255,255,255,.02); }
.adm-table .adm-actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}
.adm-action-btn {
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  background: none;
  color: var(--fog);
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.adm-action-btn:hover { border-color: var(--white); color: var(--white); }
.adm-action-btn.foto  { border-color: var(--yellow); color: var(--yellow); }
.adm-action-btn.foto:hover { background: rgba(255,196,0,.08); }
.adm-action-btn.edit  { border-color: var(--orange); color: var(--orange); }
.adm-action-btn.edit:hover { background: var(--orange-soft); }
.adm-action-btn.del   { border-color: rgba(239,68,68,.4); color: #f87171; }
.adm-action-btn.del:hover { background: rgba(239,68,68,.1); border-color: #f87171; }

.adm-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 10px;
}
.adm-badge.disp { background: rgba(34,197,94,.12);  color: #4ade80; }
.adm-badge.ris  { background: rgba(251,191,36,.12); color: #fbbf24; }
.adm-badge.vend { background: rgba(148,163,184,.1); color: #94a3b8; }
.adm-badge.pros { background: rgba(99,102,241,.12); color: #818cf8; }

.adm-vis-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  transition: opacity .2s;
  padding: 0;
}
.adm-vis-toggle:hover { opacity: .7; }

.adm-empty {
  text-align: center;
  padding: 48px;
  color: var(--fog-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ── foto panel ── */
.adm-dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 28px;
  color: var(--fog);
}
.adm-dropzone:hover,
.adm-dropzone.drag-over { border-color: var(--orange); background: var(--orange-soft); }
.adm-dropzone svg { color: var(--fog-dim); margin-bottom: 12px; }
.adm-dropzone p { margin: 4px 0; font-size: 14px; }
.adm-dropzone-hint { font-size: 12px; color: var(--fog-dim); font-family: var(--font-mono); }

.adm-upload-bar {
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
  height: 6px;
  margin-bottom: 20px;
  position: relative;
}
.adm-upload-fill {
  height: 100%;
  background: var(--orange);
  transition: width .3s;
  width: 0%;
}
.adm-upload-bar span {
  position: absolute;
  right: 0; top: 10px;
  font-size: 11px;
  color: var(--fog-dim);
  font-family: var(--font-mono);
}

.adm-foto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.adm-foto-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.adm-foto-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}
.adm-foto-card-body {
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.adm-foto-ord {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fog-dim);
}
.adm-foto-actions {
  display: flex;
  gap: 4px;
}
.adm-foto-btn {
  background: none;
  border: none;
  color: var(--fog);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 14px;
  border-radius: 3px;
  transition: color .15s, background .15s;
}
.adm-foto-btn:hover { color: var(--white); background: var(--surface-2); }
.adm-foto-btn.del:hover { color: #f87171; }

/* ── utenti placeholder ── */
.adm-utenti-info {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  max-width: 480px;
}
.adm-utenti-info p {
  color: var(--fog);
  margin-bottom: 20px;
}

/* ── responsive ── */
@media (max-width: 768px) {
  .adm-layout { grid-template-columns: 1fr; }
  .adm-sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .adm-sidebar-logo { padding: 16px; border-bottom: none; }
  .adm-nav { flex-direction: row; padding: 8px 12px; }
  .adm-sidebar-foot { width: 100%; border-top: 1px solid var(--line); padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
  .adm-form-grid { grid-template-columns: 1fr; }
  .adm-col2 { grid-column: 1; }
  .adm-checks-grid { grid-template-columns: 1fr 1fr; }
  .adm-panel { padding: 20px 16px; }
}

/* ── servizi edit — section headers ── */
.adm-form-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .20em;
  text-transform: uppercase;
  color: var(--orange);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 0 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.adm-form-section-title::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 2px;
  background: var(--orange);
  flex-shrink: 0;
}

/* card wrapper for form sections */
.adm-form-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
}
.adm-form-section .adm-form-section-title {
  padding-top: 0;
  margin-bottom: 16px;
}
.adm-form-section .adm-form-grid { margin-bottom: 0; }

/* ── servizi — attività rows ── */
.adm-attivita-row {
  display: grid;
  grid-template-columns: 32px 1fr 28px;
  gap: 8px;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.adm-attivita-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--orange);
  padding-top: 8px;
  text-align: center;
}
.adm-attivita-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.adm-attivita-fields input,
.adm-attivita-fields textarea {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 6px 10px;
  width: 100%;
  resize: vertical;
}
.adm-attivita-fields input:focus,
.adm-attivita-fields textarea:focus {
  outline: none;
  border-color: var(--orange);
}
