/* ============================================================
   app.css - Stile principale SizeNet Hub PWA
   https://www.sizenet.it
   ============================================================ */

/* ============================================================
   1. VARIABILI
   ============================================================ */
:root {
  --sn-primary:       #0d6efd;
  --sn-primary-dark:  #0a58ca;
  --sn-success:       #198754;
  --sn-warning:       #ffc107;
  --sn-danger:        #dc3545;
  --sn-info:          #0dcaf0;
  --sn-light:         #f8f9fa;
  --sn-dark:          #212529;
  --sn-radius:        0.5rem;
  --sn-radius-lg:     0.75rem;
  --sn-shadow:        0 2px 8px rgba(0,0,0,.10);
  --sn-shadow-lg:     0 4px 20px rgba(0,0,0,.15);
  --sn-transition:    all 0.2s ease-in-out;
  --sn-font:          'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ============================================================
   2. BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sn-font);
  font-size: .9375rem;
  color: var(--sn-dark);
  background: #f5f6fa;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   3. NAVBAR
   ============================================================ */
.navbar { min-height: 60px; }
.navbar-brand { font-size: 1.1rem; letter-spacing: -.3px; }
.navbar .nav-link {
  font-size: .875rem;
  font-weight: 500;
  padding: .5rem .75rem;
  border-radius: var(--sn-radius);
  transition: var(--sn-transition);
}
.navbar-dark .nav-link:hover {
  background: rgba(255,255,255,.1);
}
.navbar-dark .nav-link.active {
  background: rgba(255,255,255,.15);
  font-weight: 600;
}

/* Avatar iniziali navbar */
.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  color: var(--sn-primary);
  font-weight: 700;
  font-size: .75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   4. HERO SECTION
   ============================================================ */
.hero-section {
  background: linear-gradient(135deg,
    var(--sn-primary) 0%,
    var(--sn-primary-dark) 60%,
    #084298 100%);
  color: white;
}
.hero-section h1 { font-size: 2.5rem; font-weight: 700; }

/* Fix badge semitrasparenti nella hero */
.hero-section .badge.bg-white {
  background-color: rgba(255,255,255,0.15) !important;
  color: white !important;
}
.hero-section .badge.bg-white.bg-opacity-20 {
  background-color: rgba(255,255,255,0.20) !important;
}

/* Fix card semitrasparenti nella hero */
.hero-section .card.bg-white {
  background-color: rgba(255,255,255,0.15) !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
  color: white !important;
}
.hero-section .card.bg-white .small,
.hero-section .card.bg-white .badge {
  color: white !important;
}

/* Statistiche bar */
.bg-white.border-bottom .fw-bold.text-warning {
  color: #ffc107 !important;
}
.bg-white.border-bottom .fw-bold.text-info {
  color: #0dcaf0 !important;
}

/* ============================================================
   5. CARDS
   ============================================================ */
.card {
  border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--sn-radius-lg);
  box-shadow: var(--sn-shadow);
  transition: var(--sn-transition);
}
.card:hover { box-shadow: var(--sn-shadow-lg); }
.card-header {
  border-bottom: 1px solid rgba(0,0,0,.06);
  border-radius: var(--sn-radius-lg) var(--sn-radius-lg) 0 0 !important;
  padding: 1rem 1.25rem;
  font-weight: 600;
}

