@media not print {
  html,
  body {
    background-color: rgb(var(--bs-tertiary-bg-rgb));
  }

  body {
    max-width: 1000px;
    margin: 0 auto;
  }
}

.form-label {
  margin-bottom: -0.4em;
  font-size: 0.766em; /* equals small + small */
  color: var(--bs-secondary-color);
  display: block;
}

form .form-label {
  margin-bottom: -0.1em;
}

.textarea {
  white-space: pre-wrap;
}

/* iOS-style form styling */
.ios-form {
  padding: 0;
}

.form-section {
  margin-bottom: 1.5rem;
  padding: 0;
}

.form-section-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--bs-secondary-color);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin-bottom: 0.5rem;
  padding: 0 4px;
}

.form-card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-group-stacked {
  padding: 0;
}

.form-card input[type="text"],
.form-card input[type="email"],
.form-card input[type="date"],
.form-card input[type="datetime-local"],
.form-card textarea,
.form-card select {
  border: none;
  border-radius: 0;
  padding: 12px 16px;
  font-size: 1rem;
  width: 100%;
  background: white;
  box-shadow: none;
  outline: none;
}

.form-card input[type="text"]:focus,
.form-card input[type="email"]:focus,
.form-card input[type="date"]:focus,
.form-card input[type="datetime-local"]:focus,
.form-card textarea:focus,
.form-card select:focus {
  outline: none;
  box-shadow: none;
  border: none;
}

.form-card textarea {
  resize: vertical;
  min-height: 126px;
}

.form-divider {
  height: 1px;
  background: #e5e5ea;
  margin: 0 16px;
}

.form-check-card {
  padding: 12px 16px;
  display: flex;
  align-items: center;
}

.form-check-label-ios {
  display: flex;
  align-items: center;
  margin: 0;
  width: 100%;
  cursor: pointer;
  font-size: 1rem;
}

.form-check-label-ios input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-right: 12px;
  cursor: pointer;
  border-radius: 6px;
}

.form-check-label-ios span {
  flex: 1;
}

.btn-ios-primary {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.0625rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  background: #007aff;
  color: white;
  transition: opacity 0.2s;
}

.btn-ios-primary:hover {
  background: #007aff;
  opacity: 0.85;
  color: white;
}

.btn-ios-primary:active {
  opacity: 0.7;
}

/* Select2 styling for iOS */
.form-card .select2-container {
  width: 100% !important;
}

.form-card .select2-container .select2-selection--single {
  border: none;
  border-radius: 0;
  height: auto;
  padding: 12px 16px;
  background: white;
}

.form-card .select2-container .select2-selection--single .select2-selection__rendered {
  padding: 0;
  line-height: 1.5;
}

.form-card .select2-container .select2-selection--single .select2-selection__arrow {
  height: 100%;
  right: 16px;
}

/* Error messages styling */
.form-card .invalid-feedback {
  padding: 8px 16px;
  margin: 0;
  background: #ffebee;
  color: #c62828;
  font-size: 0.875rem;
  border-top: 1px solid #e5e5ea;
}

/* Improve mobile touch targets */
@media (max-width: 768px) {
  .form-section {
    margin-bottom: 1.25rem;
  }

  .form-card input[type="text"],
  .form-card input[type="email"],
  .form-card input[type="date"],
  .form-card input[type="datetime-local"],
  .form-card textarea,
  .form-card select {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .btn-ios-primary {
    padding: 16px;
    font-size: 1.125rem;
  }
}

/* Smooth transitions */
.form-card {
  transition: box-shadow 0.2s ease;
}

.form-card:focus-within {
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.15);
}

/* Better textarea styling */
.form-card textarea {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

/* Placeholder styling */
.form-card input::placeholder,
.form-card textarea::placeholder {
  color: #999;
  opacity: 1;
}

/* iOS-style Navigation Bar */
.navbar-ios {
  background: white;
  border-bottom: 1px solid #e5e5ea;
  padding: 0;
  margin: 0;
  min-height: 44px;
}

.navbar-ios-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 8px;
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
}

