/* ============================================================
   Italy Reborn RP — Staff Portal :: portal.css  v2
   Design system coerente con il sito pubblico
   ============================================================ */

/* ── Base ──────────────────────────────────────────────────── */
.portal-body {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navbar portale ─────────────────────────────────────────── */
.portal-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,11,15,0.72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  width: 100%;
}
.portal-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1280px, 94%);
  margin: 0 auto;
  height: 62px;
  gap: 1rem;
}
.portal-navbar .brand {
  display: flex;
  align-items: center;
  gap: .8rem;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}
.portal-navbar .brand img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
}
.portal-navbar .brand .title {
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: .2px;
  line-height: 1.2;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.nav-username {
  font-size: .87rem;
  font-weight: 600;
  color: var(--muted);
  padding: .38rem .75rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
}
.nav-username strong { color: var(--text); }

/* ── Pulsante Accesso Staff (sito pubblico) ─────────────────── */
.btn-staff {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .48rem .9rem;
  border-radius: 10px;
  background: rgba(231,30,39,0.08);
  border: 1px solid rgba(231,30,39,0.22);
  color: var(--text);
  font-weight: 700;
  font-size: .88rem;
  text-decoration: none;
  transition: background .18s, border-color .18s, transform .15s;
  white-space: nowrap;
}
.btn-staff:hover {
  background: rgba(231,30,39,0.18);
  border-color: rgba(231,30,39,0.45);
  transform: translateY(-1px);
}
.btn-staff img {
  width: 17px;
  height: 17px;
  filter: invert(1) brightness(2);
  opacity: .8;
}

/* ── Layout principale ──────────────────────────────────────── */
.portal-layout {
  display: flex;
  flex: 1;
  width: min(1280px, 94%);
  margin: 0 auto;
  padding: 2rem 0 4rem;
  gap: 1.6rem;
  align-items: flex-start;
}
.portal-main { flex: 1; min-width: 0; }

/* ── Sidebar ────────────────────────────────────────────────── */
.portal-sidebar {
  width: 210px;
  flex-shrink: 0;
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 18px;
  padding: .75rem .55rem;
  box-shadow: var(--shadow);
}
.sidebar-section-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(184,192,207,0.38);
  padding: .5rem .85rem .2rem;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .62rem .85rem;
  border-radius: 11px;
  font-weight: 600;
  font-size: .9rem;
  color: var(--muted);
  text-decoration: none;
  transition: background .15s, color .15s;
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
}
.sidebar-icon { font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-item:hover:not(.locked) {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.sidebar-item.active {
  background: rgba(231,30,39,0.1);
  color: var(--text);
  border-color: rgba(231,30,39,0.15);
}
.sidebar-item.active .sidebar-icon { color: var(--accent); }
.sidebar-item.locked { opacity: .35; cursor: not-allowed; pointer-events: none; }
.sidebar-lock { margin-left: auto; font-size: .78rem; opacity: .5; }
.sidebar-divider { height: 1px; background: rgba(255,255,255,0.04); margin: .35rem .6rem; }

/* ── Card ───────────────────────────────────────────────────── */
.p-card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 20px;
  padding: 1.8rem 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.4rem;
}
.p-card:last-child { margin-bottom: 0; }
.p-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .8rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.p-card-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Section label ──────────────────────────────────────────── */
.p-section-label {
  font-size: .71rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: .55rem;
}
.p-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(231,30,39,0.15);
}

/* ── Form grid ──────────────────────────────────────────────── */
.p-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}
.p-form-grid .full { grid-column: 1/-1; }
.p-field { display: flex; flex-direction: column; gap: .38rem; }
.p-label {
  font-size: .81rem;
  font-weight: 700;
  color: rgba(184,192,207,0.75);
  letter-spacing: .15px;
}
.p-label .req { color: var(--accent); margin-left: 2px; }

