/* Hotel Repair & Inventory LIFF System - Modern Styling */

@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&family=Prompt:wght@300;400;500;600;700&display=swap');

:root {
  --font-prompt: 'Prompt', 'Kanit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --accent: #10b981;
  --bg-main: #f8fafc;
}

body {
  font-family: var(--font-prompt);
  background-color: #0f172a;
  color: #1e293b;
  -webkit-tap-highlight-color: transparent;
}

/* Glassmorphism Styles */
.glass-panel {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.glass-dark {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(51, 65, 85, 0.5);
}

.glass-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.08);
}

/* Mobile Frame Wrapper for Simulator */
.mobile-view-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
  background-color: #f8fafc;
  position: relative;
  overflow-x: hidden;
}

.desktop-view-container {
  max-width: 1360px;
  margin: 0 auto;
  min-height: 100vh;
  background-color: #f8fafc;
}

/* Status Badges */
.badge-pending {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}
.badge-assigned {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.badge-in_progress {
  background-color: #e0e7ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}
.badge-waiting_parts {
  background-color: #ffedd5;
  color: #c2410c;
  border: 1px solid #fed7aa;
}
.badge-completed {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.badge-cancelled {
  background-color: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

/* Priority Badges */
.priority-urgent {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  animation: pulse-urgent 2s infinite;
}
.priority-high {
  background-color: #f97316;
  color: white;
}
.priority-normal {
  background-color: #0284c7;
  color: white;
}
.priority-low {
  background-color: #64748b;
  color: white;
}

@keyframes pulse-urgent {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.02); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Bottom Navigation */
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  transition: all 0.2s ease;
}
.bottom-nav-item.active {
  color: #0284c7;
}
.bottom-nav-item.active svg {
  transform: scale(1.15);
  stroke: #0284c7;
}

/* PDF Print Template Styles */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .no-print {
    display: none !important;
  }
  .print-only {
    display: block !important;
  }
}

.pdf-preview-box {
  background: white;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  border-radius: 8px;
  padding: 32px;
  color: #0f172a;
  font-family: 'Prompt', 'Kanit', sans-serif;
  line-height: 1.5;
}

/* Shimmer Loading Effect */
.shimmer {
  background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}


/* --------------------------------------------------
   2026 UI Refresh — calm navy / cyan / warm-orange system
   -------------------------------------------------- */
:root {
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --cyan: #0891b2;
  --cyan-deep: #0e7490;
  --orange: #ea580c;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(circle at 8% -8%, rgba(14, 116, 144, 0.24), transparent 28rem),
    radial-gradient(circle at 100% 0%, rgba(16, 185, 129, 0.12), transparent 24rem),
    #0f172a;
}

#main-header {
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.18);
}

