/* ============================================================
   BASE.CSS — Clovr Media HR System
   CSS custom properties, reset, typography, utilities
   Loaded on every page — keep lean and purposeful
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES
   Single source of truth for all design tokens.
   Every color, size, shadow references these variables.
   ============================================================ */
:root {

  /* --- Brand Colors --- */
  --clr-brand-dark:     #0d0d0d;       /* Sidebar, deep backgrounds */
  --clr-brand-mid:      #1a1a1a;       /* Secondary dark surfaces */
  --clr-brand-accent:   #ff214f;       /* Red accent — primary CTA color */
  --clr-brand-accent-h: #e01040;       /* Accent hover state */
  --clr-brand-accent-l: #ffe0e7;       /* Accent light — backgrounds, tints */

  /* --- Semantic Status Colors --- */
  --clr-success:        #2d9e6b;       /* Present, approved, active */
  --clr-success-bg:     #edf7f2;
  --clr-success-border: #a8dfc3;

  --clr-warning:        #d97706;       /* Late, pending, caution */
  --clr-warning-bg:     #fffbeb;
  --clr-warning-border: #fcd34d;

  --clr-danger:         #dc2626;       /* Absent, rejected, error */
  --clr-danger-bg:      #fef2f2;
  --clr-danger-border:  #fca5a5;

  --clr-info:           #2563eb;       /* Half-day, info, neutral action */
  --clr-info-bg:        #eff6ff;
  --clr-info-border:    #93c5fd;

  --clr-neutral:        #6b7280;       /* Muted, secondary, disabled */
  --clr-neutral-bg:     #f3f4f6;
  --clr-neutral-border: #d1d5db;

  /* --- Surface Colors --- */
  --clr-bg:             #f7f6f3;       /* Page background — warm off-white */
  --clr-surface:        #ffffff;       /* Cards, panels */
  --clr-surface-2:      #faf9f7;       /* Slightly tinted surface */
  --clr-border:         #e8e6e1;       /* Borders — warm, not cold grey */
  --clr-border-strong:  #d0cdc7;       /* Stronger borders */

  /* --- Text Colors --- */
  --clr-text-primary:   #1a1a1a;       /* Main body text */
  --clr-text-secondary: #4b5563;       /* Secondary / supporting text */
  --clr-text-muted:     #9ca3af;       /* Placeholders, hints, timestamps */
  --clr-text-inverse:   #ffffff;       /* Text on dark backgrounds */
  --clr-text-accent:    #ff214f;       /* Accent-colored text */

  /* --- Typography --- */
  --font-sans:    'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;

  --text-xs:    0.6875rem;   /* 11px */
  --text-sm:    0.8125rem;   /* 13px */
  --text-base:  0.9375rem;   /* 15px */
  --text-md:    1rem;        /* 16px */
  --text-lg:    1.125rem;    /* 18px */
  --text-xl:    1.375rem;    /* 22px */
  --text-2xl:   1.75rem;     /* 28px */
  --text-3xl:   2.25rem;     /* 36px */

  --weight-light:   300;
  --weight-regular: 400;
  --weight-medium:  500;
  --weight-semibold:600;
  --weight-bold:    700;

  --leading-tight:  1.25;
  --leading-snug:   1.375;
  --leading-normal: 1.5;
  --leading-relaxed:1.625;

  /* --- Spacing Scale --- */
  --space-1:   0.25rem;   /*  4px */
  --space-2:   0.5rem;    /*  8px */
  --space-3:   0.75rem;   /* 12px */
  --space-4:   1rem;      /* 16px */
  --space-5:   1.25rem;   /* 20px */
  --space-6:   1.5rem;    /* 24px */
  --space-8:   2rem;      /* 32px */
  --space-10:  2.5rem;    /* 40px */
  --space-12:  3rem;      /* 48px */
  --space-16:  4rem;      /* 64px */

  /* --- Border Radius --- */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-2xl: 24px;
  --radius-full:9999px;

  /* --- Shadows --- */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-xl:  0 20px 48px rgba(0,0,0,0.12), 0 8px 16px rgba(0,0,0,0.08);
  --shadow-accent: 0 4px 16px rgba(200,169,110,0.25);

  /* --- Layout --- */
  --sidebar-width:        260px;
  --sidebar-collapsed:    70px;
  --header-height:        64px;
  --content-max-width:    1600px;

  /* --- Transitions --- */
  --transition-fast:   150ms ease;
  --transition-base:   200ms ease;
  --transition-slow:   300ms ease;
  --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* --- Z-index Scale --- */
  --z-base:     1;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  300;
  --z-modal:    400;
  --z-toast:    500;
}