/* ── Inputs ─────────────────────────────────────────────────── */
.p-input, .p-select, .p-textarea {
  width: 100%;
  padding: .78rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-size: .92rem;
  font-family: inherit;
  transition: border-color .18s, box-shadow .18s, background .18s;
  outline: none;
}
.p-input:hover, .p-select:hover, .p-textarea:hover { border-color: rgba(255,255,255,0.12); }
.p-input:focus, .p-select:focus, .p-textarea:focus {
  border-color: rgba(231,30,39,0.45);
  box-shadow: 0 0 0 3px rgba(231,30,39,0.07);
  background: rgba(231,30,39,0.025);
}
.p-input::placeholder, .p-textarea::placeholder { color: rgba(255,255,255,0.2); }
.p-textarea { min-height: 92px; resize: vertical; line-height: 1.55; }
.p-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 11 7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' stroke='rgba(184,192,207,0.5)' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .95rem center;
  padding-right: 2.4rem;
}
.p-select option { background: #141116; }
.p-input[readonly] { opacity: .5; cursor: default; }

/* ── Checkbox / Radio ───────────────────────────────────────── */
.p-check-row { display: flex; flex-wrap: wrap; gap: .55rem .85rem; }
.p-check-item {
  display: flex;
  align-items: center;
  gap: .42rem;
  font-size: .89rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color .14s;
}
.p-check-item:hover { color: var(--text); }
.p-check-item input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }

