/* ══════════════════════════════════════════════
   HR Dashboard — Operations Module Styles
   (Attendance, Payroll, Performance Reviews)
   ══════════════════════════════════════════════ */

/* ────────────────────────────────────────────
   Toolbar (shared across all ops pages)
   ──────────────────────────────────────────── */

.ops-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.ops-toolbar__left,
.ops-toolbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ────────────────────────────────────────────
   Date Picker (Attendance)
   ──────────────────────────────────────────── */

.ops-date-label,
.ops-filter-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  white-space: nowrap;
}

.ops-date-input {
  padding: 8px 14px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary, #1e293b);
  background: var(--card-bg, #ffffff);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.ops-date-input:focus {
  border-color: var(--sidebar-active, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ────────────────────────────────────────────
   Select / Dropdown Filter
   ──────────────────────────────────────────── */

.ops-select {
  padding: 8px 32px 8px 14px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary, #1e293b);
  background: var(--card-bg, #ffffff) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ops-select:focus {
  border-color: var(--sidebar-active, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ────────────────────────────────────────────
   Buttons
   ──────────────────────────────────────────── */

.ops-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  white-space: nowrap;
}

.ops-btn:active {
  transform: scale(0.97);
}

.ops-btn--primary {
  background: var(--sidebar-active, #3b82f6);
  color: #ffffff;
}

.ops-btn--primary:hover {
  background: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.ops-btn--secondary {
  background: var(--border-color, #e2e8f0);
  color: var(--text-primary, #1e293b);
}

.ops-btn--secondary:hover {
  background: #cbd5e1;
}

/* ────────────────────────────────────────────
   Summary Cards
   ──────────────────────────────────────────── */

.ops-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.ops-summary-cards--three {
  grid-template-columns: repeat(3, 1fr);
}

.ops-summary-card {
  background: var(--card-bg, #ffffff);
  border-radius: 12px;
  padding: 22px 20px 18px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 2px 12px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ops-summary-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
}

.ops-summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

.ops-summary-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  line-height: 1.3;
  margin-bottom: 4px;
}

.ops-summary-card__number {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  margin-left: 4px;
}

.ops-summary-card__label {
  font-size: 0.82rem;
  color: var(--text-secondary, #64748b);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ── Card accent bar colors ── */

.ops-summary-card--green::before  { background: #10b981; }
.ops-summary-card--yellow::before { background: #f59e0b; }
.ops-summary-card--red::before    { background: #ef4444; }
.ops-summary-card--blue::before   { background: #3b82f6; }
.ops-summary-card--purple::before { background: #8b5cf6; }
.ops-summary-card--orange::before { background: #f97316; }
.ops-summary-card--gold::before   { background: #f59e0b; }

/* ── Weekly Reports ── */

.report-review-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 14px;
  background: #10b981;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.report-review-btn:hover {
  background: #059669;
}

.report-file-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #3b82f6;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: default;
}

.report-actions-cell {
  text-align: center;
}

.perf-submitted {
  background: #dbeafe;
  color: #1d4ed8;
}

/* ────────────────────────────────────────────
   Data Tables (shared)
   ──────────────────────────────────────────── */

.ops-table-wrapper {
  background: var(--card-bg, #ffffff);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 2px 12px rgba(0, 0, 0, 0.04);
}

.ops-table {
  width: 100%;
  border-collapse: collapse;
}

.ops-table th,
.ops-table td {
  padding: 13px 18px;
  text-align: left;
  font-size: 0.875rem;
}

.ops-table th {
  background: var(--sidebar-bg, #1e293b);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.ops-table tbody tr:not(:last-child) td {
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.ops-table tbody tr:hover td {
  background: #f8fafc;
}

.ops-table__empty {
  text-align: center;
  padding: 40px 18px !important;
  color: var(--text-secondary, #64748b);
  font-style: italic;
}

/* ── Text alignment helpers ── */

.ops-text-right {
  text-align: right !important;
}

.ops-text-bold {
  font-weight: 700;
}

.ops-mono {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
  font-size: 0.82rem;
  letter-spacing: -0.02em;
}

.ops-text-truncate {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ────────────────────────────────────────────
   Status Badges
   ──────────────────────────────────────────── */

.ops-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Attendance badges */
.attendance-present  { background: #dcfce7; color: #166534; }
.attendance-late     { background: #fef9c3; color: #854d0e; }
.attendance-absent   { background: #fee2e2; color: #991b1b; }
.attendance-onleave  { background: #dbeafe; color: #1e40af; }

/* Payroll badges */
.payroll-processed   { background: #dcfce7; color: #166534; }
.payroll-onhold      { background: #fef9c3; color: #854d0e; }

/* Performance badges */
.perf-completed      { background: #dcfce7; color: #166534; }
.perf-inprogress     { background: #fef9c3; color: #854d0e; }

/* ────────────────────────────────────────────
   Star Rating Display
   ──────────────────────────────────────────── */

.ops-stars {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  vertical-align: middle;
}

.ops-star {
  font-size: 1.15rem;
  line-height: 1;
}

.ops-star--filled {
  color: #f59e0b;
}

.ops-star--empty {
  color: #d1d5db;
}

.ops-rating-number {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  margin-left: 6px;
}

.ops-perf-rating {
  white-space: nowrap;
}

/* ────────────────────────────────────────────
   Expandable Rows (Performance table)
   ──────────────────────────────────────────── */

.ops-table__row--clickable {
  cursor: pointer;
  transition: background 0.15s;
}

.ops-table__row--clickable:hover td {
  background: #f1f5f9 !important;
}

.ops-table__row--expanded td {
  background: #f1f5f9;
}

.ops-table__expand-icon {
  width: 30px;
  text-align: center !important;
  font-size: 0.7rem;
  color: var(--text-secondary, #64748b);
  transition: transform 0.2s;
}

/* Detail row — hidden by default */
.ops-table__detail-row {
  visibility: collapse;
}

.ops-table__detail-row td {
  padding: 0 18px !important;
  border-bottom: none !important;
}

.ops-detail-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  padding: 0;
}

/* Visible state */
.ops-table__detail-row--visible {
  visibility: visible;
}

.ops-table__detail-row--visible td {
  padding: 0 18px !important;
  border-bottom: 1px solid var(--border-color, #e2e8f0) !important;
}

.ops-table__detail-row--visible .ops-detail-content {
  max-height: 300px;
  padding: 16px 0;
}

.ops-detail-section {
  margin-bottom: 12px;
}

.ops-detail-section:last-child {
  margin-bottom: 0;
}

.ops-detail-section strong {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, #64748b);
  margin-bottom: 4px;
}

.ops-detail-section p {
  font-size: 0.875rem;
  color: var(--text-primary, #1e293b);
  line-height: 1.5;
  margin: 0;
}

/* ────────────────────────────────────────────
   Modal (Mark Attendance)
   ──────────────────────────────────────────── */

.ops-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.ops-modal-overlay--visible {
  opacity: 1;
}

.ops-modal {
  background: var(--card-bg, #ffffff);
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  transform: translateY(12px);
  transition: transform 0.25s ease;
}

.ops-modal-overlay--visible .ops-modal {
  transform: translateY(0);
}

.ops-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.ops-modal__header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 0;
}

.ops-modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}

.ops-modal__close:hover {
  color: var(--text-primary, #1e293b);
}

.ops-modal__body {
  padding: 20px 24px;
}

.ops-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-color, #e2e8f0);
}

/* ── Form controls inside modals ── */

.ops-form-group {
  margin-bottom: 16px;
}

.ops-form-group:last-child {
  margin-bottom: 0;
}

.ops-form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.ops-form-row {
  display: flex;
  gap: 14px;
}

.ops-form-group--half {
  flex: 1;
}

.ops-input {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary, #1e293b);
  background: var(--card-bg, #ffffff);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ops-input:focus {
  border-color: var(--sidebar-active, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.ops-input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

/* ────────────────────────────────────────────
   Payroll — Right-aligned monetary columns
   ──────────────────────────────────────────── */

.ops-table--payroll th:nth-child(3),
.ops-table--payroll th:nth-child(4),
.ops-table--payroll th:nth-child(5),
.ops-table--payroll th:nth-child(6) {
  text-align: right;
}

/* ────────────────────────────────────────────
   Responsive
   ──────────────────────────────────────────── */

@media (max-width: 1024px) {
  .ops-summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .ops-summary-cards--three {
    grid-template-columns: repeat(3, 1fr);
  }

  .ops-text-truncate {
    max-width: 120px;
  }
}

@media (max-width: 768px) {
  .ops-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .ops-toolbar__left,
  .ops-toolbar__right {
    width: 100%;
  }

  .ops-toolbar__right {
    justify-content: flex-end;
  }

  .ops-summary-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .ops-summary-cards--three {
    grid-template-columns: 1fr;
  }

  .ops-summary-card {
    padding: 16px 14px 14px;
  }

  .ops-summary-card__value {
    font-size: 1.4rem;
  }

  .ops-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ops-table {
    min-width: 640px;
  }

  .ops-table--payroll {
    min-width: 780px;
  }

  .ops-table--performance {
    min-width: 820px;
  }

  .ops-modal {
    max-width: calc(100vw - 32px);
    margin: 16px;
  }

  .ops-form-row {
    flex-direction: column;
    gap: 0;
  }
}

@media (max-width: 480px) {
  .ops-summary-cards,
  .ops-summary-cards--three {
    grid-template-columns: 1fr;
  }

  .ops-select,
  .ops-date-input {
    width: 100%;
  }

  .ops-toolbar__left,
  .ops-toolbar__right {
    flex-wrap: wrap;
  }

  .ops-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ────────────────────────────────────────────
   Dark Theme Overrides
   ──────────────────────────────────────────── */

.theme-dark .ops-summary-card,
.theme-dark .ops-table-wrapper,
.theme-dark .ops-modal {
  background: #1e293b;
}

.theme-dark .ops-summary-card__value {
  color: #f1f5f9;
}

.theme-dark .ops-table th {
  background: #0f172a;
}

.theme-dark .ops-table tbody tr:hover td {
  background: #334155;
}

.theme-dark .ops-table__row--expanded td,
.theme-dark .ops-table__row--clickable:hover td {
  background: #334155 !important;
}

.theme-dark .ops-table tbody tr:not(:last-child) td {
  border-bottom-color: #334155;
}

.theme-dark .ops-input,
.theme-dark .ops-select,
.theme-dark .ops-date-input {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

.theme-dark .ops-input:focus,
.theme-dark .ops-select:focus,
.theme-dark .ops-date-input:focus {
  border-color: #3b82f6;
}

.theme-dark .ops-detail-section p {
  color: #cbd5e1;
}

.theme-dark .ops-modal__header,
.theme-dark .ops-modal__footer {
  border-color: #334155;
}

.theme-dark .ops-input:disabled {
  background: #334155;
  color: #64748b;
}
