/* Modern Professional Payslip System - Enhanced UI/UX */
:root {
  --primary: #1e88e5;
  --primary-dark: #1565c0;
  --primary-light: #42a5f5;
  --accent: #00acc1;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --border: #e0e6ed;
  --text: #2c3e50;
  --muted: #64748b;
  --success: #10b981;
  --danger: #ef4444;
  --warn: #f59e0b;
  --info: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { 
  box-sizing: border-box; 
  margin: 0;
  padding: 0;
}

body {
  margin: 0; 
  font-family: var(--font-stack); 
  background: var(--bg); 
  color: var(--text); 
  line-height: 1.6; 
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
}

/* Header Styling */
header.site-header { 
  padding: 1.5rem 2rem; 
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  gap: 1.2rem;
  box-shadow: 0 4px 12px rgba(30, 136, 229, 0.2);
}

header.site-header h1 { 
  font-size: 1.75rem; 
  font-weight: 700; 
  margin: 0; 
  letter-spacing: -0.02em;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Main Container */
main { 
  width: 100%; 
  max-width: 1200px; 
  margin: 2.5rem auto 4rem; 
  padding: 0 1.5rem; 
}

/* Card Styling */
.card { 
  background: var(--card-bg); 
  border: 1px solid var(--border); 
  border-radius: var(--radius); 
  box-shadow: var(--shadow); 
  margin-bottom: 2rem;
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-header { 
  padding: 1.25rem 1.5rem; 
  border-bottom: 2px solid var(--border); 
  font-weight: 700; 
  font-size: 1.1rem;
  background: linear-gradient(to right, #f8fafc 0%, #f1f5f9 100%);
  letter-spacing: -0.01em; 
  display: flex; 
  align-items: center; 
  justify-content: space-between;
  color: var(--text);
}

.card-body { 
  padding: 2rem 1.5rem; 
}

/* Grid System */
.grid { 
  display: grid; 
  gap: 1.5rem; 
}

.grid.cols-2 { 
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); 
}

/* Form Styling */
form .form-group { 
  display: flex; 
  flex-direction: column; 
  gap: 0.5rem; 
}

form label { 
  font-size: 0.875rem; 
  font-weight: 600; 
  letter-spacing: 0.02em; 
  color: var(--text);
  margin-bottom: 0.25rem;
}

form input, 
form select { 
  padding: 0.875rem 1rem; 
  border: 2px solid var(--border); 
  border-radius: var(--radius-sm); 
  font-size: 1rem; 
  font-family: var(--font-stack); 
  background: var(--card-bg); 
  transition: var(--transition);
  color: var(--text);
}

form input:hover,
form select:hover {
  border-color: var(--primary-light);
}

form input:focus, 
form select:focus { 
  outline: none; 
  border-color: var(--primary); 
  box-shadow: 0 0 0 4px rgba(30, 136, 229, 0.12);
  background: #fff;
}

form input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

/* Button Styling */
.actions { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 1rem; 
  margin-top: 1rem; 
}

.btn { 
  border: none; 
  cursor: pointer; 
  padding: 0.875rem 1.75rem; 
  font-size: 0.95rem; 
  letter-spacing: 0.02em; 
  font-weight: 600; 
  border-radius: var(--radius-sm); 
  background: var(--primary); 
  color: #fff; 
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
  gap: 0.5rem; 
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(30, 136, 229, 0.25);
  text-decoration: none;
}

.btn:hover { 
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(30, 136, 229, 0.35);
}

.btn:active { 
  transform: translateY(0); 
  box-shadow: 0 1px 4px rgba(30, 136, 229, 0.3);
}

.btn.secondary { 
  background: #6b7280; 
  box-shadow: 0 2px 8px rgba(107, 114, 128, 0.25);
}

.btn.secondary:hover { 
  background: #4b5563;
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.35);
}

.btn.print { 
  background: var(--success);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn.print:hover { 
  background: #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn.danger { 
  background: var(--danger);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn.danger:hover { 
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}
/* Table Styling */
.table { 
  width: 100%; 
  border-collapse: collapse; 
  margin: 0; 
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.table th, 
.table td { 
  padding: 0.875rem 1rem; 
  border: 1px solid var(--border); 
  text-align: left; 
  vertical-align: middle; 
}

.table th { 
  background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%);
  font-weight: 700; 
  letter-spacing: 0.01em;
  color: var(--text);
  text-transform: uppercase;
  font-size: 0.8rem;
}

.table tbody tr { 
  transition: var(--transition);
}

.table tbody tr:nth-child(even) { 
  background: #fafbfc; 
}

.table tbody tr:hover {
  background: #f0f4f8;
}

.table tfoot td { 
  font-weight: 700; 
  background: linear-gradient(to bottom, #eff6ff 0%, #dbeafe 100%);
  font-size: 1rem;
}

/* Highlight Box */
.highlight-box { 
  padding: 2rem 2.5rem; 
  border: 3px solid var(--primary); 
  border-radius: var(--radius); 
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: var(--shadow-lg);
  text-align: center;
  margin: 1.5rem 0;
}

.highlight-box h2 { 
  margin: 0 0 0.75rem; 
  font-size: 1.1rem; 
  letter-spacing: 0.05em; 
  text-transform: uppercase; 
  color: var(--primary-dark);
  font-weight: 700;
}

.highlight-box .amount { 
  font-size: 2.75rem; 
  font-weight: 800; 
  color: var(--success); 
  letter-spacing: -0.02em;
  text-shadow: 0 2px 4px rgba(16, 185, 129, 0.15);
}

/* Utility Classes */
.flex { 
  display: flex; 
}

.flex.wrap { 
  flex-wrap: wrap; 
}

.flex.between { 
  justify-content: space-between; 
}

.badge { 
  display: inline-block; 
  padding: 0.35rem 0.75rem; 
  font-size: 0.75rem; 
  border-radius: 20px; 
  background: var(--primary); 
  color: #fff; 
  letter-spacing: 0.05em; 
  text-transform: uppercase;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(30, 136, 229, 0.2);
}

.note { 
  font-size: 0.875rem; 
  color: var(--muted); 
  margin-top: 1rem;
  padding: 1rem;
  background: #f8fafc;
  border-left: 3px solid var(--info);
  border-radius: var(--radius-sm);
  line-height: 1.6;
}

.footer-text { 
  margin-top: 2.5rem; 
  font-size: 0.8rem; 
  text-align: center; 
  color: var(--muted); 
  letter-spacing: 0.02em;
  padding: 1rem;
  background: #f8fafc;
  border-radius: var(--radius-sm);
}

/* Print Styles */
.print-hidden { }
.print-only { display: none; }

@media print {
  @page { 
    margin: 0.5cm;
    /* Hide date and time in print footer/header */
  }
  
  header.site-header, 
  .no-print, 
  .actions, 
  .card-header button { 
    display: none !important; 
  }
  
  .print-only {
    display: block !important;
  }
  
  body { 
    background: #fff; 
  }
  
  .card { 
    box-shadow: none; 
    border-color: #888; 
    page-break-inside: avoid;
  }
  
  .highlight-box { 
    box-shadow: none;
    page-break-inside: avoid;
  }
  
  .print-hidden { 
    display: none !important; 
  }
  
  .amount { 
    color: #000 !important; 
  }
  
  .btn {
    display: none !important;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  header.site-header { 
    flex-direction: column; 
    align-items: flex-start;
    padding: 1.25rem 1rem;
  }
  
  header.site-header h1 {
    font-size: 1.4rem;
  }
  
  main {
    margin: 1.5rem auto 2rem;
    padding: 0 1rem;
  }
  
  .card-header { 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 0.75rem;
    padding: 1rem;
  }
  
  .card-body {
    padding: 1.5rem 1rem;
  }
  
  .grid.cols-2 {
    grid-template-columns: 1fr;
  }
  
  .highlight-box { 
    padding: 1.5rem 1rem;
  }
  
  .highlight-box .amount { 
    font-size: 2rem; 
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .actions {
    flex-direction: column;
  }
  
  form input,
  form select {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

@media (max-width: 480px) {
  header.site-header h1 {
    font-size: 1.1rem;
  }
  
  .card-header {
    font-size: 1rem;
  }
  
  .highlight-box .amount {
    font-size: 1.75rem;
  }
  
  .table {
    font-size: 0.8rem;
  }
  
  .table th,
  .table td {
    padding: 0.6rem 0.5rem;
  }
}

/* Loading and Transition Effects */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fadeIn 0.4s ease-out;
}

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Selection color */
::selection {
  background: var(--primary-light);
  color: white;
}