/* ── Wizard bar ─────────────────────────────────────────────── */
.wizard-bar {
  display: flex;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 1.8rem;
}
.wizard-step-item {
  flex: 1;
  padding: .62rem .3rem;
  text-align: center;
  font-size: .79rem;
  font-weight: 700;
  background: rgba(255,255,255,0.02);
  color: rgba(184,192,207,0.4);
  border-right: 1px solid rgba(255,255,255,0.04);
  letter-spacing: .3px;
  transition: background .2s, color .2s;
}
.wizard-step-item:last-child { border-right: none; }
.wizard-step-item.active { background: rgba(231,30,39,0.12); color: var(--text); }
.wizard-step-item.done { background: rgba(17,162,74,0.07); color: #11a24a; }

/* ── Tabella ────────────────────────────────────────────────── */
.p-table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.05);
}
.p-table { width: 100%; border-collapse: collapse; font-size: .89rem; }
.p-table thead tr {
  background: rgba(255,255,255,0.025);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.p-table th {
  text-align: left;
  padding: .8rem 1rem;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: rgba(184,192,207,0.5);
  white-space: nowrap;
}
.p-table td {
  padding: .88rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.p-table tbody tr:last-child td { border-bottom: none; }
.p-table tbody tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Badge stato ────────────────────────────────────────────── */
.badge-stato {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  padding: .22rem .65rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge-bozza        { background: rgba(120,120,140,.12); color: rgba(184,192,207,.7); border: 1px solid rgba(120,120,140,.18); }
.badge-in_revisione { background: rgba(200,150,0,.1);   color: #f5c518;              border: 1px solid rgba(200,150,0,.18); }
.badge-confermato   { background: rgba(17,162,74,.1);   color: #11a24a;              border: 1px solid rgba(17,162,74,.18); }
.badge-eliminato    { background: rgba(231,30,39,.1);   color: #ff6b72;              border: 1px solid rgba(231,30,39,.18); }

/* ── Alert ──────────────────────────────────────────────────── */
.p-alert {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .95rem 1.1rem;
  border-radius: 14px;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
  animation: alertIn .28s ease;
}
@keyframes alertIn { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:none; } }
.p-alert-success { background: rgba(17,162,74,.09);  border: 1px solid rgba(17,162,74,.18);  color: #2ecc71; }
.p-alert-error   { background: rgba(231,30,39,.09);  border: 1px solid rgba(231,30,39,.18);  color: #ff6b72; }
.p-alert-info    { background: rgba(80,130,220,.09); border: 1px solid rgba(80,130,220,.18); color: #7ab5ff; }
.p-alert-warn    { background: rgba(200,150,0,.09);  border: 1px solid rgba(200,150,0,.18);  color: #f5c518; }

/* ── File upload zone ───────────────────────────────────────── */
.p-file-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: 1.5rem;
  border: 2px dashed rgba(255,255,255,0.09);
  border-radius: 14px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 600;
  transition: border-color .18s, background .18s;
}
.p-file-zone:hover { border-color: rgba(231,30,39,0.35); background: rgba(231,30,39,0.03); color: var(--text); }
.p-file-zone .upload-icon { font-size: 1.7rem; opacity: .45; }
.p-file-input { display: none; }

/* ── Azioni ─────────────────────────────────────────────────── */
.action-row { display: flex; gap: .38rem; flex-wrap: wrap; align-items: center; }
.btn-confirm {
  display: inline-flex; align-items: center; gap: .32rem;
  padding: .42rem .8rem; border-radius: 9px; font-size: .82rem; font-weight: 700;
  background: rgba(17,162,74,.12); border: 1px solid rgba(17,162,74,.25); color: #11a24a;
  cursor: pointer; transition: background .16s; text-decoration: none;
}
.btn-confirm:hover { background: rgba(17,162,74,.22); }
.btn-deny {
  display: inline-flex; align-items: center; gap: .32rem;
  padding: .42rem .8rem; border-radius: 9px; font-size: .82rem; font-weight: 700;
  background: rgba(231,30,39,.1); border: 1px solid rgba(231,30,39,.22); color: #ff6b72;
  cursor: pointer; transition: background .16s; text-decoration: none;
}
.btn-deny:hover { background: rgba(231,30,39,.2); }
.btn-icon {
  display: inline-flex; align-items: center; gap: .32rem;
  padding: .42rem .8rem; border-radius: 9px; font-size: .82rem; font-weight: 700;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07); color: var(--muted);
  cursor: pointer; transition: background .16s, color .16s; text-decoration: none;
}
.btn-icon:hover { background: rgba(255,255,255,0.08); color: var(--text); }

/* ── Login ──────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(ellipse 80% 50% at 50% -5%, rgba(231,30,39,.18) 0%, transparent 65%),
    var(--bg);
}
.login-box {
  width: 100%;
  max-width: 390px;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 22px;
  padding: 2.4rem 1.9rem;
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
}
.login-logo-wrap { display: flex; justify-content: center; margin-bottom: 1.5rem; }
.login-logo {
  width: 66px; height: 66px;
  border-radius: 15px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 28px rgba(0,0,0,.4);
}
.login-heading { text-align: center; margin-bottom: 1.7rem; }
.login-heading h1 { font-size: 1.4rem; font-weight: 900; margin: 0 0 .3rem; line-height: 1.15; }
.login-heading p { color: var(--muted); font-size: .87rem; margin: 0; }

/* Animazione testo */
.anim-text span {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
  animation: charUp .42s forwards cubic-bezier(.22,.9,.3,1);
}
@keyframes charUp { to { opacity:1; transform:none; } }

.login-form { display: flex; flex-direction: column; gap: .9rem; }
.login-back { text-align: center; margin-top: 1.1rem; font-size: .82rem; color: rgba(184,192,207,0.4); }
.login-back a { color: rgba(184,192,207,0.5); text-decoration: underline; }
.login-back a:hover { color: var(--text); }

/* ── Home banner ────────────────────────────────────────────── */
.portal-home-banner {
  background: linear-gradient(120deg, rgba(231,30,39,0.07) 0%, rgba(17,162,74,0.03) 100%);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 20px;
  padding: 1.8rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin-bottom: 1.4rem;
  position: relative;
  overflow: hidden;
}
.portal-home-banner::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(231,30,39,0.07), transparent 70%);
  pointer-events: none;
}
.portal-home-banner img {
  width: 58px; height: 58px;
  border-radius: 13px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.portal-home-banner h1 { font-size: clamp(1.25rem,3vw,1.75rem); font-weight: 900; margin: 0 0 .2rem; }
.portal-home-banner p { margin: 0; color: var(--muted); font-size: .88rem; }

.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px,1fr)); gap: .95rem; }
.guide-tile {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 16px;
  padding: 1.15rem 1.25rem;
  transition: border-color .18s, background .18s;
}
.guide-tile:hover { background: rgba(255,255,255,0.035); border-color: rgba(255,255,255,0.09); }
.guide-tile-icon { font-size: 1.55rem; margin-bottom: .55rem; }
.guide-tile h4 { margin: 0 0 .4rem; font-size: .95rem; font-weight: 800; }
.guide-tile p { margin: 0; font-size: .84rem; color: var(--muted); line-height: 1.55; }

/* ── Documento stampa ───────────────────────────────────────── */
.doc-print-wrap {
  background: #fff;
  color: #1a1a1a;
  border-radius: 14px;
  overflow: hidden;
  font-family: Georgia, serif;
  font-size: .88rem;
  line-height: 1.75;
  box-shadow: 0 16px 60px rgba(0,0,0,.5);
  position: relative;
}
.doc-color-bar { position: absolute; top:0; bottom:0; width: 7px; }
.doc-color-bar.left  { left: 0; }
.doc-color-bar.right { right: 0; }
.doc-inner { padding: 2.5rem 3rem 2.5rem 3.5rem; }

.doc-header-row {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding-bottom: 1.1rem;
  margin-bottom: 1.3rem;
  border-bottom: 2px solid #ebebeb;
}
.doc-header-row img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; border: 1px solid #ddd; }
.doc-server-name { font-size: 1.2rem; font-weight: 900; font-family: Inter,sans-serif; color: #111; margin: 0 0 .1rem; }
.doc-tipo-label {
  display: inline-block;
  padding: .16rem .6rem;
  border-radius: 20px;
  font-size: .73rem;
  font-weight: 700;
  font-family: Inter,sans-serif;
  letter-spacing: .4px;
  background: #f0f0f0;
  color: #444;
}

.doc-section { margin-bottom: 1.2rem; }
.doc-section-title {
  font-size: .69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #999;
  border-bottom: 1px solid #ececec;
  padding-bottom: .32rem;
  margin-bottom: .65rem;
  font-family: Inter,sans-serif;
}
.doc-row { display: flex; gap: .3rem; margin-bottom: .38rem; font-size: .87rem; }
.doc-row strong { font-family: Inter,sans-serif; font-size: .78rem; font-weight: 700; color: #666; min-width: 155px; flex-shrink: 0; }
.doc-row span { color: #1a1a1a; }

.doc-footer-bar {
  margin-top: 1.8rem;
  padding-top: .9rem;
  border-top: 1px solid #ebebeb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: Inter,sans-serif;
  font-size: .7rem;
  color: #aaa;
}
.doc-codice-box {
  display: inline-block;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: .13rem .52rem;
  font-weight: 800;
  color: #444;
  letter-spacing: .5px;
  font-size: .75rem;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 860px) {
  .portal-layout { flex-direction: column; padding-top: 1.2rem; }
  .portal-sidebar { width: 100%; position: static; flex-direction: row; flex-wrap: wrap; padding: .45rem; border-radius: 14px; gap: .1rem; }
  .sidebar-section-label, .sidebar-divider { display: none; }
  .sidebar-item { padding: .5rem .75rem; font-size: .86rem; }
  .p-form-grid { grid-template-columns: 1fr; }
  .p-form-grid .full { grid-column: 1; }
  .p-card { padding: 1.3rem 1.1rem; }
  .doc-inner { padding: 1.8rem 1.8rem 1.8rem 2.1rem; }
  .portal-home-banner { flex-direction: column; text-align: center; }
  .doc-footer-bar { flex-direction: column; gap: .3rem; text-align: center; }
}
@media (max-width: 500px) {
  .login-box { padding: 1.7rem 1.1rem; border-radius: 18px; }
  .portal-nav-inner .brand .title { display: none; }
  .wizard-step-item { font-size: .72rem; padding: .55rem .2rem; }
}
