/* Guardian Mesh Employee Portal — Styles
   Extends guardian-mesh.css design tokens
*/

/* ===== LOGIN SCREEN ===== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-screen[hidden] {
  display: none;
}

.login-container {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px 32px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo svg {
  margin-bottom: 12px;
}

.login-logo h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

.login-logo .muted {
  margin: 0;
}

.login-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.login-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #86efac;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

#login-form .field,
#forgot-form .field,
#change-password-form .field {
  margin-bottom: 16px;
}

#login-form label,
#forgot-form label,
#change-password-form label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.login-btn {
  width: 100%;
  margin-top: 4px;
  font-size: 15px;
  padding: 12px;
}

.forgot-link {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--accent);
}

.forgot-link:hover {
  text-decoration: underline;
}

/* ===== APP SHELL ===== */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== HEADER ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}

.sidebar-toggle:hover {
  color: var(--text);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.logo-sub {
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}

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

.header-employee-name {
  font-size: 14px;
  color: var(--muted);
}

.logout-btn {
  font-size: 13px;
  padding: 6px 14px;
}

/* ===== BODY LAYOUT ===== */
.app-body {
  display: flex;
  flex: 1;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: #0e1120;
  border-right: 1px solid var(--line);
  padding: 12px 0;
  overflow-y: auto;
  height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav li {
  margin: 2px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: rgba(0, 212, 255, 0.06);
  color: var(--text);
}

.nav-item.active {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent);
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg {
  opacity: 1;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
  min-width: 0;
}

.content-section h2 {
  font-size: 22px;
  margin-bottom: 20px;
}

/* ===== WELCOME BANNER ===== */
.welcome-banner {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.08) 0%, rgba(0, 212, 255, 0.02) 100%);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.welcome-banner h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.welcome-banner .muted {
  margin: 0;
}

/* ===== CARDS ===== */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.card h3 {
  margin: 0 0 14px;
  font-size: 16px;
}

.card h4 {
  margin: 16px 0 10px;
  font-size: 14px;
  color: var(--muted);
}

/* ===== BALANCE CARDS (color-coded) ===== */
.balance-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  background: #0b1220;
}

.balance-card .balance-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.balance-card .balance-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.balance-card .balance-unit {
  font-size: 13px;
  color: var(--muted);
  margin-left: 4px;
}

.balance-card.vacation {
  border-left: 3px solid #22c55e;
}

.balance-card.vacation .balance-value {
  color: #22c55e;
}

.balance-card.sick {
  border-left: 3px solid #f59e0b;
}

.balance-card.sick .balance-value {
  color: #f59e0b;
}

.balance-card.personal {
  border-left: 3px solid #a78bfa;
}

.balance-card.personal .balance-value {
  color: #a78bfa;
}

.balance-card.pending {
  border-left: 3px solid var(--accent);
}

.balance-card.pending .balance-value {
  color: var(--accent);
}

/* ===== TABLES ===== */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  white-space: nowrap;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

tbody tr:hover {
  background: rgba(0, 212, 255, 0.04);
}

tbody tr.clickable {
  cursor: pointer;
}

