﻿html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Focus rings and body/footer positioning now come from theme.css (app shell). */

/* Sync Status Indicator */
.sync-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sync-indicator:hover {
  opacity: 0.8;
}

.sync-synced {
  color: #28a745;
}

.sync-syncing {
  color: #007bff;
}

.sync-offline {
  color: #6c757d;
}

.sync-error {
  color: #dc3545;
}

/* Clickable Card Hover Effects */
.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

a.text-decoration-none:hover .card-hover {
  border-width: 2px;
}

/* Job Updates Timeline Styles */
.timeline-item {
  position: relative;
  padding-left: 40px;
}

.timeline-icon {
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
}

.timeline-content {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #dee2e6;
}

.timeline-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: -20px;
  width: 2px;
  background-color: #dee2e6;
}

.location-tree {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background-color: white;
  margin-bottom: 2rem;
}

.tree-header {
  padding: 1rem;
  border-bottom: 1px solid #e2e8f0;
  background-color: #f8fafc;
}

.tree-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.tree-content {
  padding: 1rem;
}

.location-node {
  margin: 0.25rem 0;
}

.location-content {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 0.25rem;
}

.location-content:hover {
  background-color: #f8fafc;
}

.toggle-icon {
  margin-right: 0.5rem;
  font-size: 0.75rem;
  color: #64748b;
  width: 1rem;
  text-align: center;
}

.location-name {
  font-weight: 500;
}

.location-type {
  color: #64748b;
  font-size: 0.875rem;
}

.item-count {
  margin-left: 0.5rem;
  font-size: 0.75rem;
  background-color: #dbeafe;
  color: #1e40af;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

.no-locations {
  text-align: center;
  color: #64748b;
  padding: 2rem;
}

/* Property Calculation Dependency Styles */
.property-row.has-dependents .btn-danger {
  position: relative;
  cursor: not-allowed;
}

.property-row.has-dependents .btn-danger::after {
  content: "⚠️";
  position: absolute;
  top: -5px;
  right: -5px;
  font-size: 12px;
}

.property-row.has-dependents .btn-danger:hover {
  background-color: #dc3545;
  /* Keep the default color on hover */
  border-color: #dc3545;
}

.dependency-tooltip {
  cursor: help;
}

/* Tailwind-like button styles */
.bg-green-500 {
  background-color: #10b981 !important;
  color: white !important;
  text-decoration: none;
}

.bg-green-500:hover {
  background-color: #059669 !important;
  text-decoration: none;
}

.hover\:bg-green-600:hover {
  background-color: #059669 !important;
}

.bg-gray-500 {
  background-color: #6b7280 !important;
  color: white !important;
  text-decoration: none;
}

.bg-gray-500:hover {
  background-color: #4b5563 !important;
  text-decoration: none;
}

.hover\:bg-gray-600:hover {
  background-color: #4b5563 !important;
}

/* Utility classes */
.px-4 {
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}

.py-2 {
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
}

.rounded {
  border-radius: 0.25rem !important;
}

.ml-2 {
  margin-left: 0.5rem !important;
}

.flex {
  display: flex !important;
}

.justify-between {
  justify-content: space-between !important;
}

.items-center {
  align-items: center !important;
}

.text-2xl {
  font-size: 1.5rem !important;
}

.font-bold {
  font-weight: 700 !important;
}

.mb-6 {
  margin-bottom: 1.5rem !important;
}

/* Blue button style (for Back to Inventory link) */
.bg-blue-500 {
  background-color: #3b82f6 !important;
  color: white !important;
  text-decoration: none;
}

.bg-blue-500:hover {
  background-color: #2563eb !important;
  text-decoration: none;
}

.hover\:bg-blue-600:hover {
  background-color: #2563eb !important;
}

.text-white {
  color: white !important;
}

/* Add styling for item tree action buttons */
.item-actions .action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.action-buttons .btn {
  min-width: 48px;
  white-space: nowrap;
}

/* Ensure smaller screen sizes show buttons properly */
@media (max-width: 1200px) {
  .action-buttons {
    flex-direction: column;
  }

  .action-buttons .btn {
    margin-right: 0 !important;
    margin-bottom: 5px;
  }
}

/* Select2 custom styling for input groups */
.input-group .select2-container {
  flex: 1 1 auto;
  width: 1% !important;
}

.input-group .select2-container .select2-selection--single {
  height: 38px !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

/* Fix vertical alignment within input groups */
.input-group .select2-container .select2-selection--single {
  display: flex !important;
  align-items: center !important;
}

.input-group .select2-container .select2-selection__rendered {
  line-height: 1.5 !important;
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
}

/* Position the dropdown arrow properly */
.input-group .select2-container .select2-selection__arrow {
  height: 36px !important;
}

/* Make sure the select2 height matches the input-group-text */
.select2-container--bootstrap-5 .select2-selection--single {
  height: 38px !important;
}

/* Quick action sidebar buttons */
.btn.text-start {
  transition: all 0.2s ease;
}

.btn.text-start:hover {
  transform: translateX(3px);
}

.btn.text-start i {
  width: 20px;
  text-align: center;
  display: inline-block;
}

/* Navbar and dropdown z-index fixes */
.navbar {
  z-index: 1040 !important;
}

.dropdown-menu {
  z-index: 1050 !important;
}

/* Sticky sidebar styling */
.sticky-top {
  z-index: 1010;
  /* Below navbar and dropdowns but above other content */
}

@media (max-width: 767px) {
  .sticky-top {
    position: relative !important;
    top: 0 !important;
  }
}

/* Activity feed styling */
.activity-feed .activity-item {
  border-left: 2px solid #e9ecef;
  padding-left: 20px;
  position: relative;
}

.activity-feed .activity-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: -20px;
  border: 2px solid #fff;
}

/* Update Banner */
.update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  padding: 12px 20px;
  z-index: 9999;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  animation: slideDown 0.3s ease-out;
}

