/* ============================================
   Area Riservata – Alfa Dispenser
   Stylesheet principale
   ============================================ */

:root {
  --primary:    #1a2e5a;
  --accent:     #e63329;
  --light:      #f4f6f9;
  --border:     #dde3ec;
  --text:       #2c3e50;
  --text-muted: #6c7a8d;
  --success:    #27ae60;
  --warning:    #f39c12;
  --danger:     #e74c3c;
  --white:      #ffffff;
  --radius:     8px;
  --shadow:     0 2px 12px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.12);
  --font:       'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--light);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
.site-header {
  background: var(--primary);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
  font-size: 17px;
}
.site-logo img { height: 36px; }
.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
.header-nav a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color .2s;
}
.header-nav a:hover { color: var(--white); }
.btn-logout {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px;
  padding: 6px 16px !important;
}
.btn-logout:hover { background: rgba(255,255,255,.22) !important; }

/* ---- Main ---- */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ---- Footer ---- */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,.6);
  text-align: center;
  padding: 20px;
  font-size: 13px;
}

/* ---- Flash messages ---- */
.flash {
  padding: 14px 20px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  font-size: 14px;
  font-weight: 500;
}
.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.flash-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.flash-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

/* ---- Auth pages (login/register) ---- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  padding: 24px;
}
.auth-box {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 480px;
}
.auth-box.wide { max-width: 600px; }
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo img { max-height: 50px; margin-bottom: 8px; }
.auth-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}
.auth-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.auth-links {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-links a { color: var(--primary); text-decoration: none; font-weight: 500; }

/* ---- Forms ---- */
.form-group {
  margin-bottom: 16px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
label .req { color: var(--accent); }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,46,90,.1);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .2s;
}
.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover { background: #0f1e3d; }
.btn-accent {
  background: var(--accent);
  color: var(--white);
}
.btn-accent:hover { background: #c0271e; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: var(--white); }
.btn-danger  { background: var(--danger);  color: var(--white); }

/* ---- Settori / Prodotti homepage ---- */
.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}
.settore-section { margin-bottom: 48px; }
.settore-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--accent);
  margin-bottom: 20px;
}
.prodotti-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.prodotto-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  transition: box-shadow .2s, transform .2s;
  display: block;
}
.prodotto-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.prodotto-card img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  margin-bottom: 14px;
  border-radius: 4px;
}
.prodotto-card-placeholder {
  width: 100%;
  height: 140px;
  background: var(--light);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--text-muted);
  font-size: 13px;
}
.prodotto-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--primary);
}

/* ---- Pagina prodotto ---- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 24px;
  font-weight: 500;
  transition: color .2s;
}
.back-link:hover { color: var(--primary); }
.product-header {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 28px;
  border: 1px solid var(--border);
}
.product-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

/* ---- Sezione risoluzione problemi ---- */
.sezione-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}
.sezione-header {
  background: var(--primary);
  color: var(--white);
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.sezione-problemi { border-top: 4px solid var(--accent); }
.sezione-problemi .sezione-header { background: #8b1a15; }
.sezione-body { padding: 20px; }

.risoluzione-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.qr-block { text-align: center; }
.qr-block img {
  width: 130px;
  height: 130px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.qr-block p { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.youtube-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ff0000;
  color: var(--white);
  padding: 10px 18px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background .2s;
}
.youtube-link:hover { background: #cc0000; }

/* ---- Lista documenti ---- */
.doc-list { list-style: none; }
.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  background: var(--light);
  transition: background .15s;
}
.doc-item:hover { background: #eaf0fc; }
.doc-item-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
}
.doc-icon { color: var(--accent); font-size: 18px; }
.doc-size { font-size: 12px; color: var(--text-muted); margin-left: 4px; }
.doc-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: var(--white);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s;
}
.doc-download:hover { background: #0f1e3d; }
.doc-empty {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
  padding: 8px 0;
}

/* ---- Admin ---- */
.admin-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
}
.admin-sidebar {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 20px 0;
  align-self: start;
}
.admin-sidebar h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 0 20px 10px;
}
.admin-sidebar a {
  display: block;
  padding: 10px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.admin-sidebar a:hover,
.admin-sidebar a.active {
  background: var(--light);
  color: var(--primary);
  border-left-color: var(--primary);
}
.admin-main { }
.admin-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
}
.admin-card h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ---- Tabella admin ---- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
td {
  padding: 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--light); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-pending  { background: #fff3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .prodotti-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
  .risoluzione-inner { flex-direction: column; align-items: flex-start; }
  .header-inner { padding: 0 16px; }
  .main-content { padding: 20px 16px; }
  .auth-box { padding: 28px 20px; }
}