tbody tr.clickable:hover {
  background: rgba(0, 212, 255, 0.08);
}

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-approved {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-denied {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-cancelled {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-paid {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-processing {
  background: rgba(0, 212, 255, 0.15);
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, 0.3);
}

/* ===== FORMS ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

.form-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.form-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #86efac;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-grid .field {
  margin-bottom: 0;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #0f1320;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239ea6c5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

label {
  font-size: 13px;
  color: var(--muted);
}

/* ===== BUTTONS ===== */
.cta {
  border: 1px solid var(--accent);
  color: #001a24;
  background: var(--accent);
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: opacity 0.2s;
}

.cta:hover { opacity: 0.9; }
.cta:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cta-secondary {
  border: 1px solid var(--line);
  color: #d6e4ff;
  background: #0f1320;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s;
}

.cta-secondary:hover { border-color: var(--accent); }
.cta-secondary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-danger {
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
}

.btn-danger:hover {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.2);
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.pagination button {
  border: 1px solid var(--line);
  background: #0f1320;
  color: var(--muted);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s, color 0.15s;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination button.active {
  background: var(--accent);
  color: #001a24;
  border-color: var(--accent);
  font-weight: 700;
}

.pagination .page-info {
  font-size: 13px;
  color: var(--muted);
}

/* ===== SCHEDULE NAV ===== */
.schedule-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.schedule-week-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.schedule-nav .cta-secondary {
  padding: 8px 14px;
  font-size: 13px;
}

/* Schedule table weekend rows */
tbody tr.weekend {
  background: rgba(148, 163, 184, 0.04);
}

tbody tr.today {
  background: rgba(0, 212, 255, 0.06);
}

tbody tr.day-off td {
  color: var(--muted);
  font-style: italic;
}

/* ===== DIRECTORY SEARCH ===== */
.directory-search {
  margin-bottom: 14px;
}

.directory-search .field {
  margin-bottom: 0;
}

/* ===== ANNOUNCEMENTS LIST ===== */
.announcement-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 12px;
}

.announcement-card .announcement-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
}

.announcement-card .announcement-content {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 10px;
}

.announcement-card .announcement-meta {
  font-size: 12px;
  color: var(--muted);
  opacity: 0.7;
}

.announcement-card .announcement-meta span {
  margin-right: 16px;
}

/* ===== PROFILE INFO ===== */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.profile-field {
  padding: 10px 0;
}

.profile-field .pf-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.profile-field .pf-value {
  font-size: 14px;
  color: var(--text);
}

.profile-field .pf-value.masked {
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 2px;
}

/* Emergency contacts list */
.ec-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #0b1220;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
}

.ec-item .ec-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ec-item .ec-name {
  font-weight: 600;
  font-size: 14px;
}

.ec-item .ec-detail {
  font-size: 12px;
  color: var(--muted);
}

/* ===== PAY INFO ===== */
.pay-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pay-info-item {
  padding: 8px 0;
}

.pay-info-item .pi-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}

.pay-info-item .pi-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.pay-info-item .pi-value.accent {
  color: var(--accent);
}

/* Pay stub detail */
.paystub-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.paystub-section {
  margin-bottom: 16px;
}

.paystub-section h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.paystub-line {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}

.paystub-line .pl-label {
  color: var(--muted);
}

.paystub-line .pl-value {
  color: var(--text);
  font-weight: 500;
}

.paystub-line.total {
  border-top: 2px solid var(--line);
  margin-top: 6px;
  padding-top: 8px;
  font-weight: 700;
}

.paystub-line.total .pl-value {
  color: #22c55e;
}

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

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

.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-sm {
  max-width: 420px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 14px;
  color: var(--text);
  min-width: 280px;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  animation: toastIn 0.25s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.toast-out {
  animation: toastOut 0.2s ease-in forwards;
}

.toast-success {
  border-left: 3px solid #22c55e;
}

.toast-error {
  border-left: 3px solid #ef4444;
}

.toast-info {
  border-left: 3px solid var(--accent);
}

.toast-icon {
  flex-shrink: 0;
  font-size: 16px;
}

.toast-success .toast-icon { color: #22c55e; }
.toast-error .toast-icon { color: #ef4444; }
.toast-info .toast-icon { color: var(--accent); }

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* ===== LOADING ===== */
.loading-placeholder {
  color: var(--muted);
  font-size: 14px;
  padding: 16px;
  text-align: center;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
}

.empty-state p {
  margin: 0;
  font-size: 14px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar-toggle {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: -260px;
    top: 56px;
    bottom: 0;
    z-index: 150;
    transition: left 0.25s ease;
    box-shadow: none;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    top: 56px;
    background: rgba(0, 0, 0, 0.4);
    z-index: 140;
  }

  .main-content {
    padding: 20px 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .pay-info-grid {
    grid-template-columns: 1fr;
  }

  .paystub-detail-grid {
    grid-template-columns: 1fr;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .schedule-nav {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
  }

  .schedule-week-label {
    order: -1;
    width: 100%;
    text-align: center;
  }

  .header-employee-name {
    display: none;
  }
}

@media (max-width: 500px) {
  .stats {
    grid-template-columns: 1fr;
  }

  .login-container {
    padding: 28px 20px;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast.toast-out {
    animation: none;
  }

  .sidebar {
    transition: none;
  }

  .spinner {
    animation-duration: 1.5s;
  }
}
