/* Timesheet System - Professional stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary: #2E7D32;
  --primary-hover: #1B5E20;
  --primary-light: #E8F5E9;
  --secondary: #F9A825;
  --secondary-hover: #F57F17;
  --bg: #F0F2F5;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #5f6368;
  --border: #DADCE0;
  --disabled: #9E9E9E;
  --white: #ffffff;
  --error: #C62828;
  --error-bg: #FFEBEE;
  --success: #2E7D32;
  --success-bg: #E8F5E9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; color: var(--primary-hover); }

.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}
.card h1, .card h2 { margin-top: 0; font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.card h2 { font-size: 18px; }

/* ========== Login / Auth pages ========== */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px 24px;
  background: linear-gradient(160deg, var(--primary-light) 0%, var(--bg) 50%);
  overflow-y: auto;
}
.auth-page .auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  border: 1px solid var(--border);
}
.auth-page .auth-brand {
  text-align: center;
  margin-bottom: 28px;
}
.auth-page .auth-brand h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px 0;
  letter-spacing: -0.03em;
}
.auth-page .auth-brand .auth-tagline {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  font-weight: 400;
}
.auth-page .auth-card .alert { margin-bottom: 20px; }
.auth-page .form-group { margin-bottom: 20px; }
.auth-page .form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.auth-page .form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-page .form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}
.auth-page .form-group input::placeholder { color: var(--text-muted); }
.auth-page .form-actions { margin-top: 28px; }
.auth-page .form-actions .btn {
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius);
  transition: background 0.2s, transform 0.05s;
}
.auth-page .form-actions .btn:active { transform: scale(0.99); }
.auth-page .form-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}
.auth-page .form-footer a { font-weight: 600; }

/* Register page */
.auth-page .auth-card.register-wrap { max-width: 520px; }
.auth-page .auth-card.register-wrap .auth-brand { margin-bottom: 24px; }
.auth-page .auth-card .form-group { margin-bottom: 18px; }

/* ========== Forms (global) ========== */
form label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; color: var(--text); }
form input[type="text"], form input[type="password"], form input[type="email"], form select, form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  margin-bottom: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
form input:focus, form select:focus, form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}
form input.error, form textarea.error { border-color: var(--error); }
form .error-msg { color: var(--error); font-size: 13px; margin-top: -10px; margin-bottom: 10px; }
form .success-msg { color: var(--success); font-size: 13px; margin-bottom: 10px; }

