/* ==========================================================================
   EWS Modern Medical Design System & Smooth UI
   ========================================================================== */

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

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --color-primary: #2563eb;
  --color-success: #059669;
  --color-danger: #e11d48;
  --color-neutral: #64748b;
  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans) !important;
  background-color: var(--bg-page) !important;
  color: #1e293b !important;
  margin: 0;
  padding: 24px 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   App Container & Layout
   -------------------------------------------------------------------------- */
.ews-app-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  overflow: hidden;
}

.ews-app-header, .ews-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  gap: 16px;
}

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

.ews-app-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.ews-header-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

/* --------------------------------------------------------------------------
   Scan Indicators
   -------------------------------------------------------------------------- */
.ews-scan-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ews-scan-box {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.ews-scan-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* --------------------------------------------------------------------------
   Patient Info Grid
   -------------------------------------------------------------------------- */
.ews-patient-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #ffffff;
}

@media (max-width: 640px) {
  .ews-patient-grid {
    grid-template-columns: 1fr;
  }
}

.ews-patient-col {
  padding: 18px 20px;
}

.ews-patient-col:first-child {
  border-right: 1px solid var(--border-color);
}

@media (max-width: 640px) {
  .ews-patient-col:first-child {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
}

.ews-patient-col-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
}

.ews-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}

.ews-meta-label {
  color: #64748b;
  font-weight: 500;
}

.ews-meta-value {
  color: #0f172a;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Section Headers
   -------------------------------------------------------------------------- */
.ews-section-header, .ews-section-title {
  padding: 10px 20px;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
}

/* --------------------------------------------------------------------------
   Procedures Body & Actions Toolbar
   -------------------------------------------------------------------------- */
.ews-procedures-body {
  padding: 20px;
  background: #ffffff;
}

.ews-cycle-banner {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ews-cycle-banner::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

.ews-actions-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   Activity & Logs Body
   -------------------------------------------------------------------------- */
.ews-activity-body {
  padding: 12px 16px;
  background: #ffffff;
}

.ews-activity-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  transition: background 0.15s ease;
}

.ews-activity-item:hover {
  background: #f8fafc;
}

.ews-log-body {
  padding: 20px;
  background: #ffffff;
}

.ews-log-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ews-log-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-left: 4px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  transition: all 0.15s ease;
}

