/* =========================================================
   Dottore Commercialista — Custom Stylesheet
   Stack: Bootstrap 5 + Bootstrap Icons (CDN)
   ========================================================= */

/* ---------------------------------------------------------
   1. CSS Custom Properties
   --------------------------------------------------------- */
:root {
  --dc-sidebar-width: 260px;
  --dc-sidebar-bg: #1a2236;
  --dc-sidebar-active: #2d6a4f;
  --dc-sidebar-hover: rgba(255,255,255,.08);
  --dc-topbar-height: 56px;
  --dc-accent: #2d6a4f;
  --dc-accent-light: #52b788;
  --dc-danger: #dc3545;
  --dc-text-muted: #6c757d;
  --dc-border: #dee2e6;
  --dc-card-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* ---------------------------------------------------------
   2. Layout base
   --------------------------------------------------------- */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #f4f6f9;
  min-height: 100vh;
}

/* ---------------------------------------------------------
   3. Sidebar
   --------------------------------------------------------- */
.dc-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--dc-sidebar-width);
  height: 100vh;
  background: var(--dc-sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  transition: transform .25s ease;
}

.dc-sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1.5rem;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.dc-sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--dc-accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.dc-sidebar-brand .brand-text {
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.2;
}

.dc-sidebar-brand .brand-text small {
  display: block;
  font-size: .7rem;
  font-weight: 400;
  opacity: .6;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Nav sections */
.dc-nav-section {
  padding: 1rem 0 .25rem;
}

.dc-nav-label {
  padding: .25rem 1.5rem;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  margin-bottom: .25rem;
}

.dc-nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 1.5rem;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: .875rem;
  border-radius: 0;
  transition: background .15s, color .15s;
  position: relative;
}

.dc-nav-link:hover {
  background: var(--dc-sidebar-hover);
  color: #fff;
}

.dc-nav-link.active {
  background: var(--dc-sidebar-active);
  color: #fff;
  font-weight: 500;
}

.dc-nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--dc-accent-light);
  border-radius: 0 2px 2px 0;
}

.dc-nav-link .nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Sidebar footer */
.dc-sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.1);
}

.dc-user-pill {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: rgba(255,255,255,.8);
  font-size: .8rem;
}

