/* GIS — Gestion Immobilière Simplifiée — App CSS */

/* ============================================================
   SIDEBAR — style Netbox
   ============================================================ */

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: #152535;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  border-right: 1px solid #0d1e2c;
}

#main-content {
  margin-left: 240px;
  padding: 1.5rem;
  min-height: 100vh;
  background: #f0f2f5;
}

/* --- Brand --- */
.sb-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1.2rem 1.1rem 1rem;
  background: #0e1d2b;
  border-bottom: 1px solid #0a1520;
  flex-shrink: 0;
}

.sb-brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.sb-brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --- User block --- */
.sb-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1.1rem;
  background: #11202f;
  border-bottom: 1px solid #0d1a27;
  flex-shrink: 0;
}

.sb-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1e6091;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.sb-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #e2eaf2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-user-role {
  font-size: 0.72rem;
  color: #6b8caa;
  text-transform: capitalize;
}

/* --- Navigation --- */
.sb-nav {
  flex: 1;
  padding: 0.5rem 0;
}

.sb-section-label {
  font-size: 0.67rem;
  font-weight: 700;
  color: #4d7494;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 1rem 1.1rem 0.3rem;
}

.sb-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.48rem 1.1rem;
  color: #aec4d6;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}

.sb-link i, .sb-link > span:first-child {
  font-size: 1.05rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.sb-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  border-left-color: #3b82f6;
}

.sb-link.active {
  background: rgba(59, 130, 246, 0.15);
  color: #ffffff;
  border-left-color: #3b82f6;
  font-weight: 600;
}

/* --- Footer / Logout --- */
.sb-footer {
  padding: 0.75rem 0.9rem;
  border-top: 1px solid #0d1a27;
  flex-shrink: 0;
}

.sb-logout {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  background: transparent;
  border: 1px solid #2a4a62;
  border-radius: 6px;
  color: #7da5bf;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.sb-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #fca5a5;
}

/* === FLASH MESSAGES === */
.flash-container {
  position: sticky;
  top: 0;
  z-index: 50;
}

/* === LOGIN PAGE === */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* === CARDS === */
.card {
  border: none;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* === KPI CARDS === */
.kpi-card {
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
  color: white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.kpi-card .kpi-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.kpi-card .kpi-label {
  font-size: 0.8rem;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* === CONFIRM AREA === */
#confirm-area {
  margin-bottom: 1rem;
}

/* === PLOTLY CHARTS === */
.chart-container {
  border-radius: 10px;
  overflow: hidden;
  background: white;
  padding: 1rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* === TABLE === */
.table-responsive {
  border-radius: 8px;
  overflow: hidden;
}

/* === BADGES === */
.badge-occupied {
  background-color: #22c55e;
  color: white;
}

.badge-vacant {
  background-color: #ef4444;
  color: white;
}

/* === DOCUMENT LIST (espace locataire) === */
.hover-row {
  transition: background 0.1s ease;
}
.hover-row:hover {
  background: #f1f5f9;
}

/* --- Page header --- */
.doc-page-header { padding-bottom: 1rem; border-bottom: 2px solid #e2e8f0; }
.doc-page-title  { display: flex; align-items: center; gap: 1rem; }
.doc-page-title > i { font-size: 2rem; color: #3b82f6; flex-shrink: 0; }
.doc-page-title h4  { font-weight: 700; color: #1e293b; }

/* --- Onglets custom --- */
.doc-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
}
.doc-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: color 0.15s, border-color 0.15s;
}
.doc-tab:hover  { color: #1e293b; }
.doc-tab.active { color: #3b82f6; border-bottom-color: #3b82f6; font-weight: 600; }

/* --- Toolbar sélection --- */
.doc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.doc-select-all { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }

/* --- Carte année --- */
.doc-year-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.doc-year-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #f1f5f9;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
}
.doc-year-header:hover { background: #e2e8f0; }
.doc-year-label {
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: #334155;
  gap: 0.25rem;
}
.doc-year-count {
  font-size: 0.72rem;
  font-weight: 500;
  color: #94a3b8;
  background: #e2e8f0;
  border-radius: 99px;
  padding: 0.1rem 0.55rem;
  margin-left: 0.5rem;
}
.doc-chevron { color: #94a3b8; transition: transform 0.2s ease; font-size: 0.85rem; }
.doc-year-body { display: none; padding: 0.35rem 0; }

/* --- Ligne fichier --- */
.doc-file-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1rem;
  transition: background 0.1s;
}
.doc-file-row:hover { background: #f8fafc; }
.doc-file-icon-wrap { flex-shrink: 0; cursor: pointer; line-height: 1; }
.doc-file-icon      { font-size: 1.7rem; }
.doc-file-icon.pdf   {}
.doc-file-icon.img   {}
.doc-file-icon.word  {}
.doc-file-icon.other {}
.doc-file-name {
  flex: 1;
  font-size: 0.84rem;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.doc-file-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.doc-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.12s;
  text-decoration: none;
  color: inherit;
}
.doc-btn-preview  { color: #3b82f6; border-color: #bfdbfe; }
.doc-btn-preview:hover  { background: #eff6ff; color: #2563eb; }
.doc-btn-download { color: #64748b; border-color: #e2e8f0; }
.doc-btn-download:hover { background: #f1f5f9; color: #334155; }

/* --- État vide --- */
.doc-empty {
  text-align: center;
  color: #94a3b8;
  padding: 2.5rem 1rem;
  font-size: 0.9rem;
}

/* === RESPONSIVE === */

/* Bouton hamburger (visible uniquement mobile) */
#sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: #152535;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}
#sidebar-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: #aec4d6;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 768px) {
  #sidebar-toggle {
    display: flex;
  }

  #sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 240px;
    height: 100vh;
    transition: left 0.25s ease;
    z-index: 150;
  }

  #sidebar.open {
    left: 0;
  }

  /* Overlay sombre quand sidebar ouverte */
  #sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 140;
  }
  #sidebar-overlay.visible {
    display: block;
  }

  #main-content {
    margin-left: 0;
    padding: 1rem;
    padding-top: 3.5rem; /* espace pour le bouton hamburger */
  }
}