/* App card vetrina */
.app-card {
  cursor: pointer;
  border: 2px solid transparent !important;
  height: 100%;
}
.app-card:hover {
  border-color: var(--sn-primary) !important;
  transform: translateY(-3px);
  box-shadow: var(--sn-shadow-lg);
}
.app-icon-placeholder {
  width: 64px;
  height: 64px;
  border-radius: var(--sn-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================================
   6. FORM CONTROLS
   ============================================================ */
.form-control, .form-select {
  border-radius: var(--sn-radius);
  border-color: #dee2e6;
  font-size: .9375rem;
  padding: .5rem .75rem;
  transition: var(--sn-transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--sn-primary);
  box-shadow: 0 0 0 .2rem rgba(13,110,253,.15);
}
.input-group-text {
  border-color: #dee2e6;
  background: #f8f9fa;
}

/* ============================================================
   7. BUTTONS
   ============================================================ */
.btn {
  border-radius: var(--sn-radius);
  font-weight: 500;
  transition: var(--sn-transition);
}
.btn-primary {
  background: linear-gradient(135deg,
    var(--sn-primary), var(--sn-primary-dark));
  border: none;
}
.btn-primary:hover {
  background: linear-gradient(135deg,
    var(--sn-primary-dark), #084298);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13,110,253,.3);
}
.btn-primary:active { transform: translateY(0); }

/* ============================================================
   8. AUTH PAGES
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f6fa 0%, #e8ecf4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  border-radius: var(--sn-radius-lg) !important;
  overflow: hidden;
}
.auth-card .card-header {
  background: linear-gradient(135deg,
    var(--sn-primary), var(--sn-primary-dark)) !important;
  border-radius: 0 !important;
  color: white;
  text-align: center;
  padding: 1.5rem;
}

/* ============================================================
   9. DASHBOARD
   ============================================================ */
.stat-card {
  border-left: 4px solid var(--sn-primary);
  border-radius: var(--sn-radius-lg);
}
.stat-card.success { border-left-color: var(--sn-success); }
.stat-card.warning { border-left-color: var(--sn-warning); }
.stat-card.danger  { border-left-color: var(--sn-danger); }
.stat-card.info    { border-left-color: var(--sn-info); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}
.stat-label {
  font-size: .8125rem;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ============================================================
   10. TABELLE
   ============================================================ */
.table { font-size: .875rem; }
.table th {
  font-weight: 600;
  font-size: .8125rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #6c757d;
  border-bottom: 2px solid #dee2e6;
  padding: .75rem 1rem;
}
.table td {
  padding: .75rem 1rem;
  vertical-align: middle;
}
.table-hover tbody tr:hover {
  background: rgba(13,110,253,.03);
}

/* ============================================================
   11. PRICING CARDS
   ============================================================ */
.pricing-card {
  border: 2px solid #dee2e6;
  border-radius: var(--sn-radius-lg);
  transition: var(--sn-transition);
  position: relative;
  overflow: hidden;
}
.pricing-card.highlighted {
  border-color: var(--sn-primary);
  box-shadow: 0 0 0 4px rgba(13,110,253,.1);
}
.pricing-card.highlighted::before {
  content: 'Consigliato';
  position: absolute;
  top: 12px;
  right: -28px;
  background: var(--sn-primary);
  color: white;
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem 2.5rem;
  transform: rotate(45deg);
}
.pricing-card .price {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--sn-primary);
  line-height: 1;
}
.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.feature-list li {
  padding: .375rem 0;
  font-size: .875rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.feature-list li::before {
  content: '✓';
  color: var(--sn-success);
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================================
   12. LOADING SPINNER
   ============================================================ */
.page-loader {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

/* ============================================================
   13. FLASH MESSAGES
   ============================================================ */
.flash-message {
  animation: slideDown .3s ease-out;
}
@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

/* ============================================================
   14. SIDEBAR ADMIN
   ============================================================ */
.admin-sidebar {
  width: 260px;
  min-height: calc(100vh - 60px);
  background: white;
  border-right: 1px solid rgba(0,0,0,.06);
  padding: 1.5rem 0;
}
.admin-sidebar .nav-link {
  color: var(--sn-dark);
  padding: .625rem 1.25rem;
  border-radius: 0;
  font-size: .875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .625rem;
  transition: var(--sn-transition);
}
.admin-sidebar .nav-link:hover {
  background: var(--sn-light);
  color: var(--sn-primary);
}
.admin-sidebar .nav-link.active {
  background: #cfe2ff;
  color: var(--sn-primary);
  border-right: 3px solid var(--sn-primary);
  font-weight: 600;
}
.admin-sidebar .nav-section {
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6c757d;
  padding: 1rem 1.25rem .375rem;
}

/* ============================================================
   15. OFFLINE INDICATOR
   ============================================================ */
#offlineBanner {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sn-danger);
  color: white;
  text-align: center;
  padding: .5rem;
  font-size: .875rem;
  z-index: 9999;
}

/* ============================================================
   16. PASSWORD STRENGTH
   ============================================================ */
.pwd-strength-bar {
  height: 4px;
  border-radius: 2px;
  transition: width .3s ease;
}

/* ============================================================
   17. RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .hero-section h1 { font-size: 1.75rem; }
  .stat-value { font-size: 1.5rem; }
  .auth-card { margin: .5rem; }
  .admin-sidebar { width: 100%; min-height: auto; }
}

/* ============================================================
   18. SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }

/* ============================================================
   19. PRINT
   ============================================================ */
@media print {
  .navbar, footer, #cookieBanner, #pwaInstallBanner,
  .btn, .no-print { display: none !important; }
  .card { box-shadow: none; border: 1px solid #dee2e6; }
}