/* multi_view_main.css - Multi-View Attendance Management System Styling */

#top-bar {
  background-color: #0D882C;
  color: white;
  display: table;
  width: 100%;
  border-spacing: 0;
}

#top-bar button {
  background-color: #0D882C;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

#top-bar button:hover {
  background-color: #0b6f23;
}

/* Active view button styling */
#top-bar button.active {
  background-color: #065319;
  font-weight: bold;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

#top-bar-row {
  display: table-row;
}

#top-bar-left,
#top-bar-right {
  display: table-cell;
  vertical-align: top;
  padding: 0;
}

#top-bar-left {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 5px;
}

#command-buttons,
#app-status,
#app-current-oucare-id,
#app-current-emp-name,
#employee-commands {
  padding: 5px 10px;
}

#command-buttons {
  display: flex;
  gap: 10px;
}

#employee-commands {
  display: flex;
  gap: 10px;
}

/* Button highlighting styles */
/* Pending review notification styling for attendance request button */
#btn-att-request.pending-review {
  background-color: #ff8c00 !important; /* Orange background */
  color: white !important;
  box-shadow: 0 0 8px rgba(255, 140, 0, 0.6) !important;
  font-weight: bold !important;
  position: relative;
}

/* Optional: Add a subtle pulse animation for more visibility */
#btn-att-request.pending-review {
  animation: subtle-pulse 2s infinite;
}

@keyframes subtle-pulse {
  0% { box-shadow: 0 0 8px rgba(255, 140, 0, 0.6); }
  50% { box-shadow: 0 0 12px rgba(255, 140, 0, 0.8); }
  100% { box-shadow: 0 0 8px rgba(255, 140, 0, 0.6); }
}

/* Ensure active state overrides pending-review when on request view */
#btn-att-request.active {
  background-color: #065319 !important;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2) !important;
  animation: none !important; /* Remove pulse when active */
}


/* System update button - hidden by default, shown when version mismatch detected */
#btn-system-update {
  display: none;
}

#btn-system-update.update-available {
  display: inline-block;
  background-color: #fd7e14 !important;  /* Orange - matches notification severity */
  color: white !important;
  font-weight: bold !important;
  box-shadow: 0 0 8px rgba(253, 126, 20, 0.6) !important;
  animation: update-pulse 2s infinite;
}

@keyframes update-pulse {
  0%   { box-shadow: 0 0 8px  rgba(253, 126, 20, 0.6); }
  50%  { box-shadow: 0 0 14px rgba(253, 126, 20, 0.9); }
  100% { box-shadow: 0 0 8px  rgba(253, 126, 20, 0.6); }
}

#app-status {
  background-color: #0D882C;
  color: white;
  font-weight: bold;
  margin-top: -10px;
  margin-left: 15px;
}

#app-current-oucare-id,
#app-current-emp-name {
  background-color: #0D882C;
  color: white;
  font-weight: bold;
  margin-top: -10px;
  margin-left: 15px;
}

h1.logo {
  font-size: 1.5rem;
  line-height: 48px;
  padding: 0;
  margin: 0;
  text-align: right;
  height: 48px;
}

h1.logo a {
  background-repeat: no-repeat;
  background-image: url("https://idtoucare.staging.oucare.com/image/oucare-logo.svg");
  background-size: contain;
  background-position: right center;
  padding-right: 50px;
  display: inline-block;
  height: 64px;
  width: 200px;
  text-indent: -100000px;
}

body {
  /* Single CJK-safe stack used by every view (Request / Monthly / Daily).
     Order: native OS font, then zh-TW first (JhengHei/PingFang TC),
     zh-CN fallback (YaHei/PingFang SC), Latin fallback (Arial). */
  font-family: system-ui, "Microsoft JhengHei", "PingFang TC",
               "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f8f9fa;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#main-content {
  display: flex;
  flex-grow: 1;
  overflow: hidden;
  min-height: 0;
}

#employee-list,
#month-days-list {
  width: 15%;
  min-width: 200px;
  overflow-y: hidden;
  overflow-x: auto;
  background-color: #ffffff;
  border-right: 1px solid #dee2e6;
  padding: 10px;
  box-sizing: border-box;
  height: 98%;
  min-height: 0;
}

