/* Haytask Admin Portal — Custom Styles */

/* Page content padding */
#page-content > div:first-child {
  padding: 24px;
}

/* Sidebar nav links */
.nav-link {
  color: #6b7280;
}
.nav-link:hover {
  background-color: #f3f4f6;
  color: #111827;
}
.nav-link.active {
  background-color: #ecfdf5;
  color: #059669;
}
.nav-link.active .material-icons-outlined {
  color: #059669;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-dark {
  border-color: #d1d5db;
  border-top-color: transparent;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-unassigned { background: #fef3c7; color: #92400e; }
.badge-scheduled { background: #dbeafe; color: #1e40af; }
.badge-on_site { background: #e0e7ff; color: #3730a3; }
.badge-in_progress { background: #fce7f3; color: #9d174d; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-invoiced { background: #ede9fe; color: #5b21b6; }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #d1fae5; color: #065f46; }
.badge-declined { background: #fee2e2; color: #991b1b; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-sent { background: #dbeafe; color: #1e40af; }
.badge-draft { background: #f3f4f6; color: #374151; }
.badge-active { background: #d1fae5; color: #065f46; }

/* Stat cards */
.stat-card {
  background: #fff;
  border-radius: 16px;
  padding: 20px 24px;
  border: 1px solid #f3f4f6;
  transition: box-shadow 0.2s;
}
.stat-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* Data table */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.data-table thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #f3f4f6;
  background: #f9fafb;
}
.data-table thead th:first-child { border-radius: 12px 0 0 0; }
.data-table thead th:last-child { border-radius: 0 12px 0 0; }
.data-table tbody td {
  padding: 14px 16px;
  font-size: 14px;
  color: #374151;
  border-bottom: 1px solid #f3f4f6;
}
.data-table tbody tr {
  transition: background 0.15s;
}
.data-table tbody tr:hover {
  background: #f9fafb;
}
.data-table tbody tr.clickable {
  cursor: pointer;
}
.data-table tbody tr.clickable:hover {
  background: #ecfdf5;
}

/* Cards */
.card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #f3f4f6;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body {
  padding: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  outline: none;
}
.btn-primary {
  background: #059669;
  color: #fff;
}
.btn-primary:hover { background: #047857; }
.btn-secondary {
  background: #f3f4f6;
  color: #374151;
}
.btn-secondary:hover { background: #e5e7eb; }
.btn-danger {
  background: #fee2e2;
  color: #991b1b;
}
.btn-danger:hover { background: #fecaca; }
.btn-outline {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #374151;
}
.btn-outline:hover { background: #f9fafb; }
.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 10px;
}
.btn-icon {
  padding: 8px;
  border-radius: 10px;
}

/* Form inputs */
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #fff;
}
.form-input:focus {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}
.empty-state .material-icons-outlined {
  font-size: 48px;
  color: #d1d5db;
  margin-bottom: 16px;
}

/* Tabs */
.tab-bar {
  display: flex;
  gap: 4px;
  background: #f3f4f6;
  padding: 4px;
  border-radius: 12px;
}
.tab-btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: transparent;
}
.tab-btn.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Calendar */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}
.cal-cell {
  background: #fff;
  min-height: 100px;
  padding: 8px;
}
.cal-cell-header {
  background: #f9fafb;
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  text-align: center;
}
.cal-day {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
}
.cal-day.today {
  background: #059669;
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-day.other-month {
  color: #d1d5db;
}
.cal-event {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Skeleton shimmer loading */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
.skeleton-text { height: 14px; margin-bottom: 8px; width: 60%; }
.skeleton-text-lg { height: 20px; margin-bottom: 10px; width: 40%; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.skeleton-card { height: 120px; border-radius: 12px; }
.skeleton-row { height: 52px; border-bottom: 1px solid #f3f4f6; }
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Focus ring for inputs (replaces onfocus/onblur handlers) */
.input-focus {
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-focus:focus {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
  outline: none;
}

/* Toast animation */
#toast > div {
  animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* Responsive */
@media (max-width: 1024px) {
  #sidebar {
    position: fixed;
    left: -264px;
    top: 0;
    bottom: 0;
    z-index: 30;
  }
  #sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
  }
}

/* Pulse animation for live stats */
.pulse-dot {
  width: 8px;
  height: 8px;
  background: #059669;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Detail page header */
.detail-header {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  padding: 24px 28px;
  color: white;
  border-radius: 16px;
  margin-bottom: 20px;
}

/* Timeline */
.timeline-item {
  position: relative;
  padding-left: 28px;
  padding-bottom: 20px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: -8px;
  width: 2px;
  background: #e5e7eb;
}
.timeline-item:last-child::before { display: none; }
.timeline-item::after {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  width: 12px;
  height: 12px;
  background: #059669;
  border-radius: 50%;
  border: 2px solid #fff;
}
