/* Admin-style password input (matches admin login - sharp corners, gray border, eye toggle) */
.pw-input-admin-style.input-group {
  align-items: stretch;
}
.pw-input-admin-style.input-group .form-control,
.pw-input-admin-style.input-group .input-group-text {
  border-radius: 0 !important;
}
.pw-input-admin-style .form-control {
  border: 1px solid #d2d6de;
  height: 44px;
  min-height: 44px;
}
.pw-input-admin-style .form-control:focus {
  border-color: #d2d6de;
  box-shadow: none;
}
.pw-input-admin-style .pw-toggle-addon {
  cursor: pointer;
  background: #fff !important;
  border: 1px solid #d2d6de;
  border-left: 0 !important;
  border-radius: 0 !important;
  color: #555;
  min-width: 45px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pw-input-admin-style .pw-toggle-addon .pw-eye-off {
  display: none;
}
.pw-input-admin-style .pw-toggle-addon.show-password .pw-eye {
  display: none;
}
.pw-input-admin-style .pw-toggle-addon.show-password .pw-eye-off {
  display: inline-block;
}

/* Input group - addon flush with input (phone prefix, etc.) */
.input-group-flush {
  align-items: stretch;
}
.input-group-flush .form-control,
.input-group-flush .input-group-text {
  height: 44px;
  min-height: 44px;
}
.input-group-flush .input-group-text {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
}

/* =====================================================
   User Panel - Mobile UI/UX Enhancements
   Loading states, touch targets, accessibility, safe areas
   ===================================================== */

.btn-loading {
  pointer-events: none;
  opacity: 0.8;
}
.btn-loading .btn-text { visibility: hidden; }
.btn-loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.btn-primary.btn-loading::after,
.btn.btn-primary.btn-loading::after {
  border-color: rgba(255,255,255,0.5);
  border-top-color: #fff;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Transaction status badges */
.badge-success { background: #28a745; color: #fff; }
.badge-warning { background: #ffc107; color: #212529; }
.badge-secondary { background: #6c757d; color: #fff; }
.badge-danger { background: #dc3545; color: #fff; }
.transactions .badge { font-size: 10px; padding: 2px 6px; }

/* =====================================================
   Safe Area - Notched devices (iPhone X+, etc.)
   ===================================================== */
@supports (padding: env(safe-area-inset-bottom)) {
  #appCapsule {
    padding-bottom: max(80px, env(safe-area-inset-bottom) + 20px);
  }
  .appBottomMenu {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .appHeader.text-light.btn-primary .left,
  .appHeader.text-light.btn-primary .right {
    padding-top: env(safe-area-inset-top, 0);
  }
}

/* =====================================================
   Touch Targets - Min 44px for comfortable tapping
   ===================================================== */
.appHeader .headerButton,
.appBottomMenu .item,
.btn-lg,
.form-control,
.btn-block {
  min-height: 44px;
}
.appHeader .headerButton {
  min-width: 44px;
  padding: 0 12px;
}
.appHeader .headerButton img.imaged {
  min-width: 36px;
  min-height: 36px;
}

/* Listview & transaction items - larger tap areas */
.listview.image-listview .item,
.listview .item,
.transactions .item {
  min-height: 56px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: rgba(0,0,0,0.05);
}
.listview li > a.item {
  min-height: 56px;
  padding: 12px 16px;
}
.wallet-footer .item a {
  min-height: 56px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.wallet-footer .item .icon-wrapper {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =====================================================
   Forms - Prevent iOS zoom, comfortable input size
   ===================================================== */
@media (max-width: 768px) {
  .form-control,
  .form-group.basic input,
  .form-group.basic select,
  input.form-control,
  #txSearch {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
    min-height: 48px;
    padding: 12px 16px;
  }
  .form-group.basic {
    margin-bottom: 16px;
  }
  .form-group.basic .input-wrapper {
    min-height: 48px;
  }
  .verification-input {
    font-size: 24px !important;
    letter-spacing: 0.5em;
    text-align: center;
  }
}

/* =====================================================
   Wallet Card - Responsive balance & actions
   ===================================================== */
@media (max-width: 380px) {
  .wallet-card .balance h1.total {
    font-size: 1.5rem !important;
  }
  .wallet-footer .item {
    padding: 8px 4px;
  }
  .wallet-footer .item strong {
    font-size: 11px;
  }
}
.wallet-card .balance .right .button {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

/* =====================================================
   Stat Boxes - Readable on small screens
   ===================================================== */
@media (max-width: 480px) {
  .stat-box {
    padding: 14px 12px;
    min-height: 70px;
  }
  .stat-box .title {
    font-size: 12px;
  }
  .stat-box .value {
    font-size: 15px;
    word-break: break-all;
  }
  .row .col-6 {
    padding-left: 6px;
    padding-right: 6px;
  }
}

/* =====================================================
   Transaction List - Better spacing & readability
   ===================================================== */
.transactions .item {
  padding: 16px;
  gap: 12px;
}
.transactions .item .detail h2 {
  font-size: 15px;
  line-height: 1.3;
}
.transactions .item .detail p {
  font-size: 12px;
  margin-top: 4px;
}
.transactions .item .right h2 {
  font-size: 15px;
  white-space: nowrap;
}

/* Section spacing */
.section,
.section-full {
  padding-left: 16px;
  padding-right: 16px;
}
.section-heading {
  padding: 12px 16px 8px;
}
.section-heading .title {
  font-size: 17px;
}

/* =====================================================
   Cards - Comfortable padding
   ===================================================== */
@media (max-width: 768px) {
  .card {
    margin-left: 0;
    margin-right: 0;
    border-radius: 12px;
  }
  .card-body {
    padding: 18px 16px;
  }
  .listview.inset {
    margin-left: 16px;
    margin-right: 16px;
    border-radius: 12px;
    overflow: hidden;
  }
}

/* =====================================================
   Buttons - Full width on mobile where appropriate
   ===================================================== */
@media (max-width: 480px) {
  .btn-block,
  .form-button-group .btn,
  .section .btn-primary {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
  }
  .form-button-group {
    padding: 16px 0;
  }
}

/* =====================================================
   Search / Filter input
   ===================================================== */
#txSearch {
  min-height: 48px;
  padding: 12px 16px;
  font-size: 16px;
  border-radius: 10px;
  margin-bottom: 12px;
}

/* =====================================================
   Empty states - Centered, readable
   ===================================================== */
.transactions .item[style*="text-align: center"] {
  min-height: 120px;
  padding: 24px 16px;
}
.transactions .item[style*="text-align: center"] h3 {
  font-size: 16px;
}
.transactions .item[style*="text-align: center"] ion-icon {
  opacity: 0.5;
}

/* =====================================================
   Bottom menu - Safe, tappable
   ===================================================== */
.appBottomMenu .item {
  min-height: 56px;
  padding: 8px 4px;
}
.appBottomMenu .item .action-button.large {
  min-width: 56px;
  min-height: 56px;
}

/* =====================================================
   Modal / Action Sheet - Mobile friendly
   ===================================================== */
@media (max-width: 768px) {
  .modal .modal-dialog {
    margin: 10px;
    max-width: calc(100% - 20px);
  }
  .modal .modal-content {
    border-radius: 16px 16px 0 0;
  }
  .action-sheet .modal-dialog {
    position: fixed;
    bottom: 0;
    margin: 0;
    max-width: 100%;
  }
  .action-sheet .modal-content {
    border-radius: 20px 20px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* =====================================================
   Reduce motion - Accessibility
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
  .btn-loading::after {
    animation: none;
    border-top-color: transparent;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

/* =====================================================
   Dark mode adjustments (if theme supports)
   ===================================================== */
body.dark-mode .listview,
body.dark-mode .transactions .item {
  -webkit-tap-highlight-color: rgba(255,255,255,0.05);
}
