/* assets/css/custom.css - Mobile-First High Performance Edition */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --app-font: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --sidebar-width: 270px;
  --topbar-height: 64px;
  --bottom-bar-height: 64px;
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-dark: #0f172a;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --touch-target: 44px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--app-font);
  background-color: var(--bg-main);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  touch-action: manipulation;
  font-size: 15px;
}

/* Prevent iOS Zoom on Input Focus */
@media screen and (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* Mobile Topbar & Header */
.app-topbar {
  height: var(--topbar-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

@media (min-width: 992px) {
  .app-topbar {
    padding: 0 2rem;
  }
}

/* Mobile Bottom Navigation Bar (Native App Feel) */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-bar-height);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  z-index: 1030;
  display: flex;
  align-items: center;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 6px;
  min-width: 58px;
  transition: all 0.15s ease;
  user-select: none;
}

.mobile-nav-icon {
  font-size: 1.25rem;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-nav-item.active {
  color: var(--primary-color);
}

.mobile-nav-item.active .mobile-nav-icon {
  transform: translateY(-2px);
  color: var(--primary-color);
}

/* Highlighted Center Icon (Absensi) */
.mobile-nav-icon.highlight-icon {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff !important;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  margin-top: -8px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  font-size: 1.15rem;
}

/* Sidebar Desktop */
.app-sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #f1f5f9;
  z-index: 1040;
  transition: all 0.3s ease;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  height: var(--topbar-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo-box, .logo-box-mobile {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.sidebar-menu {
  flex: 1;
  padding: 1.25rem 1rem;
  overflow-y: auto;
}

.sidebar-heading {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #94a3b8;
  padding: 0.75rem 0.75rem 0.35rem 0.75rem;
  margin-top: 0.5rem;
}

.nav-item-custom {
  list-style: none;
  margin-bottom: 4px;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-link-custom i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  color: #94a3b8;
  transition: all 0.2s ease;
}

.nav-link-custom:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(4px);
}

.nav-link-custom.active {
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.nav-link-custom.active i {
  color: #ffffff;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Main Content Area */
.app-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

@media (min-width: 992px) {
  .app-main {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
  }
}

.content-wrapper {
  padding: 1rem;
  flex: 1;
}

@media (min-width: 768px) {
  .content-wrapper {
    padding: 1.75rem 2rem;
  }
}

/* Card Styling */
.card {
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.03);
  background: #ffffff;
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  font-weight: 600;
}

/* Mobile-Friendly KPI Stat Cards */
.stat-card {
  border-radius: 16px;
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

/* ========================================================
   MOBILE-FIRST ATTENDANCE CARD ROSTER
   ======================================================== */
.worker-attendance-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.6rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}

.worker-attendance-card:focus-within,
.worker-attendance-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.06);
}

/* Touch-Optimized Segmented Status Toggle (Mobile) - Sleek & Compact */
.mobile-status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.mobile-status-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  height: 34px;
  min-height: 34px;
  max-height: 34px;
  transition: all 0.15s ease;
  user-select: none;
}

.mobile-status-btn input[type="radio"] {
  display: none;
}

/* Status Active Colors (Sleek High Contrast) */
.mobile-status-btn.btn-h:has(input:checked),
.mobile-status-btn.btn-h.active {
  background-color: #10b981 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.mobile-status-btn.btn-s:has(input:checked),
.mobile-status-btn.btn-s.active {
  background-color: #3b82f6 !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.mobile-status-btn.btn-i:has(input:checked),
.mobile-status-btn.btn-i.active {
  background-color: #f59e0b !important;
  border-color: #d97706 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.mobile-status-btn.btn-a:has(input:checked),
.mobile-status-btn.btn-a.active {
  background-color: #ef4444 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* Desktop segmented radio buttons */
.status-selector {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.status-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  min-height: 38px;
}

.status-btn input[type="radio"] {
  display: none;
}

.status-btn.btn-h:has(input:checked),
.status-btn.btn-h.active {
  background-color: #10b981;
  color: #ffffff;
}

.status-btn.btn-s:has(input:checked),
.status-btn.btn-s.active {
  background-color: #3b82f6;
  color: #ffffff;
}

.status-btn.btn-i:has(input:checked),
.status-btn.btn-i.active {
  background-color: #f59e0b;
  color: #ffffff;
}

.status-btn.btn-a:has(input:checked),
.status-btn.btn-a.active {
  background-color: #ef4444;
  color: #ffffff;
}

/* Sticky / Floating Action Bar for Mobile Attendance Save */
.floating-save-bar {
  position: sticky;
  bottom: calc(var(--bottom-bar-height) + 8px);
  z-index: 1010;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  border-radius: 12px;
  padding: 8px 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

@media (min-width: 992px) {
  .floating-save-bar {
    bottom: 20px;
  }
}

/* Badges */
.badge-hadir {
  background-color: #d1fae5;
  color: #065f46;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
}

.badge-sakit {
  background-color: #dbeafe;
  color: #1e40af;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
}

.badge-izin {
  background-color: #fef3c7;
  color: #92400e;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
}

.badge-alpha {
  background-color: #fee2e2;
  color: #991b1b;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
}

.badge-cash {
  background-color: #dcfce7;
  color: #166534;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
}

.badge-kasbon {
  background-color: #ffedd5;
  color: #9a3412;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
}

/* Touch Button Sizing */
.btn {
  border-radius: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-lg {
  min-height: 50px;
  border-radius: 12px;
}

.btn-sm {
  min-height: 36px;
}

/* Form inputs */
.form-control, .form-select {
  border-radius: 10px;
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.85rem;
}

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

/* Responsive Table */
.table-custom thead th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid #e2e8f0;
  padding: 0.85rem 1rem;
}

.table-custom tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
}
