/* ===== CSS Variables =====
   Quest Security brand — black & yellow, matched to questsec-v2
   ("Central Station"): ink surfaces, #ffc400 action yellow, Barlow +
   IBM Plex Mono. Yellow is a fill/indicator color with ink text on it,
   never small text on white. */
:root {
  --ink: #0b0b0c;
  --coal: #141417;
  --steel: #1d1d22;
  --yellow: #ffc400;
  --yellow-deep: #e0a800;
  --yellow-tint: #fff4cc;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f4f5f7;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --green: #10b981;
  --green-light: #d1fae5;
  --red: #ef4444;
  --red-light: #fee2e2;
  --orange: #f59e0b;
  --orange-light: #fef3c7;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-lg: 12px;
  --font: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", Menlo, monospace;
}

/* ===== Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

/* ===== Login Page ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--ink) 0%, var(--coal) 55%, var(--steel) 100%);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border-top: 4px solid var(--yellow);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo-img {
  display: block;
  width: 220px;
  max-width: 100%;
  margin: 0 auto 16px;
}

.login-header h1 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 3px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--font);
  color: var(--gray-800);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--yellow-deep);
  box-shadow: 0 0 0 3px rgba(255, 196, 0, 0.25);
}

.form-group input::placeholder {
  color: var(--gray-400);
}

.error-msg {
  background: var(--red-light);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--yellow);
  color: var(--ink);
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  background: var(--yellow-deep);
  box-shadow: 0 6px 20px rgba(255, 196, 0, 0.35);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== Dashboard Page ===== */
.dashboard-page {
  min-height: 100vh;
  background: var(--gray-100);
}

/* Header */
.header {
  background: var(--ink);
  color: var(--white);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--yellow);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  height: 38px;
  width: auto;
  flex-shrink: 0;
}

.header-left h1 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-user {
  font-size: 14px;
  color: var(--gray-300);
}

.btn-logout {
  background: rgba(255,255,255,0.08);
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.btn-logout:hover {
  color: var(--yellow);
  border-color: var(--yellow);
}

/* Dashboard Grid */
.dashboard-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

.card-error {
  text-align: center;
  padding: 24px;
  color: var(--gray-500);
}

.card-error button {
  margin-top: 12px;
  padding: 6px 16px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
}

.card-loading {
  text-align: center;
  padding: 32px;
  color: var(--gray-400);
}

/* Profile Card */
.profile-info {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--yellow);
  flex-shrink: 0;
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-details h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.profile-details .badge-number {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  background: var(--yellow);
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.profile-field {
  font-size: 14px;
  color: var(--gray-600);
  margin-bottom: 4px;
}

.profile-field strong {
  color: var(--gray-700);
}

/* Documents Card */
.documents-list {
  list-style: none;
}

.document-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}

.document-item:last-child {
  border-bottom: none;
}

.document-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.document-icon {
  width: 36px;
  height: 36px;
  background: var(--yellow-tint);
  color: var(--ink);
  font-family: var(--mono);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
}

.document-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-meta {
  font-size: 12px;
  color: var(--gray-500);
}

.btn-download {
  padding: 4px 12px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 12px;
  font-family: var(--font);
  color: var(--gray-600);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.btn-download:hover {
  background: var(--gray-200);
}

.view-all-btn {
  display: block;
  text-align: center;
  padding: 10px;
  color: var(--gray-700);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-top: 1px solid var(--gray-200);
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  font-family: var(--font);
}

.view-all-btn:hover {
  background: var(--yellow-tint);
  color: var(--ink);
}

/* Time Off Card */
.timeoff-balances {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeoff-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--gray-50);
  border-radius: var(--radius);
}

.timeoff-type {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
}

.timeoff-days {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.timeoff-days span {
  font-size: 12px;
  font-weight: 400;
  color: var(--gray-500);
}

/* Pay Stubs Card */
.payslip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.payslip-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 10px;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.payslip-card:hover {
  background: var(--yellow-tint);
  border-color: var(--yellow-deep);
}

.payslip-icon {
  color: var(--ink);
  margin-bottom: 8px;
}

.payslip-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  word-break: break-word;
  line-height: 1.3;
}

.payslip-date {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

.btn-view {
  padding: 4px 12px;
  background: var(--yellow);
  color: var(--ink);
  border: none;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s;
}

.btn-view:hover {
  background: var(--yellow-deep);
}

/* Guard Portal Button */
.guard-portal-card {
  grid-column: 1 / -1;
}

.guard-portal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  background: var(--ink);
  border-bottom: 3px solid var(--yellow);
  color: var(--yellow);
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
  width: 100%;
}

.guard-portal-btn:hover {
  opacity: 0.9;
}

.guard-portal-btn svg {
  flex-shrink: 0;
}

/* ===== Time Off requests & apply form ===== */
.timeoff-requests {
  margin-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 12px;
}

.timeoff-requests h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
  margin: 0 0 8px;
}

.request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
}

.request-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.request-type {
  font-weight: 600;
  font-size: 0.9rem;
}

.request-dates {
  font-size: 0.8rem;
  opacity: 0.7;
}

.status-chip {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-pending { background: #fef3c7; color: #92400e; }
.status-approved { background: #dcfce7; color: #166534; }
.status-rejected { background: #fee2e2; color: #991b1b; }

.timeoff-note {
  margin-top: 12px;
  font-size: 0.85rem;
  opacity: 0.7;
}

.timeoff-apply { margin-top: 16px; }

.timeoff-apply-btn { width: 100%; }

.timeoff-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.timeoff-form[hidden] { display: none; }

.timeoff-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.timeoff-form select,
.timeoff-form input,
.timeoff-form textarea {
  font: inherit;
  font-weight: 400;
  padding: 8px 10px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius);
}

.timeoff-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.timeoff-form-error {
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.85rem;
  padding: 8px 10px;
  border-radius: var(--radius);
}

.timeoff-form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.timeoff-form-actions .view-all-btn {
  border-top: none;
  width: auto;
  padding: 10px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .header {
    padding: 0 16px;
  }

  .dashboard-content {
    padding: 16px;
  }

  .profile-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .header-user {
    display: none;
  }

  .header-left h1 {
    display: none;
  }

  .header-logo {
    height: 32px;
  }
}

/* ===== Change Password ===== */
.form-intro {
  font-size: 0.9rem;
  color: #64748b;
  margin-bottom: 16px;
  text-align: center;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-overlay[hidden] { display: none; }

.modal-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
}

.modal-card h2 {
  font-size: 1.15rem;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.modal-actions .btn-primary { width: auto; white-space: nowrap; }