.dc-user-avatar {
  width: 32px;
  height: 32px;
  background: var(--dc-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

/* ---------------------------------------------------------
   4. Main content area
   --------------------------------------------------------- */
.dc-main {
  margin-left: var(--dc-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------
   5. Topbar
   --------------------------------------------------------- */
.dc-topbar {
  height: var(--dc-topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--dc-border);
  display: flex;
  align-items: center;
  padding: 0 1.75rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 999;
}

.dc-topbar-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #212529;
  flex: 1;
}

/* ---------------------------------------------------------
   6. Page content
   --------------------------------------------------------- */
.dc-content {
  padding: 1.75rem;
  flex: 1;
}

/* ---------------------------------------------------------
   7. Cards
   --------------------------------------------------------- */
.dc-card {
  background: #fff;
  border: 1px solid var(--dc-border);
  border-radius: 10px;
  box-shadow: var(--dc-card-shadow);
}

.dc-card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--dc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dc-card-header h2, .dc-card-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.dc-card-body {
  padding: 1.5rem;
}

/* ---------------------------------------------------------
   8. Stat cards (dashboard)
   --------------------------------------------------------- */
.dc-stat {
  background: #fff;
  border: 1px solid var(--dc-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--dc-card-shadow);
}

.dc-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.dc-stat-icon.green  { background: #d1fae5; color: #065f46; }
.dc-stat-icon.blue   { background: #dbeafe; color: #1e40af; }
.dc-stat-icon.orange { background: #ffedd5; color: #9a3412; }
.dc-stat-icon.red    { background: #fee2e2; color: #991b1b; }

.dc-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: #212529;
}

.dc-stat-label {
  font-size: .8rem;
  color: var(--dc-text-muted);
  margin-top: .2rem;
}

/* ---------------------------------------------------------
   9. Tables
   --------------------------------------------------------- */
.dc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.dc-table th {
  padding: .65rem 1rem;
  background: #f8f9fa;
  border-bottom: 2px solid var(--dc-border);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--dc-text-muted);
  text-align: left;
  white-space: nowrap;
}

.dc-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.dc-table tr:last-child td { border-bottom: none; }
.dc-table tr:hover td { background: #fafbfc; }

/* ---------------------------------------------------------
   10. Badges di stato
   --------------------------------------------------------- */
.dc-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}

.dc-badge-ok      { background: #d1fae5; color: #065f46; }
.dc-badge-error   { background: #fee2e2; color: #991b1b; }
.dc-badge-unknown { background: #f3f4f6; color: #6b7280; }
.dc-badge-active  { background: #dbeafe; color: #1e40af; }
.dc-badge-inactive{ background: #f3f4f6; color: #6b7280; }
.dc-badge-admin   { background: #fef3c7; color: #92400e; }
.dc-badge-manager { background: #ede9fe; color: #5b21b6; }
.dc-badge-accountant { background: #e0f2fe; color: #075985; }

/* ---------------------------------------------------------
   11. Forms
   --------------------------------------------------------- */
.dc-form-group {
  margin-bottom: 1.25rem;
}

.dc-form-group label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: .35rem;
}

.dc-form-group .form-control,
.dc-form-group input[type="text"],
.dc-form-group input[type="email"],
.dc-form-group input[type="password"],
.dc-form-group input[type="url"],
.dc-form-group textarea,
.dc-form-group select {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--dc-border);
  border-radius: 6px;
  font-size: .875rem;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  color: #212529;
}

.dc-form-group input:focus,
.dc-form-group textarea:focus,
.dc-form-group select:focus {
  outline: none;
  border-color: var(--dc-accent);
  box-shadow: 0 0 0 3px rgba(45,106,79,.12);
}

.dc-form-hint {
  font-size: .75rem;
  color: var(--dc-text-muted);
  margin-top: .25rem;
}

.dc-form-error {
  font-size: .75rem;
  color: var(--dc-danger);
  margin-top: .25rem;
}

/* Checkbox custom */
.dc-checkbox {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .875rem;
}

.dc-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--dc-accent);
}

/* ---------------------------------------------------------
   12. Buttons
   --------------------------------------------------------- */
.dc-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 1rem;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
  line-height: 1.4;
}

.dc-btn-primary {
  background: var(--dc-accent);
  color: #fff;
  border-color: var(--dc-accent);
}
.dc-btn-primary:hover {
  background: #1b4332;
  border-color: #1b4332;
  color: #fff;
}

.dc-btn-secondary {
  background: #fff;
  color: #374151;
  border-color: var(--dc-border);
}
.dc-btn-secondary:hover {
  background: #f9fafb;
  color: #111;
}

.dc-btn-danger {
  background: #fff;
  color: var(--dc-danger);
  border-color: #f5c6cb;
}
.dc-btn-danger:hover {
  background: #fee2e2;
}

.dc-btn-sm {
  padding: .25rem .65rem;
  font-size: .8rem;
}

.dc-btn-icon {
  padding: .35rem .5rem;
}

/* ---------------------------------------------------------
   13. Alerts / Flash messages
   --------------------------------------------------------- */
.dc-alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin-bottom: 1rem;
}
.dc-alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.dc-alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.dc-alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.dc-alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ---------------------------------------------------------
   14. Login page
   --------------------------------------------------------- */
.dc-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a2236 0%, #2d6a4f 100%);
  padding: 1.5rem;
}

.dc-login-box {
  background: #fff;
  border-radius: 14px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}

.dc-login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.dc-login-logo .logo-icon {
  width: 56px;
  height: 56px;
  background: var(--dc-accent);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: #fff;
  margin-bottom: .75rem;
}

.dc-login-logo h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1a2236;
  margin: 0;
}

.dc-login-logo p {
  font-size: .8rem;
  color: var(--dc-text-muted);
  margin: .2rem 0 0;
}

/* ---------------------------------------------------------
   15. Responsive
   --------------------------------------------------------- */
@media (max-width: 991.98px) {
  .dc-sidebar {
    transform: translateX(-100%);
  }
  .dc-sidebar.open {
    transform: translateX(0);
  }
  .dc-main {
    margin-left: 0;
  }
  .dc-topbar-toggle {
    display: flex !important;
  }
}

.dc-topbar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #374151;
  padding: .25rem .5rem;
}