/* ============================================================
   RESET & BASE
   Modern reset — consistent across all browsers
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--clr-text-primary);
  background-color: var(--clr-bg);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

input, button, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--clr-text-primary);
}

p {
  line-height: var(--leading-relaxed);
}

hr {
  border: none;
  border-top: 1px solid var(--clr-border);
  margin: var(--space-6) 0;
}

/* ============================================================
   TYPOGRAPHY SCALE
   ============================================================ */
.text-xs      { font-size: var(--text-xs); }
.text-sm      { font-size: var(--text-sm); }
.text-base    { font-size: var(--text-base); }
.text-md      { font-size: var(--text-md); }
.text-lg      { font-size: var(--text-lg); }
.text-xl      { font-size: var(--text-xl); }
.text-2xl     { font-size: var(--text-2xl); }
.text-3xl     { font-size: var(--text-3xl); }

.font-light   { font-weight: var(--weight-light); }
.font-regular { font-weight: var(--weight-regular); }
.font-medium  { font-weight: var(--weight-medium); }
.font-semibold{ font-weight: var(--weight-semibold); }
.font-bold    { font-weight: var(--weight-bold); }

.font-mono    { font-family: var(--font-mono); }

.text-primary   { color: var(--clr-text-primary); }
.text-secondary { color: var(--clr-text-secondary); }
.text-muted     { color: var(--clr-text-muted); }
.text-accent    { color: var(--clr-brand-accent); }
.text-success   { color: var(--clr-success); }
.text-warning   { color: var(--clr-warning); }
.text-danger    { color: var(--clr-danger); }
.text-info      { color: var(--clr-info); }

.text-left    { text-align: left; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }

.uppercase    { text-transform: uppercase; }
.lowercase    { text-transform: lowercase; }
.capitalize   { text-transform: capitalize; }

.tracking-wide  { letter-spacing: 0.05em; }
.tracking-wider { letter-spacing: 0.1em; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   SPACING UTILITIES
   ============================================================ */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-4  { padding: var(--space-4); }
.p-6  { padding: var(--space-6); }
.p-8  { padding: var(--space-8); }
.p-10 { padding: var(--space-10); }

/* ============================================================
   DISPLAY & LAYOUT UTILITIES
   ============================================================ */
.d-flex        { display: flex; }
.d-grid        { display: grid; }
.d-block       { display: block; }
.d-inline      { display: inline; }
.d-inline-flex { display: inline-flex; }
.d-none        { display: none; }

.flex-col      { flex-direction: column; }
.flex-row      { flex-direction: row; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.items-start   { align-items: flex-start; }
.items-center  { align-items: center; }
.items-end     { align-items: flex-end; }

.justify-start   { justify-content: flex-start; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.w-full  { width: 100%; }
.h-full  { height: 100%; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }

.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* ============================================================
   SCROLLBAR STYLING
   Thin, on-brand scrollbar throughout the system
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--clr-border-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--clr-text-muted);
}

/* Sidebar gets a darker scrollbar */
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}

/* ============================================================
   FOCUS STYLES
   Accessible focus rings using accent color
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--clr-brand-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   SELECTION COLOR
   ============================================================ */
::selection {
  background-color: var(--clr-brand-accent-l);
  color: var(--clr-text-primary);
}

/* ============================================================
   ANIMATION KEYFRAMES
   Reusable animations referenced across all module CSS files
   ============================================================ */

/* Fade in from bottom — used for cards, modals entering */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in — used for overlays, dropdowns */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Scale in — used for modals, toasts */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide in from right — used for notification panel */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide in from top — used for header alerts */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Pulse — used for unread notification badge */
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.15); opacity: 0.85; }
}

/* Spin — used for loading indicators */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Shimmer — used for skeleton loading states */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* Blink — used for live clock colon */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ============================================================
   SKELETON LOADING
   Used while data is being fetched
   ============================================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--clr-neutral-bg) 25%,
    var(--clr-border) 50%,
    var(--clr-neutral-bg) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  color: transparent;
  pointer-events: none;
  user-select: none;
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-sm);
}

.skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: var(--space-3);
}

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

.visible   { visibility: visible; }
.invisible { visibility: hidden; }

/* ============================================================
   PRINT STYLES
   Clean output for payslips printed from admin
   ============================================================ */
@media print {
  .sidebar,
  .top-header,
  .no-print {
    display: none !important;
  }

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

  body {
    background: white;
    font-size: 12px;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}