#employee-list > table {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: var(--fit-table-width, max-content);
  min-width: 0;
  border-collapse: collapse;
  overflow: clip;
}

#employee-list thead {
  display: table;
  flex: 0 0 auto;
  width: var(--fit-table-width, 100%);
  table-layout: fixed;
}

#employee-list tbody {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: clip;
}

#employee-list tbody tr {
  display: table;
  width: var(--fit-table-width, 100%);
  table-layout: fixed;
}

#month-days-list {
  flex-direction: column;
  overflow-x: scroll;
}

#employee-list th:nth-child(1),
#employee-list td:nth-child(1),
#month-days-list th:nth-child(1),
#month-days-list td:nth-child(1) {
  width: var(--fit-col-1, auto);
  min-width: var(--fit-col-1, auto);
  max-width: var(--fit-col-1, none);
}

#employee-list th:nth-child(2),
#employee-list td:nth-child(2),
#month-days-list th:nth-child(2),
#month-days-list td:nth-child(2) {
  width: var(--fit-col-2, auto);
  min-width: var(--fit-col-2, auto);
  max-width: var(--fit-col-2, none);
}

#employee-list th:nth-child(3),
#employee-list td:nth-child(3),
#month-days-list th:nth-child(3),
#month-days-list td:nth-child(3) {
  width: var(--fit-col-3, auto);
  min-width: var(--fit-col-3, auto);
  max-width: var(--fit-col-3, none);
}

#employee-list th:nth-child(4),
#employee-list td:nth-child(4),
#month-days-list th:nth-child(4),
#month-days-list td:nth-child(4) {
  width: var(--fit-col-4, auto);
  min-width: var(--fit-col-4, auto);
  max-width: var(--fit-col-4, none);
}

#month-days-list .days-list-header {
  flex: 0 0 auto;
  padding: 0 0 10px;
  border-bottom: 1px solid #ddd;
  background: #e9ecef;
  z-index: 10;
}

#month-days-list .days-list-scrollable {
  flex: 1 1 auto;
  min-height: 0;
  width: max(100%, var(--fit-table-width, max-content));
  min-width: 100%;
  overflow: hidden;
}

#month-days-list .days-list-scrollable > table {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: var(--fit-table-width, max-content);
  min-width: 0;
  border-collapse: collapse;
  overflow: clip;
}

#month-days-list thead {
  display: table;
  flex: 0 0 auto;
  width: var(--fit-table-width, 100%);
  table-layout: fixed;
}

#month-days-list tbody {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: clip;
}

#month-days-list tbody tr {
  display: table;
  width: var(--fit-table-width, 100%);
  table-layout: fixed;
}

#employee-list th, #employee-list td,
#month-days-list th, #month-days-list td {
  border: 1px solid #dee2e6;
  padding: 4px;   /* middle ground: between previous employee-list "4px 1px"
                     and day-list "6px" — equal density across both lists. */
  text-align: left;
  font-size: 13px;
  white-space: nowrap; /* ✅ Force single-line display */
}

#employee-list th,
#employee-list td {
  overflow: visible;
  text-overflow: clip;
}

#employee-list th,
#month-days-list th {
  background-color: #dee2e6;
  font-weight: bold;
}

#employee-list tr.selected,
#month-days-list tr.selected {
  background-color: #cce5ff;
}

.view-info-band .info-field-label {
  display: inline-flex;
  align-items: center;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid rgba(180, 163, 82, 0.34);
  background: rgba(255, 248, 196, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.72),
    0 1px 1px rgba(120, 100, 30, 0.14);
  font-size: 1em;
  line-height: 1.1;
  font-weight: 700;
  color: #4b4324;
  white-space: nowrap;
}

/* ── Inline month-nav (Request & Monthly info strips) ── */
.month-nav-inline {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  vertical-align: middle;
}