.ews-log-entry:hover {
  background: #f8fafc;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

.ews-log-entry.pass {
  border-left-color: #10b981 !important;
  background: #fafdfc;
}

.ews-log-entry.fail {
  border-left-color: #ef4444 !important;
  background: #fefcfc;
}

.ews-log-entry.neutral {
  border-left-color: #3b82f6 !important;
  background: #fbfdff;
}

.ews-log-meta {
  font-size: 12px;
  color: #64748b;
}

.ews-log-user {
  font-weight: 600;
  color: #2563eb;
}

.ews-log-proc {
  font-weight: 600;
  color: #0f172a;
}

.ews-log-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.ews-log-badge.mixup {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  margin-left: 8px;
}

.ews-log-remove {
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.ews-log-remove:hover {
  background: #fee2e2;
}

.ews-empty-state {
  text-align: center;
  padding: 32px 16px;
  color: #94a3b8;
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   Modern Smooth Buttons (.btn-two)
   -------------------------------------------------------------------------- */
.btn-two, a.btn-two, input.btn-two {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-family: var(--font-sans) !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  line-height: 1.25 !important;
  padding: 8px 16px !important;
  border-radius: 6px !important;
  text-decoration: none !important;
  border: none !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
  height: auto !important;
  text-shadow: none !important;
}

.btn-two:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

.btn-two:active {
  transform: translateY(0) !important;
}

.btn-two.blue {
  background: #2563eb !important;
  color: #ffffff !important;
}
.btn-two.blue:hover {
  background: #1d4ed8 !important;
}

.btn-two.green {
  background: #059669 !important;
  color: #ffffff !important;
}
.btn-two.green:hover {
  background: #047857 !important;
}

.btn-two.red {
  background: #e11d48 !important;
  color: #ffffff !important;
}
.btn-two.red:hover {
  background: #be123c !important;
}

.btn-two.cyan {
  background: #f0fdf4 !important;
  color: #0f766e !important;
  border: 1px solid #99f6e4 !important;
  box-shadow: none !important;
}
.btn-two.cyan:hover {
  background: #ccfbf1 !important;
}

.btn-two.gray {
  background: #f1f5f9 !important;
  color: #64748b !important;
  border: 1px solid #cbd5e1 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

.btn-two.small {
  padding: 6px 12px !important;
  font-size: 12px !important;
}
.btn-two.medium {
  padding: 8px 16px !important;
  font-size: 13px !important;
}
.btn-two.large {
  padding: 10px 20px !important;
  font-size: 14px !important;
}

.btn-two.purple {
  background: #6366f1 !important;
  color: #ffffff !important;
}
.btn-two.purple:hover {
  background: #4f46e5 !important;
}

.btn-two.yellow {
  background: #fef3c7 !important;
  color: #92400e !important;
  border: 1px dashed #f59e0b !important;
  cursor: not-allowed !important;
}

/* --------------------------------------------------------------------------
   Procedure Card Grid UI (.ews-proc-grid)
   -------------------------------------------------------------------------- */
.ews-proc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  width: 100%;
}

.ews-proc-grid .btn-two.large {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  min-height: 88px !important;
  padding: 16px 18px !important;
  border-radius: 12px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  text-align: left !important;
  line-height: 1.4 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
  position: relative !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.ews-proc-grid .btn-two.green.large {
  background: #ffffff !important;
  color: #065f46 !important;
  border: 1.5px solid #10b981 !important;
}
.ews-proc-grid .btn-two.green.large:hover {
  background: #ecfdf5 !important;
  border-color: #059669 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 20px -3px rgba(16, 185, 129, 0.22) !important;
}
.ews-proc-grid .btn-two.green.large::after {
  content: '✓ Ready to Tag';
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #059669;
  background: #d1fae5;
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 10px;
}

.ews-proc-grid .btn-two.purple.large {
  background: #ffffff !important;
  color: #3730a3 !important;
  border: 1.5px solid #6366f1 !important;
}
.ews-proc-grid .btn-two.purple.large:hover {
  background: #eef2ff !important;
  border-color: #4f46e5 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 20px -3px rgba(99, 102, 241, 0.22) !important;
}
.ews-proc-grid .btn-two.purple.large::after {
  content: '✓ Ready to Tag';
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4f46e5;
  background: #e0e7ff;
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 10px;
}

.ews-proc-grid .btn-two.gray.large {
  background: #f8fafc !important;
  color: #94a3b8 !important;
  border: 1px solid #e2e8f0 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  box-shadow: none !important;
  opacity: 0.75 !important;
}
.ews-proc-grid .btn-two.gray.large::after {
  content: 'Completed / Inactive';
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 10px;
}

.ews-proc-grid .btn-two.yellow.large {
  background: #fffbeb !important;
  color: #92400e !important;
  border: 1.5px dashed #fcd34d !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  box-shadow: none !important;
}
.ews-proc-grid .btn-two.yellow.large::after {
  content: '⏳ Pending Sequence';
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #b45309;
  background: #fef3c7;
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 10px;
}

/* --------------------------------------------------------------------------
   Login & Welcome Cards
   -------------------------------------------------------------------------- */
.ews-login-card, .ews-welcome-box {
  max-width: 400px;
  margin: 40px auto;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  padding: 32px;
  text-align: center;
}

.ews-login-title, .ews-welcome-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 12px;
}

.ews-login-dept, .ews-welcome-subtitle {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 24px;
}

.ews-welcome-scan-prompt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: #ecfdf5;
  color: #047857;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #a7f3d0;
  border-radius: 9999px;
}
