/* Custom Styles for Enterprise Task Management */

:root {
  --primary-color: #0d6efd;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #0dcaf0;
  --sidebar-width: 250px;
}

body {
  font-size: 0.95rem;
  background-color: #f8f9fa;
}

/* Sidebar Styles */
.sidebar {
  padding: 0;                       /* was 48px top padding — pushed items below the fold */
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
  background-color: #fff;
}

/* Desktop (>=768px): fixed sidebar under the fixed navbar. On phones the
   sidebar is a Bootstrap offcanvas (offcanvas-md) — these fixed-position rules
   must NOT apply there, or they fight the slide-in drawer. */
@media (min-width: 768px) {
  .sidebar {
    position: fixed;
    top: 56px;
    bottom: 0;
    left: 0;
    z-index: 100;
    width: var(--sidebar-width);
  }
  /* Neutralise Bootstrap's offcanvas-md desktop overrides so the fixed sidebar
     keeps its white background and a plain block body (Bootstrap otherwise
     forces transparent bg + flex body at >=md, which would alter the look). */
  .sidebar.offcanvas-md {
    background-color: #fff !important;
    visibility: visible;
    transform: none;
  }
  .sidebar.offcanvas-md .offcanvas-body {
    display: block;
    height: 100%;
    padding: 0;
    overflow-y: visible;
  }
}

.sidebar-sticky {
  position: relative;
  top: 0;
  height: 100%;                     /* fill .sidebar exactly so overflow scrolls in-viewport */
  padding-top: .5rem;
  padding-bottom: 5rem;             /* clearance for the floating notification button */
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, .25) transparent;
}

/* Slim, calm scrollbar so the long nav doesn't feel heavy */
.sidebar-sticky::-webkit-scrollbar { width: 8px; }
.sidebar-sticky::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .18);
  border-radius: 4px;
}
.sidebar-sticky::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, .32); }

.sidebar .nav-link {
  font-weight: 500;
  color: #333;
  padding: 0.45rem 1rem;            /* tighter rows so more items are visible at once */
  font-size: 0.9rem;
  border-radius: 0;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* Tighten the section dividers so groups read clearly without wasting height */
.sidebar .sidebar-heading {
  margin-top: 0.75rem !important;
  margin-bottom: 0.25rem !important;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.sidebar hr { margin-top: 0.5rem; margin-bottom: 0.25rem; }

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

.sidebar .nav-link.active {
  color: var(--primary-color);
  background-color: #e7f1ff;
  border-left: 3px solid var(--primary-color);
}

.sidebar .nav-link i {
  margin-right: 0.5rem;
}

/* Main Content */
main {
  margin-left: var(--sidebar-width);
  padding-top: 70px;
}

main.full-width {
  margin-left: 0;
}

/* Navbar */
.navbar {
  box-shadow: 0 2px 4px rgba(0,0,0,.08);
}

.navbar-brand {
  font-weight: 600;
  font-size: 1.25rem;
}

/* Cards */
.card {
  border: none;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  margin-bottom: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
  background-color: #fff;
  border-bottom: 2px solid #f8f9fa;
  font-weight: 600;
  padding: 1rem 1.25rem;
}

/* Stat Cards */
.stat-card {
  text-align: center;
  padding: 1.5rem;
}

.stat-card .stat-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stat-card .stat-label {
  font-size: 0.875rem;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Task List */
.task-item {
  padding: 1rem;
  border-bottom: 1px solid #e9ecef;
  transition: background-color 0.2s;
}

.task-item:hover {
  background-color: #f8f9fa;
}

.task-item:last-child {
  border-bottom: none;
}

.task-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.task-meta {
  font-size: 0.875rem;
  color: #6c757d;
}

/* Priority Badges */
.priority-low {
  background-color: #d1e7dd;
  color: #0f5132;
}

.priority-medium {
  background-color: #cff4fc;
  color: #055160;
}

.priority-high {
  background-color: #fff3cd;
  color: #664d03;
}

.priority-critical {
  background-color: #f8d7da;
  color: #842029;
}

/* Status Badges */
.status-pending {
  background-color: #e9ecef;
  color: #495057;
}

.status-in_progress {
  background-color: #cfe2ff;
  color: #084298;
}

.status-blocked {
  background-color: #f8d7da;
  color: #842029;
}

.status-completed {
  background-color: #d1e7dd;
  color: #0f5132;
}

.status-cancelled {
  background-color: #e9ecef;
  color: #6c757d;
}

/* Forms */
.form-label {
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Buttons */
.btn {
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: all 0.2s;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: #0b5ed7;
  border-color: #0a58ca;
}

/* Language Switcher */
.language-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.language-switcher .btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
}

.language-switcher .btn.active {
  background-color: var(--primary-color);
  color: white;
}

/* Login Page */
.login-container {
  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: 450px;
  padding: 2rem;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.sso-buttons {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-sso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid #dee2e6;
  background-color: white;
  color: #495057;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-sso:hover {
  background-color: #f8f9fa;
  border-color: #adb5bd;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-sso i {
  font-size: 1.25rem;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.5rem 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #dee2e6;
}

.divider span {
  padding: 0 1rem;
  color: #6c757d;
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 767.98px) {
  /* The sidebar is a slide-in offcanvas here; Bootstrap handles visibility.
     (The old `.sidebar { display:none }` is gone — it hid the nav entirely
     on phones, which was the "no sidebar on mobile" bug.) Give the drawer a
     comfortable, phone-friendly width. */
  .sidebar.offcanvas-md {
    width: 80vw;
    max-width: 320px;
  }
  /* The offcanvas body is the scroll container on mobile, so let the inner
     sticky wrapper grow naturally instead of forcing height:100% (which would
     double-scroll inside the drawer). */
  .sidebar.offcanvas-md .sidebar-sticky {
    height: auto;
    padding-bottom: 1rem;
  }

  main {
    margin-left: 0;
  }

  .stat-card {
    margin-bottom: 1rem;
  }
}

/* Loading Spinner */
.spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

/* Chart Container */
.chart-container {
  position: relative;
  height: 300px;
  margin-top: 1rem;
}
