/* Custom Branding for Bootstrap Dark Theme */

:root {
  --muted: rgba(229, 231, 235, 0.75);
  --danger: #ef4444;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --border: rgba(255, 255, 255, 0.08);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

/* Reset & Global */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--sans);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Bootstrap Overrides for Dark Theme */
.card {
  background-color: var(--custom-card, #111827);
  border-color: var(--border);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 1rem;
}

.btn {
  border-radius: 12px;
  font-weight: 600;
}

.btn-primary {
  background-color: var(--custom-accent, #2563eb);
  border-color: rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
  background-color: #1d4ed8;
  border-color: rgba(0, 0, 0, 0.2);
}

.btn-ghost,
.btn-outline-secondary {
  background-color: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
  color: var(--custom-text, #e5e7eb);
}

.btn-ghost:hover,
.btn-outline-secondary:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

/* Form Controls */
.form-control,
.form-select {
  background-color: rgba(0, 0, 0, 0.25);
  border-color: var(--border);
  color: var(--custom-text, #e5e7eb);
}

.form-control:focus,
.form-select:focus {
  background-color: rgba(0, 0, 0, 0.35);
  border-color: var(--custom-accent, #2563eb);
  color: var(--custom-text, #e5e7eb);
  box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.25);
}

.form-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* Badges & Chips */
.badge {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background-color: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  gap: 4px;
}

/* Utilities */
.muted {
  color: var(--muted);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.done {
  text-decoration: line-through;
  color: var(--muted);
}

/* Responsive Grid Utilities */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 576px) {
  .grid,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Task & Project Specific */
.task-title {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.task-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 0.875rem;
  color: var(--muted);
}

.task-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.prio {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--border);
  background-color: rgba(255, 255, 255, 0.06);
  font-weight: 600;
}

.prio-0 {
  opacity: 0.65;
}

/* Subtasks */
.subtasks {
  margin: 10px 0 0 18px;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Tab Navigation */
.tab-strip {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.tab-link {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  background-color: rgba(255, 255, 255, 0.03);
  color: #e5e7eb;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
}

.tab-link:hover {
  text-decoration: none;
  border-color: var(--custom-accent, #2563eb);
  color: #fff;
  background-color: rgba(255, 255, 255, 0.06);
}

.tab-link.active {
  background-color: rgba(255, 255, 255, 0.07);
  border-color: var(--custom-accent, #2563eb);
  color: #fff;
}

/* Tables - Make responsive */
.table-responsive {
  border-radius: 12px;
  overflow: hidden;
}

.table {
  margin-bottom: 0;
}

.table-dark {
  background-color: var(--custom-card, #111827);
}

.table-dark thead,
.table-dark tbody {
  border-color: var(--border);
}

.table-hover tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Property Info Cards */
.property-info-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
  border-color: rgba(99, 102, 241, 0.3);
}

.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.property-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.property-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.property-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.property-value {
  font-size: 0.95rem;
  color: var(--custom-text, #e5e7eb);
  font-weight: 500;
  word-break: break-word;
}

/* Statistics Cards */
.stat-card {
  background: linear-gradient(135deg, var(--custom-card, #111827) 0%, rgba(37, 99, 235, 0.05) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  font-size: 2.5rem;
  opacity: 0.9;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--custom-accent, #2563eb);
  line-height: 1;
}

.stat-meta {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.stat-link {
  color: var(--custom-accent, #2563eb);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
  margin-top: auto;
}

.stat-link:hover {
  color: #fff;
}

/* List Items */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background-color: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s;
}

.list-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.list-item-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}

/* Narrow container */
.narrow {
  max-width: 420px;
  margin: 40px auto;
}

/* Depreciation Info */
.depreciation-info {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #374151;
  flex-wrap: wrap;
}

.depreciation-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.depreciation-stat .label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
}

.depreciation-stat .value {
  font-size: 1.25rem;
  font-weight: bold;
  color: #f59e0b;
}

.depreciation-section {
  background-color: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 6px;
  padding: 1rem;
  margin-top: 1rem;
}

.depreciation-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}

/* Color Palette Selector */
.color-palette {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.palette-option {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.palette-option:hover {
  transform: scale(1.1);
}

.palette-option input {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.palette-option label {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Mobile-First Responsive Adjustments */
@media (max-width: 768px) {
  .stat-value {
    font-size: 2rem;
  }

  .property-grid {
    grid-template-columns: 1fr;
  }

  .row-between {
    flex-direction: column;
    align-items: flex-start;
  }

  .task-actions {
    justify-content: flex-start;
  }

  .navbar-nav .nav-link {
    padding: 0.5rem 0 !important;
  }
}

/* Utility Classes */
.w-100 {
  width: 100%;
}

.mt-auto {
  margin-top: auto;
}

.gap-3 {
  gap: 1rem;
}

.text-muted {
  color: var(--muted);
}

/* Ensure consistent form spacing */
.form-group {
  margin-bottom: 1rem;
}

/* Accessibility */
a:focus,
button:focus {
  outline: 2px solid var(--custom-accent, #2563eb);
  outline-offset: 2px;
}

/* Sidebar base styling (shared between mobile and desktop) */
.sidebar-desktop,
.sidebar-mobile {
  height: 100%;
  background-color: rgba(17, 24, 39, 0.98);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Desktop: fixed sidebar */
.sidebar-desktop {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 260px;
  z-index: 1030;
}

/* Desktop main content offset */
@media (min-width: 992px) {
  #mainContent {
    margin-left: 260px;
  }
}

/* Mobile: sidebar fills offcanvas */
.sidebar-mobile {
  width: 100%;
  height: 100%;
}

/* Mobile main content - no offset */
@media (max-width: 991.98px) {
  #mainContent {
    margin-left: 0;
  }
}


.sidebar-toggle {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1050;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--custom-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  transition: opacity 0.3s ease;
}

.sidebar-brand:hover {
  text-decoration: none;
  opacity: 0.9;
}

.brand-icon {
  font-size: 1.75rem;
  flex-shrink: 0;
}

.sidebar.collapsed .brand-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar-content {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav .nav-item {
  margin: 0.25rem 0;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: rgba(229, 231, 235, 0.75);
  text-decoration: none;
  transition: all 0.2s ease;
  border-radius: 0;
  font-size: 0.95rem;
  white-space: nowrap;
}

.sidebar-nav .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
}

.sidebar-nav .nav-link.active,
.sidebar-nav .nav-link[href="{{ request.path }}"] {
  background-color: rgba(37, 99, 235, 0.15);
  color: var(--custom-accent, #2563eb);
  border-left: 3px solid var(--custom-accent, #2563eb);
}

.nav-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.sidebar.collapsed .nav-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar-divider {
  margin: 1rem;
  border-color: var(--border);
  opacity: 0.5;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  background-color: rgba(0, 0, 0, 0.2);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar,
.user-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--custom-accent, #2563eb);
}

.user-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--custom-accent, #2563eb);
  font-size: 1.25rem;
}

.user-info {
  flex: 1;
  min-width: 0;
  transition: opacity 0.3s ease;
}

.sidebar.collapsed .user-info {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--custom-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.collapsed .sidebar-footer form button .nav-text {
  display: none;
}

.sidebar.collapsed .sidebar-footer form button {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
}

.sidebar.collapsed .sidebar-footer form button::after {
  content: "🚪";
  font-size: 1.1rem;
}

/* Main Content Adjustments */
.main-content {
  transition: margin-left 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 992px) {
  .main-content {
    margin-left: 260px;
  }
}

@media (max-width: 991.98px) {
  .main-content {
    margin-left: 0;
  }
}

/* Wider container for main content */
.main-content .container-fluid {
  max-width: 1600px;
  padding-left: 2rem;
  padding-right: 2rem;
}

@media (max-width: 768px) {
  .main-content .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Print Styles */
@media print {
  .sidebar-desktop,
  .sidebar-mobile,
  .sidebar-toggle,
  footer,
  .btn,
  .navbar-toggler,
  .navbar {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  body {
    background-color: #fff;
    color: #000;
  }

  .card {
    break-inside: avoid;
  }
}


/* =========================================================
   Bootstrap Offcanvas - Mobile Sidebar
   ========================================================= */

#sidebarOffcanvas {
  background-color: rgba(17, 24, 39, 0.98) !important;
  border-right: 1px solid var(--border);
  width: 280px !important;
}

#sidebarOffcanvas .offcanvas-header {
  border-bottom: 1px solid var(--border);
  background-color: rgba(17, 24, 39, 0.98);
}

#sidebarOffcanvas .offcanvas-body {
  padding: 0;
  background-color: rgba(17, 24, 39, 0.98);
}

/* White close button for dark theme */
#sidebarOffcanvas .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* Ensure offcanvas shows properly when open */
#sidebarOffcanvas.show,
#sidebarOffcanvas.showing {
  visibility: visible !important;
  transform: translateX(0) !important;
}

/* Make sure backdrop shows */
.offcanvas-backdrop.show {
  opacity: 0.5 !important;
}
/* =========================================================
   End of Bootstrap Offcanvas Styling
   ========================================================= */