.update-banner.update-error {
  background: linear-gradient(135deg, #dc3545, #c82333);
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.update-banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  max-width: 1200px;
  margin: 0 auto;
}

.update-icon {
  font-size: 1.5rem;
  animation: spin 2s linear infinite;
}

.update-banner.update-error .update-icon {
  animation: none;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.update-message {
  flex: 1;
  font-size: 0.95rem;
}

.update-countdown {
  font-weight: 600;
  min-width: 150px;
  text-align: center;
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 12px;
  border-radius: 4px;
}

.update-now-btn {
  white-space: nowrap;
}

/* Update Notification Button Pulse */
.update-pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 193, 7, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
  }
}

/* Update Toast Notification */
.update-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: 400px;
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 9998;
  animation: slideIn 0.3s ease-out;
}

.update-toast.update-toast-info {
  background: linear-gradient(135deg, #17a2b8, #138496);
}

.update-toast.fade-out {
  animation: fadeOut 0.5s ease-out forwards;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.update-toast-content {
  display: flex;
  align-items: flex-start;
  padding: 15px 20px;
  gap: 15px;
}

.update-toast-content > i {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.update-toast-text {
  flex: 1;
}

.update-toast-text strong {
  display: block;
  margin-bottom: 5px;
}

.update-toast-text p {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

.update-toast .btn-close {
  flex-shrink: 0;
  margin-top: 2px;
}

/* Changelog shimmer - draws attention when new version has unviewed changelog */
.changelog-shimmer {
  position: relative;
  overflow: hidden;
  border-color: #0d6efd;
  color: #0d6efd;
  font-weight: 500;
}

.changelog-shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(13, 110, 253, 0.25), transparent);
  animation: changelogShimmer 2s infinite;
}

@keyframes changelogShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* ============================================================
   Job lifecycle stepper (Jobs/Details)
   States: done (happened), skipped (jumped over), current (next
   natural step), future (reachable by jumping). All steps are
   clickable when the user has permission.
   ============================================================ */
.job-stepper {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.job-stepper-cancelled {
  display: block;
  padding: 10px 14px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  color: #6c757d;
}

.job-step {
  display: flex;
  align-items: center;
}

.job-step-form {
  display: inline;
  margin: 0;
}

.job-step-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 4px 6px;
  border-radius: 8px;
  color: #64748b;
  font-size: 0.85rem;
  white-space: nowrap;
  text-decoration: none;
}

button.job-step-btn { cursor: pointer; }
button.job-step-btn:hover { background: #eef2f7; }

.job-step-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 600;
  border: 2px solid #cbd5e1;
  background: #fff;
  color: #64748b;
  flex-shrink: 0;
}

.job-step.done .job-step-circle {
  background: #198754;
  border-color: #198754;
  color: #fff;
}

.job-step.done .job-step-label { color: #198754; font-weight: 600; }

.job-step.skipped .job-step-circle {
  background: #fff;
  border-style: dashed;
  border-color: #94a3b8;
  color: #94a3b8;
}

.job-step.skipped .job-step-label {
  color: #94a3b8;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.job-step.current .job-step-circle {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.18);
}

.job-step.current .job-step-label { color: #0d6efd; font-weight: 600; }

.job-step-connector {
  width: 26px;
  height: 2px;
  background: #cbd5e1;
  margin: 0 2px;
  flex-shrink: 0;
}

.job-step-connector.done { background: #198754; }

@media (max-width: 768px) {
  .job-step-label { display: none; }
  .job-step.current .job-step-label { display: inline; }
}
