/* ============================================
   HR Dashboard Redesign - Design Tokens & Components
   Prefix: hrd- (HR Dashboard)
   Version: 2026-02-11
   ============================================ */

/* ---- 1. Design Tokens (scoped under .hrd-root) ---- */

.hrd-root {
  /* Spacing scale */
  --hrd-space-xs: 4px;
  --hrd-space-sm: 8px;
  --hrd-space-md: 12px;
  --hrd-space-lg: 16px;
  --hrd-space-xl: 24px;
  --hrd-space-2xl: 32px;

  /* Surface / border / text (reference existing vars with fallbacks) */
  --hrd-surface: var(--card-bg, #FFFFFF);
  --hrd-surface-muted: #F8FAFC;
  --hrd-border: var(--border-color, #E2E8F0);
  --hrd-text-primary: var(--text-main, #1A202C);
  --hrd-text-secondary: var(--text-muted, #718096);
  --hrd-text-inverse: #FFFFFF;

  /* Semantic alert colors */
  --hrd-alert-danger-bg: #FEF2F2;
  --hrd-alert-danger-border: #FCA5A5;
  --hrd-alert-danger-text: #991B1B;
  --hrd-alert-danger-icon: #DC2626;
  --hrd-alert-warning-border: #F59E0B;
  --hrd-alert-warning-text: #92400E;
  --hrd-alert-warning-subtext: #B45309;

  /* Radius */
  --hrd-radius-sm: 6px;
  --hrd-radius-md: 8px;
  --hrd-radius-lg: 12px;
  --hrd-radius-pill: 100px;

  /* Transitions */
  --hrd-transition: 200ms ease;
}


/* ---- 2. Loading Overlay ---- */

.hrd-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
}

.hrd-loading-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.hrd-loading-content {
  text-align: center;
}

.hrd-loading-content .loading-spinner {
  margin: 0 auto 16px;
}

.hrd-loading-text {
  color: var(--hrd-text-secondary);
  font-size: 14px;
}

.hrd-loading-host {
  position: relative;
  min-height: 400px;
}


/* ---- 3. Welcome Card Enhancements ---- */

.hrd-status-row {
  display: flex;
  align-items: center;
  gap: var(--hrd-space-sm);
  margin-top: var(--hrd-space-sm);
}

.hrd-status-label {
  font-size: 13px;
  opacity: 0.8;
}

.hrd-welcome-actions {
  display: flex;
  align-items: center;
  gap: var(--hrd-space-sm);
  flex-wrap: wrap;
}

/* Status dot for "In the Office" */
.hrd-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22C55E;
  display: inline-block;
}

/* Status icon wrapper (active leave) */
.hrd-status-icon {
  display: inline-flex;
  align-items: center;
}


/* ---- 4. Button State Classes ---- */

/* Leave request locked */
.hrd-btn-blocked {
  background: var(--hrd-alert-danger-bg) !important;
  border-color: var(--hrd-alert-danger-border) !important;
  color: var(--hrd-alert-danger-text) !important;
}

/* Welcome card button default */
.hrd-btn-welcome-default {
  background: white;
  color: var(--hrd-text-primary);
}

/* Top bar button default (inherits base .btn styles) */
.hrd-btn-topbar-default {
  background: unset;
  border-color: unset;
  color: unset;
}

/* WFH button */
.hrd-btn-wfh {
  background: var(--tech-cyan, #06B6D4);
  border-color: var(--tech-cyan, #06B6D4);
  color: white;
  margin-left: var(--hrd-space-sm);
}


/* ---- 5. Banner Cards ---- */

/* Full-width banner spanning the grid */
.hrd-banner-card {
  grid-column: 1 / -1;
  border-radius: var(--hrd-radius-lg);
  padding: var(--hrd-space-lg);
}

/* Warning banner (letter signatures, training) */
.hrd-banner-warning {
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border: 2px solid var(--hrd-alert-warning-border);
}

.hrd-banner-warning-header {
  display: flex;
  align-items: center;
  gap: var(--hrd-space-md);
  margin-bottom: var(--hrd-space-lg);
}

.hrd-banner-warning-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.hrd-banner-warning-title {
  font-size: 16px;
  margin: 0;
  color: var(--hrd-alert-warning-text);
}

.hrd-banner-warning-subtitle {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: var(--hrd-alert-warning-subtext);
}

/* Danger banner (documentation required) */
.hrd-banner-danger {
  background: var(--hrd-alert-danger-bg);
  border: 1px solid var(--hrd-alert-danger-border);
  border-radius: var(--hrd-radius-lg);
  padding: var(--hrd-space-lg);
  margin-bottom: 20px;
}

.hrd-banner-danger-header {
  display: flex;
  align-items: flex-start;
  gap: var(--hrd-space-md);
  margin-bottom: var(--hrd-space-md);
}

.hrd-banner-danger-title {
  font-weight: 600;
  color: var(--hrd-alert-danger-icon);
  margin-bottom: 4px;
}

.hrd-banner-danger-body {
  color: var(--hrd-alert-danger-text);
  font-size: 13px;
}

.hrd-banner-danger-list {
  display: flex;
  flex-direction: column;
  gap: var(--hrd-space-md);
}


/* ---- 6. Documentation Items ---- */

.hrd-doc-item {
  background: white;
  border-radius: var(--hrd-radius-md);
  padding: var(--hrd-space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--hrd-space-md);
}

.hrd-doc-item-title {
  font-weight: 500;
  color: #1F2937;
}

.hrd-doc-item-dates {
  font-size: 12px;
  color: #6B7280;
}

.hrd-doc-item-deadline {
  font-size: 12px;
  margin-top: 4px;
  color: var(--hrd-alert-warning-text);
}

.hrd-doc-item-deadline--overdue {
  color: var(--hrd-alert-danger-icon);
  font-weight: 500;
}

.hrd-doc-item-actions {
  display: flex;
  gap: var(--hrd-space-sm);
}


/* ---- 7. Avatar Components ---- */

.hrd-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.hrd-avatar--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.hrd-avatar--birthday {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}

.hrd-avatar--anniversary {
  background: linear-gradient(135deg, #06B6D4 0%, #4FC3CA 100%);
}

.hrd-avatar--off {
  background: linear-gradient(135deg, #94A3B8 0%, #64748B 100%);
}

.hrd-leave-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* ---- 8. Date Labels & Person Items ---- */

.hrd-date-label {
  color: #6B7280;
  font-size: 12px;
}

.hrd-date-badge--today-birthday {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.hrd-date-badge--today-anniversary {
  background: linear-gradient(135deg, #06B6D4 0%, #4FC3CA 100%);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.hrd-person-item {
  padding: 10px 8px 10px 0;
}

.hrd-person-item .info-item-content {
  min-width: 0;
}

.hrd-person-item .info-item-title {
  font-weight: 600;
}

.hrd-person-item .info-item-subtitle {
  color: #6B7280;
  font-size: 12px;
}

.hrd-person-date {
  text-align: right;
  flex-shrink: 0;
  padding-right: 4px;
}


/* ---- 9. Current Leave Highlight ---- */

.hrd-leave-current {
  background: #FEF3C7;
  border-left: 3px solid #F59E0B;
}


/* ---- 10. Skeleton Loading ---- */

@keyframes hrd-shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.hrd-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%;
  animation: hrd-shimmer 1.5s infinite;
  border-radius: var(--hrd-radius-sm);
}

.hrd-skeleton-line {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}

.hrd-skeleton-line--short {
  width: 50%;
}

.hrd-skeleton-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.hrd-skeleton-card {
  padding: var(--hrd-space-xl);
  border-radius: var(--hrd-radius-md);
  min-height: 120px;
}


/* ---- 11. Accessibility & Utilities ---- */

/* Focus ring for keyboard navigation */
.hrd-root :focus-visible {
  outline: 2px solid var(--amt-turquoise, #4FC3CA);
  outline-offset: 2px;
}

/* Screen reader only */
.hrd-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Hide element (replaces style="display:none") */
.hrd-hidden {
  display: none !important;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hrd-skeleton {
    animation: none;
  }
}

/* Upload document success button (used in documentation alert) */
.hrd-btn-success {
  background: #10B981;
  border-color: #10B981;
  color: white;
}

.hrd-btn-success:hover {
  background: #059669;
  border-color: #059669;
}


/* ============================================
   12. Visual Polish — Enhanced Design Layer
   Scoped under .hrd-root to avoid side effects
   ============================================ */

/* ---- 12A. Welcome Card Upgrade ---- */

.hrd-root .welcome-card {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #334155 100%);
  border-radius: var(--hrd-radius-lg);
  padding: 28px 32px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 10px 15px -3px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
}

/* Subtle decorative gradient glow */
.hrd-root .welcome-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(79, 195, 202, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.hrd-root .welcome-avatar {
  width: 56px;
  height: 56px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.hrd-root .welcome-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Pulsing green dot for "In the Office" */
.hrd-status-dot {
  animation: hrd-pulse 2s ease-in-out infinite;
}

@keyframes hrd-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { opacity: 0.85; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

/* Welcome card buttons */
.hrd-root .hrd-welcome-actions .btn {
  border-radius: var(--hrd-radius-md);
  font-weight: 600;
  padding: 10px 20px;
  transition: all var(--hrd-transition);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
}

.hrd-root .hrd-btn-welcome-default {
  background: rgba(255, 255, 255, 0.95);
  color: var(--hrd-text-primary);
  backdrop-filter: blur(8px);
}

.hrd-root .hrd-btn-welcome-default:hover {
  background: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hrd-root .hrd-btn-wfh {
  border-color: rgba(6, 182, 212, 0.3);
}

.hrd-root .hrd-btn-wfh:hover {
  background: #0891B2;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}


/* ---- 12B. Cards — Shadows, Borders, Hover ---- */

.hrd-root .info-card,
.hrd-root .balance-card {
  border: 1px solid var(--hrd-border);
  border-radius: var(--hrd-radius-lg);
  background: var(--hrd-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: box-shadow var(--hrd-transition), transform var(--hrd-transition);
}

.hrd-root .info-card:hover,
.hrd-root .balance-card:hover {
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.06),
    0 10px 15px -3px rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

/* Card headings — refined */
.hrd-root .info-card h3,
.hrd-root .balance-card h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--hrd-text-secondary);
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hrd-border);
}


/* ---- 12C. Info Items — Refined List Items ---- */

.hrd-root .info-item {
  padding: 10px 12px;
  background: var(--hrd-surface-muted);
  border-radius: var(--hrd-radius-md);
  margin-bottom: 6px;
  transition: background var(--hrd-transition);
}

.hrd-root .info-item:hover {
  background: #EFF6FF;
}

.hrd-root .info-item:last-child {
  margin-bottom: 0;
}

.hrd-root .info-item-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--hrd-radius-md);
  border: 1px solid var(--hrd-border);
  background: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.hrd-root .info-item-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--hrd-text-primary);
}

.hrd-root .info-item-subtitle {
  font-size: 12px;
  color: var(--hrd-text-secondary);
  margin-top: 1px;
}

/* Badges — pill shape with softer colors */
.hrd-root .info-item-badge {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--hrd-radius-pill);
  letter-spacing: 0.01em;
}


/* ---- 12D. Balance Card Polish ---- */

.hrd-root .balance-card {
  padding: 24px 28px;
}

.hrd-root .balance-number {
  font-size: 34px;
  font-weight: 800;
  color: var(--tech-green, #10B981);
}

.hrd-root .balance-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--hrd-text-secondary);
}

.hrd-root .balance-row {
  padding: 10px 0;
  font-size: 13.5px;
}

.hrd-root .balance-row.total {
  border-top: 2px solid var(--hrd-border);
  font-weight: 700;
}

.hrd-root .balance-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.hrd-root .balance-value {
  font-weight: 700;
  font-size: 14px;
}

.hrd-root .balance-footer {
  font-size: 12px;
  color: var(--hrd-text-secondary);
  opacity: 0.8;
}


/* ---- 12E. Person Items (Birthdays / Anniversaries) ---- */

.hrd-root .hrd-person-item {
  padding: 10px 12px;
  border-radius: var(--hrd-radius-md);
  transition: background var(--hrd-transition);
}

.hrd-root .hrd-person-item:hover {
  background: #F0FDF4;
}

.hrd-root .hrd-avatar {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 2px solid white;
}

/* Today badges — subtle glow */
.hrd-date-badge--today-birthday {
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.3);
}

.hrd-date-badge--today-anniversary {
  box-shadow: 0 1px 4px rgba(6, 182, 212, 0.3);
}


/* ---- 12F. Empty States — Nicer Visual ---- */

.hrd-root .empty-state {
  padding: 40px 24px;
  color: var(--hrd-text-secondary);
}

.hrd-root .empty-state svg {
  width: 40px;
  height: 40px;
  opacity: 0.3;
  margin-bottom: 12px;
  stroke-width: 1.2;
}

.hrd-root .empty-state div {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
}


/* ---- 12G. Current Leave Highlight — Enhanced ---- */

.hrd-root .hrd-leave-current {
  background: linear-gradient(90deg, #FEF3C7 0%, #FFFBEB 100%);
  border-left: 3px solid #F59E0B;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.08);
}


/* ---- 12H. Banner Polish ---- */

.hrd-root .hrd-banner-warning {
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.12);
}

.hrd-root .hrd-banner-danger {
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.08);
}

.hrd-root .hrd-doc-item {
  border: 1px solid rgba(252, 165, 165, 0.2);
  transition: box-shadow var(--hrd-transition);
}

.hrd-root .hrd-doc-item:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}


/* ---- 12I. Button Polish ---- */

.hrd-root .hrd-btn-blocked {
  border-radius: var(--hrd-radius-md);
  transition: all var(--hrd-transition);
}

.hrd-root .hrd-btn-blocked:hover {
  background: #FEE2E2 !important;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.15);
}

.hrd-root .hrd-btn-success {
  border-radius: var(--hrd-radius-md);
  font-weight: 600;
  transition: all var(--hrd-transition);
}

.hrd-root .hrd-btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(16, 185, 129, 0.25);
}


/* ---- 12J. Dashboard Grid Spacing ---- */

.hrd-root .dashboard-grid {
  gap: 20px;
}


/* ---- 12K. Info List Scrollbar ---- */

.hrd-root .info-list {
  scrollbar-width: thin;
  scrollbar-color: var(--hrd-border) transparent;
}

.hrd-root .info-list::-webkit-scrollbar {
  width: 4px;
}

.hrd-root .info-list::-webkit-scrollbar-track {
  background: transparent;
}

.hrd-root .info-list::-webkit-scrollbar-thumb {
  background: var(--hrd-border);
  border-radius: var(--hrd-radius-pill);
}

.hrd-root .info-list::-webkit-scrollbar-thumb:hover {
  background: #CBD5E1;
}


/* ---- 12L. Reduced Motion — Disable all visual polish transitions ---- */

@media (prefers-reduced-motion: reduce) {
  .hrd-root .info-card,
  .hrd-root .balance-card,
  .hrd-root .info-item,
  .hrd-root .hrd-person-item,
  .hrd-root .hrd-doc-item,
  .hrd-root .hrd-btn-success,
  .hrd-root .hrd-btn-blocked,
  .hrd-root .hrd-welcome-actions .btn {
    transition: none;
  }

  .hrd-root .info-card:hover,
  .hrd-root .balance-card:hover,
  .hrd-root .hrd-btn-welcome-default:hover,
  .hrd-root .hrd-btn-wfh:hover,
  .hrd-root .hrd-btn-success:hover {
    transform: none;
  }

  .hrd-status-dot {
    animation: none;
  }
}


/* ============================================
   13. Inline Style Replacements
   ============================================ */

/* Balance dot colors (replace inline style="background: var(--tech-*)") */
.hrd-dot-remaining { background: var(--tech-green, #5DBB63); }
.hrd-dot-taken { background: var(--tech-blue, #3B82F6); }
.hrd-dot-pending { background: var(--tech-yellow, #F59E0B); }

/* Heading icon alignment (replace inline style on SVGs in card h3) */
.hrd-heading-icon {
  vertical-align: -4px;
  margin-right: 8px;
}


/* ============================================
   14. Mobile Responsive — Dashboard Layout
   ============================================ */

/* ---- 14A. Tablet (≤ 900px) ---- */
@media (max-width: 900px) {
  .hrd-root .dashboard-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

/* ---- 14B. Mobile (≤ 640px) ---- */
@media (max-width: 640px) {
  /* Welcome card — left-aligned, stacked buttons */
  .hrd-root .welcome-card {
    padding: 20px;
    text-align: left;
  }

  .hrd-root .welcome-left {
    flex-direction: row;
  }

  .hrd-root .hrd-welcome-actions {
    width: 100%;
    flex-direction: column;
  }

  .hrd-root .hrd-welcome-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .hrd-root .hrd-btn-wfh {
    margin-left: 0;
  }

  /* Balance card — vertical stack */
  .hrd-root .balance-content {
    flex-direction: column;
    gap: 20px;
  }

  .hrd-root .balance-chart {
    width: 100px;
    height: 100px;
    margin: 0 auto;
  }

  .hrd-root .balance-number {
    font-size: 28px;
  }

  /* Dashboard grid — single column */
  .hrd-root .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* Cards — compact padding, no hover transform */
  .hrd-root .info-card,
  .hrd-root .balance-card {
    padding: 18px;
  }

  .hrd-root .info-card:hover,
  .hrd-root .balance-card:hover {
    transform: none;
  }

  /* Touch-friendly list items (44px min) */
  .hrd-root .info-item {
    min-height: 44px;
    padding: 10px 12px;
  }

  .hrd-root .hrd-person-item {
    min-height: 44px;
  }

  /* Date badges — prevent overflow */
  .hrd-root .hrd-person-date {
    white-space: nowrap;
  }
}

/* ---- 14C. Small mobile (≤ 400px) ---- */
@media (max-width: 400px) {
  .hrd-root .welcome-card {
    padding: 16px;
  }

  .hrd-root .welcome-name {
    font-size: 18px;
  }

  .hrd-root .welcome-avatar {
    width: 44px;
    height: 44px;
  }

  .hrd-root .info-card,
  .hrd-root .balance-card {
    padding: 14px;
    border-radius: var(--hrd-radius-md);
  }
}