.app-view {
  animation: page-enter 240ms var(--ease-out);
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.modern-alert {
  box-shadow: 0 12px 26px rgba(234, 88, 12, 0.08);
}

.modern-stat-card {
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.inventory-row {
  position: relative;
  overflow: hidden;
  transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.inventory-row::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #10b981;
}

.inventory-row-low::before { background: #f97316; }

.inventory-row:hover {
  transform: translateY(-2px);
  border-color: #bae6fd;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.inventory-row-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #059669;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

.inventory-row-icon-low {
  color: #ea580c;
  background: #fff7ed;
  border-color: #fed7aa;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 700;
}

.status-chip-ok { color: #047857; background: #ecfdf5; }
.status-chip-warning { color: #c2410c; background: #fff7ed; }

button, a, input, select, textarea { transition-duration: 180ms; }
button:not(:disabled):active { transform: scale(0.97); }

#view-new-ticket > div,
#view-inventory > div:first-child,
#view-tickets > div:first-child,
#view-reports > div:first-child,
#view-admin-users > div:first-child,
#view-settings > div:first-child {
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.045);
}

#view-new-ticket input:focus,
#view-new-ticket textarea:focus,
#view-inventory input:focus,
#view-settings input:focus,
#view-settings textarea:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.12);
}

@media (max-width: 640px) {
  #main-header { padding-top: 0.65rem; padding-bottom: 0.65rem; }
  #main-header > div { align-items: flex-start; }
  #main-header .text-\[11px\] { max-width: 180px; }
  .inventory-row > .flex.items-center { align-items: flex-start; }
  .inventory-row > .flex.items-center > .text-right { min-width: 78px; }
  .inventory-row > .flex.items-center > .flex-1 { min-width: 0; }
  .inventory-row .pl-11 { padding-left: 0; }
  #view-new-ticket .grid.grid-cols-3 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}


.photo-source-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
}

.photo-source-btn:hover {
  border-color: #7dd3fc;
  background: #f8fdff;
  box-shadow: 0 8px 18px rgba(14, 165, 233, 0.1);
}

.photo-source-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.8rem;
  flex: 0 0 auto;
  transition: background-color 180ms ease;
}

.duty-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.duty-status-pill::before {
  content: '';
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 14%, transparent);
}

.duty-status-pill.is-on-duty {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.duty-status-pill.is-off-duty {
  color: #64748b;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.duty-person-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.86);
  transition: transform 180ms var(--ease-out), border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.duty-person-row:hover {
  transform: translateY(-1px);
  border-color: #bae6fd;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

.duty-avatar {
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  border-radius: 0.8rem;
}

.duty-live-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

.eyebrow-label {
  color: #0284c7;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  border-radius: 0.8rem;
}

.empty-state-soft {
  padding: 1.4rem 1rem;
  color: #94a3b8;
  text-align: center;
  border: 1px dashed #cbd5e1;
  border-radius: 1rem;
  background: rgba(248, 250, 252, 0.7);
  font-size: 0.75rem;
}

@media (max-width: 640px) {
  .duty-person-row { padding: 0.65rem; }
  .duty-status-pill { width: 100%; justify-content: center; }
}

/* Centered application dialogs */
#app-dialog.flex {
  animation: dialog-backdrop-in 180ms var(--ease-out);
}

.app-dialog-panel {
  animation: dialog-panel-in 220ms var(--ease-out);
}

@keyframes dialog-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialog-panel-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.duty-state-label {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0.3rem 0.55rem;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 10px;
  font-weight: 700;
}

.duty-state-label.is-on-duty {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.duty-person-row.is-on-duty {
  border-color: #a7f3d0;
  background: linear-gradient(135deg, #ffffff, #f0fdf4);
}

.duty-avatar-active {
  color: #047857;
  background: #d1fae5;
  border-color: #6ee7b7;
}

@media (max-width: 640px) {
  .duty-state-label { font-size: 9px; padding-inline: 0.45rem; }
}

@media print {
  body > *:not(#app-wrapper) { display: none !important; }
  #app-wrapper > *:not(.app-view) { display: none !important; }
  #app-wrapper { max-width: none !important; margin: 0 !important; padding: 0 !important; box-shadow: none !important; }
  #view-reports > *:not(.pdf-preview-box) { display: none !important; }
  .pdf-preview-box { box-shadow: none !important; border-radius: 0 !important; padding: 0 !important; }
}


/* --------------------------------------------------
   PDF documents — A4-safe layout and same-DOM printing
   -------------------------------------------------- */
.pdf-document {
  width: 100%;
  max-width: 190mm;
  margin: 0 auto;
  box-sizing: border-box;
  color: #0f172a;
  background: #ffffff;
  font-family: 'Prompt', 'Kanit', sans-serif;
  font-size: 10px;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.pdf-report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12mm;
  padding-bottom: 4mm;
  border-bottom: 1.2px solid #0f172a;
}

.pdf-report-header > div:first-child { min-width: 0; }
.pdf-report-header h1 {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: .01em;
}
.pdf-report-header p { margin: 1mm 0 0; color: #64748b; font-size: 8.5px; }
.pdf-report-heading { flex: 0 0 auto; min-width: 58mm; text-align: right; color: #334155; font-size: 9px; }
.pdf-report-title {
  display: inline-block;
  max-width: 68mm;
  padding: 2.2mm 3mm;
  color: #ffffff;
  background: #0f172a;
  border-radius: 1.2mm;
  font-size: 11px;
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: .02em;
}
.pdf-report-id { margin-top: 1.5mm; font-size: 9px; }
.pdf-report-id strong { color: #0369a1; }
.pdf-report-date { margin-top: 1mm; color: #64748b; font-size: 8px; }
.pdf-range-heading { white-space: nowrap; }

.pdf-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4mm;
  margin-top: 4mm;
  padding: 3.5mm;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 2mm;
  font-size: 9px;
}
.pdf-meta-grid > div + div { padding-left: 4mm; border-left: 1px solid #e2e8f0; }
.pdf-meta-grid div div { margin: 1.1mm 0; }
.pdf-meta-grid span { color: #64748b; }
.pdf-meta-grid strong { color: #0f172a; }

.pdf-section { margin-top: 4mm; }
.pdf-section-title {
  margin: 0 0 2mm;
  padding-bottom: 1.2mm;
  border-bottom: 1px solid #cbd5e1;
  color: #0f172a;
  font-size: 9.5px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: .01em;
}
.pdf-problem-box {
  padding: 3mm;
  border: 1px solid #e2e8f0;
  border-radius: 1.5mm;
  font-size: 9px;
}
.pdf-problem-title { margin-bottom: 1.2mm; font-weight: 800; }
.pdf-problem-box p { margin: 0; color: #475569; }

.pdf-photo-section { page-break-inside: avoid; }
.pdf-photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3mm;
}
.pdf-photo-grid.single { grid-template-columns: 1fr; }
.pdf-work-photo {
  margin: 0;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 1.5mm;
  background: #f8fafc;
  page-break-inside: avoid;
}
.pdf-photo-image {
  display: block;
  width: 100%;
  height: 46mm;
  object-fit: contain;
  background: #e2e8f0;
}
.pdf-photo-grid.single .pdf-photo-image { height: 68mm; }
.pdf-work-photo figcaption { padding: 1.2mm; color: #64748b; text-align: center; font-size: 8px; }

.pdf-signature-section { display: flex; justify-content: center; margin-top: 8mm; page-break-inside: avoid; }
.pdf-signature-box {
  width: 70mm;
  padding: 3mm 4mm 2mm;
  border: 1px solid #e2e8f0;
  border-radius: 1.5mm;
  background: #f8fafc;
  text-align: center;
  font-size: 9px;
}
.pdf-signature-line { height: 10mm; margin: 1mm 4mm 1mm; border-bottom: 1px solid #64748b; }
.pdf-signature-box small { color: #64748b; font-size: 8px; }
.pdf-report-footer {
  display: flex;
  justify-content: space-between;
  gap: 4mm;
  margin-top: 4mm;
  padding-top: 2mm;
  border-top: 1px solid #e2e8f0;
  color: #94a3b8;
  font-size: 7.5px;
}

.pdf-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2mm;
  margin-top: 4mm;
}
.pdf-kpi-grid > div {
  min-width: 0;
  padding: 2.6mm 1.5mm;
  border: 1px solid #e2e8f0;
  border-radius: 1.5mm;
  background: #f8fafc;
  text-align: center;
}
.pdf-kpi-grid > div:nth-child(2) { background: #ecfdf5; border-color: #a7f3d0; }
.pdf-kpi-grid > div:nth-child(3) { background: #fff7ed; border-color: #fed7aa; }
.pdf-kpi-grid > div:nth-child(4) { background: #eff6ff; border-color: #bfdbfe; }
.pdf-kpi-grid span { display: block; color: #64748b; font-size: 7.5px; line-height: 1.25; }
.pdf-kpi-grid strong { display: block; margin-top: 1mm; color: #0f172a; font-size: 13px; line-height: 1; }
.pdf-table-section { margin-top: 4mm; }
.pdf-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border: 1px solid #cbd5e1;
  font-size: 8px;
}
.pdf-table th,
.pdf-table td {
  box-sizing: border-box;
  padding: 1.5mm 1.3mm;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.pdf-table th { background: #f1f5f9; color: #334155; font-size: 7.5px; font-weight: 800; }
.pdf-table tr:last-child td { border-bottom: 0; }
.pdf-table tbody tr:nth-child(even) { background: #fafafa; }
.pdf-summary-table .col-index { width: 5%; }
.pdf-summary-table .col-id { width: 14%; }
.pdf-summary-table .col-date { width: 11%; }
.pdf-summary-table .col-location { width: 17%; }
.pdf-summary-table .col-problem { width: 25%; }
.pdf-summary-table .col-tech { width: 17%; }
.pdf-summary-table .col-status { width: 11%; }
.pdf-ticket-id, .pdf-sku { color: #075985; font-weight: 800; }
.pdf-nowrap { white-space: nowrap; overflow-wrap: normal !important; }
.pdf-status { display: inline-block; padding: .8mm 1mm; border-radius: 1mm; background: #e0f2fe; color: #075985; font-size: 7px; font-weight: 800; }
.pdf-empty-cell { padding: 8mm !important; color: #94a3b8; text-align: center; }

.pdf-inventory-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pdf-inventory-table .col-index { width: 5%; }
.pdf-inventory-table .col-sku { width: 14%; }
.pdf-inventory-table .col-name { width: 23%; }
.pdf-inventory-table .col-category { width: 20%; }
.pdf-inventory-table .col-qty { width: 9%; }
.pdf-inventory-table .col-min { width: 9%; }
.pdf-inventory-table .col-unit { width: 8%; }
.pdf-inventory-table .col-state { width: 12%; }
.pdf-inventory-table th, .pdf-inventory-table td { padding: 1.3mm 1mm; font-size: 7.8px; }
.pdf-inventory-table th { font-size: 7.3px; }
.pdf-low-stock { background: #fff7ed !important; }
.pdf-stock-state { color: #047857; font-weight: 800; font-size: 7px; }
.pdf-stock-state.is-low { color: #c2410c; }
.pdf-empty-state { padding: 20mm 4mm; color: #64748b; text-align: center; }

@media (max-width: 700px) {
  .pdf-report-header { gap: 4mm; }
  .pdf-report-header h1 { font-size: 13px; }
  .pdf-report-heading { min-width: 48mm; }
  .pdf-report-title { font-size: 9px; }
  .pdf-meta-grid { gap: 2mm; padding: 2.5mm; font-size: 8px; }
  .pdf-photo-image { height: 38mm; }
  .pdf-photo-grid.single .pdf-photo-image { height: 54mm; }
}

@media print {
  @page { size: A4 portrait; margin: 10mm; }
  html.pdf-print-mode, body.pdf-print-mode {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }
  body.pdf-print-mode > *:not(#app-wrapper) { display: none !important; }
  body.pdf-print-mode #app-wrapper { display: block !important; width: 100% !important; max-width: none !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; background: #ffffff !important; box-shadow: none !important; }
  body.pdf-print-mode #app-wrapper > *:not(.app-view) { display: none !important; }
  body.pdf-print-mode #app-wrapper .app-view:not(#view-reports) { display: none !important; }
  body.pdf-print-mode #view-reports { display: block !important; width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0 !important; background: #ffffff !important; }
  body.pdf-print-mode #view-reports > *:not(.pdf-preview-box) { display: none !important; }
  body.pdf-print-mode .pdf-preview-box { display: block !important; width: 100% !important; max-width: none !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; background: #ffffff !important; border-radius: 0 !important; box-shadow: none !important; }
  body.pdf-print-mode #pdf-render-area { display: block !important; width: 100% !important; max-width: none !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; background: #ffffff !important; }
  body.pdf-print-mode .pdf-document { max-width: none !important; margin: 0 !important; }
  .pdf-document { page-break-after: avoid; }
  .pdf-section, .pdf-table-section { page-break-inside: avoid; }
  .pdf-table thead { display: table-header-group; }
  .pdf-table tr { page-break-inside: avoid; }
}