.navbar-ios-left {
  display: flex;
  align-items: center;
  min-width: 80px;
  flex: 0 1 auto;
}

.navbar-ios-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  max-width: calc(100% - 160px);
}

.navbar-ios-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 80px;
  flex: 0 1 auto;
}

.navbar-ios-back {
  display: flex;
  align-items: center;
  color: #007aff;
  text-decoration: none;
  font-size: 1.0625rem;
  padding: 8px 12px 8px 8px;
  margin-left: -8px;
  border-radius: 8px;
  transition: background-color 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.navbar-ios-back:hover {
  background-color: rgba(0, 122, 255, 0.08);
  color: #007aff;
}

.navbar-ios-back:active {
  background-color: rgba(0, 122, 255, 0.15);
}

.navbar-ios-back i {
  font-size: 1.25rem;
  margin-right: 2px;
  flex-shrink: 0;
}

.navbar-ios-back-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar-ios-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* iOS-style icon buttons in navbar */
.btn-ios-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #007aff;
  text-decoration: none;
  transition: background-color 0.2s;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  font-size: 1.25rem;
}

.btn-ios-icon:hover {
  background-color: rgba(0, 122, 255, 0.08);
  color: #007aff;
}

.btn-ios-icon:active {
  background-color: rgba(0, 122, 255, 0.15);
}

/* Dropdown menu styling for iOS */
.navbar-ios .dropdown-menu {
  border: none;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  padding: 8px 0;
  margin-top: 4px;
  min-width: 200px;
}

.navbar-ios .dropdown-menu .dropdown-item {
  padding: 12px 16px;
  font-size: 1rem;
  color: #000;
  transition: background-color 0.2s;
}

.navbar-ios .dropdown-menu .dropdown-item:hover {
  background-color: #f5f5f5;
}

.navbar-ios .dropdown-menu .dropdown-item:active {
  background-color: #e8e8e8;
}

.navbar-ios .dropdown-menu .dropdown-item.text-danger {
  color: #ff3b30;
}

/* Responsive adjustments for navbar */
@media (max-width: 768px) {
  .navbar-ios-back {
    font-size: 1rem;
    max-width: 120px;
  }

  .navbar-ios-title {
    font-size: 1rem;
  }

  .navbar-ios-center {
    max-width: calc(100% - 120px);
  }
}

/* iOS-style Info Cards */
.ios-info-section {
  padding: 12px 0 0 0;
}

.ios-divider {
  height: 1px;
  background: #e5e5ea;
  margin: 1rem 0;
}

.form-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

/* Adjustments for column-based forms */
.ios-form-columns .form-section-label {
  padding-left: 0;
}

.form-section-action {
  margin-left: auto;
}

.info-card-row {
  padding: 12px 16px;
  position: relative;
}

.info-card-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-card-content .badge-ios {
  position: absolute;
  top: 12px;
  right: 16px;
  margin: 0;
}

.info-primary {
  font-size: 1rem;
  font-weight: 500;
  color: #000;
  line-height: 1.4;
}

.info-secondary {
  font-size: 0.9375rem;
  color: #666;
  line-height: 1.3;
}

.info-secondary-inline {
  font-size: 0.9375rem;
  color: #666;
  font-weight: 400;
}

/* iOS Badge */
.badge-ios {
  display: inline-block;
  padding: 2px 6px;
  font-size: 0.625rem;
  font-weight: 600;
  color: white;
  background: #8e8e93;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* iOS Form Footer */
.ios-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ios-status-text {
  font-size: 0.875rem;
  color: #666;
  flex: 0 0 auto;
}

/* iOS Secondary Button (for actions like "Add to handover history") */
.btn-ios-secondary {
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  background: #ff9500;
  color: white;
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.btn-ios-secondary:hover {
  background: #ff9500;
  opacity: 0.85;
  color: white;
}

.btn-ios-secondary:active {
  opacity: 0.7;
}

/* iOS Tertiary Button (for secondary actions like "Create and add another") */
.btn-ios-tertiary {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.0625rem;
  font-weight: 400;
  border-radius: 10px;
  border: none;
  background: #f2f2f7;
  color: #007aff;
  transition: opacity 0.2s;
}

.btn-ios-tertiary:hover {
  background: #e5e5ea;
  color: #007aff;
}

.btn-ios-tertiary:active {
  opacity: 0.7;
}

/* iOS-style Bed List */
.ios-bed-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
}

.bed-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border-radius: 10px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  gap: 12px;
}