.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s, color 0.2s;
}
.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover { background: var(--primary-hover); color: var(--white); }
.btn-secondary {
  background: var(--secondary);
  color: var(--text);
}
.btn-secondary:hover { background: var(--secondary-hover); color: var(--text); }
.btn-success {
  background: var(--success);
  color: var(--white);
}
.btn-success:hover { background: var(--primary-hover); color: var(--white); }
.btn:disabled { background: var(--disabled); cursor: not-allowed; color: #666; }

/* Alerts */
.alert { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; font-size: 14px; }
.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid #EF9A9A; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #A5D6A7; }
.alert-info { background: #E3F2FD; color: #1565C0; border: 1px solid #90CAF9; }

/* ========== Navigation ========== */
.nav-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  margin-bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}
.nav-bar a {
  margin-right: 4px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.nav-bar a:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.nav-bar .user-info {
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-bar .user-info a { padding: 6px 10px; }

/* ========== Tables ========== */
table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 600; font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover { background: #fafafa; }
tr:last-child td { border-bottom: none; }

/* ========== Timesheet calendar ========== */
.timesheet-cal {
  overflow-x: auto;
  margin-top: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.timesheet-cal .timesheet-table {
  table-layout: fixed;
  min-width: 720px;
  width: 100%;
  border-collapse: collapse;
}
/* Name column: wide, left-aligned, wraps, sticky on scroll */
.timesheet-cal .col-name {
  width: 180px;
  min-width: 180px;
  max-width: 220px;
  text-align: left !important;
  padding: 14px 16px !important;
  vertical-align: middle;
  white-space: normal;
  word-wrap: break-word;
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--bg);
  border-right: 2px solid var(--border);
  font-size: 13px;
}
.timesheet-cal thead .col-name { font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.timesheet-cal .cell-name { background: var(--white) !important; }
.timesheet-cal .row-current-user .cell-name { background: #FFF8E1 !important; }
/* Title column: sticky, wraps */
.timesheet-cal .col-title {
  width: 140px;
  min-width: 140px;
  max-width: 160px;
  text-align: left !important;
  padding: 14px 16px !important;
  vertical-align: middle;
  white-space: normal;
  word-wrap: break-word;
  position: sticky;
  left: 180px;
  z-index: 2;
  background: var(--bg);
  border-right: 2px solid var(--border);
  font-size: 13px;
}
.timesheet-cal thead .col-title { font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.timesheet-cal .cell-title { background: var(--white) !important; }
.timesheet-cal .row-current-user .cell-title { background: #FFF8E1 !important; }
/* Day columns: centered, consistent width */
.timesheet-cal .col-day {
  width: 44px;
  min-width: 44px;
  text-align: center !important;
  padding: 10px 6px !important;
  vertical-align: middle;
  font-size: 13px;
}
.timesheet-cal th.col-day { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.timesheet-cal .cell-past { background: var(--white); color: var(--text); }
.timesheet-cal .cell-today { background: var(--primary-light); font-weight: 600; }
.timesheet-cal .cell-future { background: #EEEEEE; color: var(--disabled); }
.timesheet-cal .cell-edited { position: relative; }
.timesheet-cal .status-d { color: #1565C0; font-weight: 600; }
.timesheet-cal .status-n { color: #5c6bc0; font-weight: 600; }
.timesheet-cal .status-o { color: #e65100; font-weight: 600; }
.timesheet-cal .row-current-user td.col-day { background: #FFF8E1 !important; }
.timesheet-cal .btn-cell {
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  font-weight: 500;
  transition: background 0.2s;
  min-width: 36px;
}
.timesheet-cal .btn-cell:hover:not(:disabled) { background: var(--secondary); border-color: var(--secondary); color: var(--text); }
.timesheet-cal .btn-cell:disabled { cursor: not-allowed; opacity: 0.7; }

.timesheet-scroll-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0 0 0;
}
@media (min-width: 769px) {
  .timesheet-scroll-hint { display: none; }
}

/* ========== Unified timesheet table (auditor-style) ========== */
.timesheet-cal thead th,
.timesheet-table-wrap thead th {
  background: #4CAF50 !important;
  color: white !important;
  border: 1px solid #ddd;
  padding: 8px;
  text-align: center;
  font-weight: bold;
  font-size: 13px;
}
.timesheet-cal thead .col-name,
.timesheet-cal thead .col-title { text-align: left !important; }
.timesheet-cal td.col-day,
.timesheet-table-wrap td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: center;
  vertical-align: middle;
}
.timesheet-cal td.col-day,
.timesheet-table-wrap td.col-day {
  text-align: center !important;
}
.timesheet-cal td.col-day .btn-cell,
.timesheet-table-wrap td.col-day a {
  display: inline-block;
  text-align: center;
}
.timesheet-cal .col-name.cell-name,
.timesheet-cal .col-title.cell-title,
.timesheet-table-wrap .employee-name {
  text-align: left !important;
  font-weight: bold;
  white-space: nowrap;
}
.timesheet-cal .status-d, .timesheet-cal .status-D,
.timesheet-cal .status-n, .timesheet-cal .status-N,
.timesheet-cal .status-o, .timesheet-cal .status-O,
.timesheet-table-wrap .status-D, .timesheet-table-wrap .status-N, .timesheet-table-wrap .status-O {
  display: inline-block;
  min-width: 1.2em;
  font-weight: 600;
}
.timesheet-cal .status-d, .timesheet-cal .status-D,
.timesheet-table-wrap .status-D { background: #e8f5e9; color: #2e7d32; }
.timesheet-cal .status-n, .timesheet-cal .status-N,
.timesheet-table-wrap .status-N { background: #e3f2fd; color: #1565c0; }
.timesheet-cal .status-o, .timesheet-cal .status-O,
.timesheet-table-wrap .status-O { background: #fff3e0; color: #e65100; }
.timesheet-table-wrap { display: block; width: 100%; overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; padding: 0; margin: 0; }
.timesheet-table-wrap table { min-width: 1100px; border-collapse: collapse; width: auto; }
.timesheet-table-wrap .view-details-btn { padding: 5px 10px; background: #2196F3; color: white; border-radius: 3px; text-decoration: none; font-size: 13px; }
.timesheet-legend { margin-top: 20px; padding: 15px; background: #f5f5f5; border-radius: 5px; }
.timesheet-legend h4 { margin: 0 0 8px 0; font-size: 14px; }
.timesheet-legend span { padding: 5px 10px; margin-right: 10px; display: inline-block; margin-top: 4px; border-radius: 3px; }

/* ========== Modal ========== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal { background: var(--white); border-radius: var(--radius-lg); max-width: 480px; width: 100%; padding: 28px; box-shadow: var(--shadow-lg); }
.modal h3 { margin-top: 0; font-size: 18px; font-weight: 600; }
.modal-actions { margin-top: 24px; display: flex; gap: 12px; justify-content: flex-end; }

/* ========== Pagination ========== */
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
.pagination a:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination .current { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ========== Filters ========== */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 24px; }
.filters label { margin-right: 4px; font-weight: 500; font-size: 14px; }
.filters input, .filters select { padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border); font-size: 14px; }

/* ========== Page headings ========== */
.page-header { margin-bottom: 24px; }
.page-header h1 { margin: 0 0 8px 0; font-size: 24px; font-weight: 700; }
.page-header p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* ========== Dashboard cards (admin) ========== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.dashboard-grid .card {
  padding: 24px;
  text-align: left;
  transition: box-shadow 0.2s;
}
.dashboard-grid .card:hover { box-shadow: var(--shadow-lg); }
.dashboard-grid .card h2 { font-size: 14px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.dashboard-grid .card .stat { font-size: 28px; font-weight: 700; color: var(--primary); margin-bottom: 12px; }
.dashboard-grid .card a { font-weight: 600; font-size: 14px; }

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .container { max-width: 100%; padding: 20px; }
  .card { padding: 24px; }
}

@media (max-width: 768px) {
  .container { padding: 16px; }
  .card { padding: 20px; }
  .auth-page .auth-card { padding: 28px; }
  .page-header h1 { font-size: 20px; }
  .timesheet-cal { margin-left: -4px; margin-right: -4px; border-radius: 0; }
  .timesheet-cal .col-name { width: 150px; min-width: 150px; padding: 12px 14px !important; font-size: 13px; }
  .timesheet-cal .col-title { width: 120px; min-width: 120px; left: 150px; padding: 12px 14px !important; font-size: 12px; }
  .timesheet-cal .col-day { width: 40px; min-width: 40px; padding: 8px 4px !important; font-size: 12px; }
  .timesheet-cal .btn-cell { padding: 6px 8px; font-size: 11px; min-width: 32px; }
  .nav-bar { flex-direction: row; flex-wrap: wrap; padding: 12px 16px; gap: 8px; }
  .nav-bar a { margin-right: 0; }
  .nav-bar .user-info { font-size: 13px; flex-wrap: wrap; }
}

@media (max-width: 480px) {
  body { font-size: 14px; }
  .container { padding: 12px; }
  .card { padding: 16px; }
  .page-header h1 { font-size: 18px; }
  .timesheet-cal .col-name { width: 130px; min-width: 130px; padding: 10px 12px !important; }
  .timesheet-cal .col-title { width: 100px; min-width: 100px; left: 130px; padding: 10px 12px !important; font-size: 11px; }
  .timesheet-cal .col-day { width: 36px; min-width: 36px; padding: 6px 2px !important; font-size: 11px; }
  .nav-bar .user-info { max-width: 100%; }
}