.month-nav-btn {
  background: transparent;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.month-nav-btn:hover {
  background: #e8eaed;
}

.month-nav-btn:active {
  background: #d1d5db;
}

#request-prev-month,
#request-next-month,
#monthly-prev-month,
#monthly-next-month {
  font-size: 0;
}

#request-prev-month::before,
#monthly-prev-month::before {
  content: '\25C0';
  font-size: 14px;
  color: #2563eb;
  line-height: 1;
}

#request-next-month::before,
#monthly-next-month::before {
  content: '\25B6';
  font-size: 14px;
  color: #2563eb;
  line-height: 1;
}

/* Days List Header */
.days-list-header {
  background-color: #f8f9fa;
  padding: 8px 10px;
  margin: -10px -10px 10px -10px;
  border-bottom: 1px solid #dee2e6;
}

.days-list-header h4 {
  margin: 0;
  font-size: 16px;
  color: #495057;
  text-align: center;
}

/* Weekend styling for days list */
#month-days-list tr.weekend {
  background-color: #f8f9fa;
  color: #6c757d;
}

#month-days-list tr.weekend.selected {
  background-color: #b3d9ff;
}

/* Today highlighting */
#month-days-list tr.today {
  background-color: #fff3cd;
  font-weight: bold;
}

#month-days-list tr.today.selected {
  background-color: #ffc107;
  color: #212529;
}

/* Multi-view container styling */
.view-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 10px;
  overflow: hidden;
  box-sizing: border-box;
}

/* Request View Styles (migrated from original) */
#request-view {
  display: flex;
  flex-direction: column;
}

/* ── Unified yellow header band (Request / Monthly / Daily) ──
   Applied directly to the title-strip element of each view.
   The summary block (4×2 or 7×1) sits as a separate sibling below.
   Title text: 16px bold. Single source of truth for the strip. */
.view-info-band {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  border-radius: 4px;
  padding: 6px 10px;
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: bold;
  white-space: nowrap;
  overflow-x: auto;
  flex: 0 0 auto;       /* fit content, never shrink in the column flex */
}

/* Summary siblings: keep their existing internal cell typography (13px)
   but make sure they never collapse or scroll vertically. */
#request_review_profile,
#monthly_summary_profile,
#monthly-summary-profile,
#daily-summary-stats,
.daily-summary-stats {
  flex: 0 0 auto;       /* always render at content height */
  overflow: visible;    /* no internal vertical scrollbar */
}

#request_review_profile,
#monthly_summary_profile {
  margin-left: 10px;
  margin-bottom: 10px;
  padding: 0;
  display: inline-block;
}

#request_review_profile table,
#monthly_summary_profile table {
  width: auto;
  border-collapse: separate;
  border-spacing: 20px 4px;
  border: 1px solid #ced4da;
  table-layout: fixed;
}

#request_review_profile td,
#monthly_summary_profile td {
  padding: 5px;
  text-align: left;
}

#request_review_profile label,
#monthly_summary_profile label {
  font-size: 13px;
  white-space: nowrap;
  display: inline-block;
}

#request_review_profile select,
#monthly_summary_profile select {
  font-size: 13px;
  padding: 3px 6px;
  width: auto;
  box-sizing: border-box;
}

#request_review_profile button,
#monthly_summary_profile button {
  padding: 6px 12px;
  font-size: 14px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

#request_review_profile button:disabled,
#monthly_summary_profile button:disabled {
  background-color: #cccccc;
  color: #666666;
  cursor: not-allowed;
  opacity: 0.6;
}

#request_review_profile button:hover,
#monthly_summary_profile button:hover {
  background-color: #0069d9;
}

#attendance-table {
  flex-grow: 1;
  overflow-y: auto;
  border: 1px solid #ced4da;
  background-color: #fff;
  min-height: 0;
}

#attendance-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#attendance-table th, #attendance-table td {
  border: 1px solid #ced4da;
  padding: 6px;
  text-align: center;
}

#attendance-table th {
  background-color: #dee2e6;
  font-weight: bold;
}

#attendance-table tbody tr:nth-child(even) {
  background-color: #f1f3f5;
}

#attendance-table tbody tr:hover {
  background-color: #e2e6ea;
}