.bed-card:hover {
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.15);
  transform: translateY(-1px);
}

.bed-card:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.bed-card-content {
  flex: 1;
  min-width: 0;
}

.bed-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.bed-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #007aff;
  flex-shrink: 0;
}

.bed-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.bed-time {
  font-size: 0.8125rem;
  color: #8e8e93;
  white-space: nowrap;
}

.bed-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bed-patient-name {
  font-size: 1rem;
  font-weight: 500;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bed-admission-reason {
  font-size: 0.875rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bed-admission-reason em {
  color: #8e8e93;
}

.bed-empty {
  font-size: 0.9375rem;
  color: #8e8e93;
}

.bed-chevron {
  color: #c7c7cc;
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* Responsive adjustments for bed list */
@media (max-width: 768px) {
  .ios-bed-list {
    gap: 8px;
    padding: 12px;
  }

  .bed-card {
    padding: 12px 14px;
  }

  .bed-name {
    font-size: 0.8125rem;
  }

  .bed-patient-name {
    font-size: 0.9375rem;
  }

  .bed-admission-reason {
    font-size: 0.8125rem;
  }
}

/* iOS-style Wards List */
.ios-wards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
}

.ward-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border-radius: 10px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  gap: 12px;
}

.ward-card:hover {
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.15);
  transform: translateY(-1px);
}

.ward-card:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ward-card-content {
  flex: 1;
  min-width: 0;
}

.ward-name {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ward-chevron {
  color: #c7c7cc;
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* Responsive adjustments for wards list */
@media (max-width: 768px) {
  .ios-wards-list {
    gap: 8px;
    padding: 12px;
  }

  .ward-card {
    padding: 14px 16px;
  }

  .ward-name {
    font-size: 1rem;
  }
}

/* iOS-style Transfer List */
.transfer-info {
  padding: 14px 16px;
  font-size: 1rem;
  line-height: 1.5;
  color: #333;
}

.ios-transfer-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 16px 16px;
}

.transfer-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border-radius: 10px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  gap: 12px;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.transfer-card:hover {
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.15);
  transform: translateY(-1px);
}

.transfer-card:active {
  background: #f8f9fa;
  transform: translateY(0);
}

.transfer-card-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.transfer-bed-name {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.transfer-bed-patient {
  font-size: 0.9375rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
}

.transfer-swap-badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 0.625rem;
  font-weight: 600;
  color: white;
  background: #ff9500;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.transfer-chevron {
  color: #c7c7cc;
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* Responsive adjustments for transfer list */
@media (max-width: 768px) {
  .ios-transfer-list {
    gap: 8px;
    padding: 0 12px 12px 12px;
  }

  .transfer-card {
    padding: 12px 14px;
  }

  .transfer-bed-name {
    font-size: 1rem;
  }

  .transfer-bed-patient {
    font-size: 0.875rem;
  }
}

/* iOS-style Handover List (Patient History) */
.ios-handover-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 0 16px 0;
}

.handover-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.handover-content {
  /* Removed flex that was breaking Bootstrap grid */
}