/* freeze the top row of #attendance-table */
/* freeze the header row without touching its colour */
#attendance-table thead th { position: sticky; top: 0; z-index: 2; }

/* Monthly View Styles */
#monthly-view {
  display: none;
  flex-direction: column;
}

.monthly-header {
  background-color: #e8f4fd;
  padding: 10px;
  border: 1px solid #bee5eb;
  margin-bottom: 10px;
  border-radius: 4px;
}

.monthly-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.monthly-controls select,
.monthly-controls input {
  padding: 5px 8px;
  border: 1px solid #ced4da;
  border-radius: 4px;
}

.monthly-stats {
  flex-grow: 1;
  overflow-y: auto;
  border: 1px solid #ced4da;
  background-color: #fff;
}

.monthly-stats table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.monthly-stats th,
.monthly-stats td {
  border: 1px solid #ced4da;
  padding: 8px;
  text-align: center;
}

.monthly-stats th {
  background-color: #e8f4fd;
  font-weight: bold;
  position: sticky;
  top: 0;
}

.monthly-stats tbody tr:nth-child(even) {
  background-color: #f8f9fa;
}

.monthly-stats tbody tr:hover {
  background-color: #e2e6ea;
}

#attendance-table td.clickable-time {
  cursor: pointer;
  font-weight: 500;
}

#attendance-table td.clickable-time:hover {
  background-color: rgba(0, 123, 255, 0.08) !important;
  color: #0056b3;
}

/* Daily View Styles */
#daily-view {
  display: none;
  flex-direction: column;
}

/* .daily-header visual styling lives in .view-info-band now —
   the Daily header markup carries both classes. */

.daily-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.daily-controls input,
.daily-controls button {
  padding: 5px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
}

.daily-controls button {
  background-color: #28a745;
  color: white;
  cursor: pointer;
}

.daily-controls button:hover {
  background-color: #218838;
}

.daily-stats {
  flex-grow: 1;
  overflow-y: auto;
  border: 1px solid #ced4da;
  background-color: #fff;
}

.daily-stats table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.daily-stats th,
.daily-stats td {
  border: 1px solid #ced4da;
  padding: 8px;
  text-align: center;
}

.daily-stats th {
  background-color: #fff3cd;
  font-weight: bold;
  position: sticky;
  top: 0;
}

.daily-stats tbody tr:nth-child(even) {
  background-color: #f8f9fa;
}

.daily-stats tbody tr:hover {
  background-color: #e2e6ea;
}

/* Status indicators */
.status-present {
  color: #28a745;
  font-weight: bold;
}

.status-absent {
  color: #dc3545;
  font-weight: bold;
}

.status-leave {
  color: #ffc107;
  font-weight: bold;
}

.status-overtime {
  color: #17a2b8;
  font-weight: bold;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  #employee-list,
  #month-days-list {
    width: 20%;
    min-width: 180px;
  }
}

@media (max-width: 768px) {
  #main-content {
    flex-direction: column;
  }

  /* Sidebar hidden from layout on mobile — managed by mobile_nav.js bottom sheet */
  #employee-list,
  #month-days-list {
    display: none;
  }

  /* Fill the space between the mobile header and the bottom nav.
     #main-content is the flex child of body that already gets exactly
     that space (body is 100dvh, border-box, padding-bottom = nav height —
     see mobile_nav.css), so the view just fills its parent. The old
     calc(100vh - 52px - 56px) ignored the URL bar and safe areas. */
  .view-container {
    height: 100%;
    min-height: 0;
    width: 100%;
  }

  /* Info bars allowed to wrap on narrow screens.
     font-size intentionally omitted so .view-info-band's 16px / bold
     wins — keeps Request and Monthly title strips visually consistent
     with Daily's h3-based title on mobile. */
  #attendance-info,
  #monthly-attendance-info {
    white-space: normal;
  }

  /* Profile summary tables scroll horizontally rather than overflowing */
  #request_review_profile,
  #monthly-summary-profile {
    width: 100%;
    overflow-x: auto;
    display: block;
  }
}