.handover-time-info {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.handover-time-info .badge-ios {
  position: absolute;
  top: 0;
  right: 0;
  margin: 0;
}

.handover-text-content {
  font-size: 1rem;
  color: #000;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.handover-empty {
  padding: 16px;
  text-align: center;
  color: #8e8e93;
  font-size: 0.9375rem;
}

/* Responsive adjustments for handover list */
@media (max-width: 768px) {
  .ios-handover-list {
    gap: 12px;
    padding: 0 12px 12px 12px;
  }

  .handover-card {
    padding: 14px;
  }

  .handover-text-content {
    font-size: 0.9375rem;
  }
}

/* Responsive adjustments for info cards */
@media (max-width: 768px) {
  .info-primary {
    font-size: 0.9375rem;
  }

  .info-secondary {
    font-size: 0.875rem;
  }

  .ios-form-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-ios-secondary {
    width: 100%;
    text-align: center;
  }

  .ios-status-text {
    text-align: center;
  }
}

@media not print {
  .print-only {
    display: none;
  }
}
/* iOS-style Report View (Screen) */
@media not print {
  .ios-report-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 0;
  }

  .report-bed-card {
    background: white;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  .report-bed-header {
    margin-bottom: 12px;
  }

  .report-bed-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: #007aff;
  }

  .report-bed-content {
    display: flex;
    flex-direction: column;
  }

  .report-stay-section {
    margin-bottom: 0;
  }

  /* Compact stay-info in report view */
  .report-stay-section .ios-info-section {
    padding: 0;
  }

  .report-stay-section .ios-info-section .row {
    margin-bottom: 0;
  }

  .report-stay-section .form-card {
    padding: 10px 12px;
    margin-bottom: 0;
  }

  .report-stay-section .info-card-row {
    padding: 0;
  }

  .report-stay-section .form-section-label {
    margin-bottom: 6px;
    font-size: 0.75rem;
  }

  .report-divider {
    height: 1px;
    background: #e5e5ea;
    margin: 0;
  }

  .report-handover-section {
    margin-top: 0;
  }

  /* Compact handover in report view */
  .report-handover-section .handover-content {
    margin-top: 0;
  }

  .report-handover-section .handover-content .row {
    margin-top: 0;
  }

  .report-handover-section .form-section-label {
    margin-bottom: 6px;
    font-size: 0.75rem;
  }

  .report-empty {
    color: #8e8e93;
    font-size: 0.9375rem;
    padding: 8px 0;
  }
}

/* Print-optimized Report View */
@media print {
  body,
  html {
    font-size: 11px;
  }
  .no-print {
    display: none !important;
  }
  .bed-info {
    break-inside: avoid;
  }

  /* Compact layout for printing */
  .ios-report-list {
    padding: 0;
    margin: 0;
  }

  .report-bed-card {
    border: 1px solid #ddd;
    padding: 8px;
    margin-bottom: 8px;
    background: white;
  }

  .report-bed-header {
    margin-bottom: 4px;
  }

  .report-bed-name {
    font-size: 1rem;
    font-weight: 700;
    color: #000;
  }

  .report-bed-content {
    display: block;
  }

  .report-stay-section {
    margin-bottom: 4px;
  }

  .report-handover-section {
    margin-top: 4px;
  }

  .report-empty {
    color: #666;
    font-style: italic;
  }

  /* Compact info section for print */
  .ios-info-section {
    padding: 4px 0;
  }

  .ios-info-section .row {
    margin: 0;
  }

  .ios-info-section .form-card {
    border: none;
    box-shadow: none;
    padding: 2px 4px;
    margin-bottom: 2px;
  }

  .ios-info-section .info-card-row {
    padding: 2px 0;
  }

  .ios-info-section .form-section-label {
    font-size: 0.75rem;
    margin-bottom: 1px;
  }

  /* Compact handover for print */
  .handover-card {
    border: none;
    box-shadow: none;
    padding: 4px 0;
  }

  .handover-content .row {
    margin: 0;
  }

  .handover-content .form-section-label {
    font-size: 0.75rem;
    margin-bottom: 1px;
  }

  .handover-time-info {
    gap: 2px;
  }

  .handover-text-content {
    font-size: 0.9rem;
    line-height: 1.3;
  }

  .info-primary {
    font-size: 0.9rem;
  }

  .info-secondary {
    font-size: 0.85rem;
  }

  /* To fix printing on Safari */
  .col-sm-1 {
    width: 8.333333%;
  }
  .col-sm-4 {
    width: 33.333333%;
  }
}
