/* AYAMORE Customer Portal - Mobile & Desktop friendly */
:root {
  --portal-primary: #F5B400;
  --portal-primary-dark: #e6a800;
  --portal-bg: #F3F4F6;
  --portal-red: #D40504;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
  --safe-left: env(safe-area-inset-left, 0);
  --safe-right: env(safe-area-inset-right, 0);
}

.portal-body.portal-mobile {
  background: var(--portal-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Top bar */
.portal-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.portal-topbar-logo {
  font-size: 20px;
  font-weight: bold;
  color: var(--portal-red);
  text-decoration: none;
  display: flex;
  align-items: center;
}
.portal-logo-img {
  display: block;
  max-height: 32px;
  width: auto;
  object-fit: contain;
}

.portal-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-topbar-user {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.portal-topbar-logout {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--portal-red);
  background: none;
  border: 1px solid var(--portal-red);
  border-radius: 6px;
  cursor: pointer;
}

.portal-topbar-logout:hover {
  background: rgba(212, 5, 4, 0.08);
}

/* Main content - scrollable area */
.portal-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.portal-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.portal-panel.active {
  display: flex;
}

.portal-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.portal-panel-title {
  font-size: 20px;
  font-weight: 700;
  color: #111;
  margin: 0 0 16px 0;
}

/* Home - mobile layout */
.portal-home-header {
  margin-bottom: 20px;
}

.portal-greeting {
  font-size: 16px;
  color: #6b7280;
  margin: 0 0 4px 0;
}

.portal-title {
  font-size: 22px;
  font-weight: 700;
  color: #111;
  margin: 0 0 8px 0;
}

.portal-hours {
  font-size: 14px;
  color: var(--portal-red);
  margin: 0 0 20px 0;
}

.portal-wallet-card {
  background: var(--portal-primary);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.portal-wallet-label {
  display: block;
  font-size: 13px;
  color: #333;
  opacity: 0.85;
  margin-bottom: 4px;
}

.portal-wallet-value {
  font-size: 26px;
  font-weight: 700;
  color: #333;
}

.portal-wallet-card-large {
  margin-bottom: 20px;
}

.portal-wallet-card-large .portal-wallet-value {
  font-size: 28px;
}

.portal-wallet-hint {
  display: block;
  font-size: 13px;
  color: #333;
  opacity: 0.7;
  margin-top: 4px;
}

/* 3 cards in 2-column grid (mobile) */
.portal-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.portal-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
}

.portal-card:nth-child(3) {
  grid-column: 1 / -1;
}

.portal-card-link {
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

.portal-card-link:hover {
  border-color: var(--portal-primary);
  background: #fffbeb;
}

.portal-card-label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.portal-card-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #333;
}

.portal-card-hint {
  display: block;
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
}

/* Notifications */
.portal-notif-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

.portal-notif-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border: none;
  background: #fff;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  text-align: left;
  pointer-events: auto;
  touch-action: manipulation;
}

.portal-notif-header:hover {
  background: #f9fafb;
}

.portal-notif-badge {
  background: var(--portal-red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.portal-notif-chevron {
  margin-left: auto;
  font-size: 12px;
  color: #6b7280;
}

.portal-notif-list {
  padding: 0 16px 16px;
  border-top: 1px solid #e5e7eb;
}

.portal-notif-empty {
  padding: 16px;
  color: #6b7280;
  font-size: 14px;
}

.portal-notif-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid #e5e7eb;
}

.portal-notif-item:first-child {
  border-top: none;
}

.portal-notif-unread {
  background: rgba(245, 180, 0, 0.08);
  margin: 0 -16px;
  padding: 12px 16px;
}

.portal-notif-item-content {
  flex: 1;
}

.portal-notif-item-content strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.portal-notif-item-content p {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 4px 0;
}

.portal-notif-time {
  font-size: 11px;
  color: #9ca3af;
}

.portal-notif-clear {
  background: none;
  border: none;
  font-size: 20px;
  color: #9ca3af;
  cursor: pointer;
  padding: 0 8px;
}

.portal-notif-clear:hover {
  color: var(--portal-red);
}

/* Bottom tab bar */
.portal-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.portal-tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  min-height: 48px;
  border: none;
  background: none;
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  transition: color 0.15s, background 0.15s;
}

.portal-tabbar-item:hover {
  background: #f9fafb;
  color: #374151;
}

.portal-tabbar-item.active {
  color: var(--portal-primary);
  font-weight: 600;
}

.portal-tabbar-icon {
  font-size: 20px;
  line-height: 1;
}

.portal-tabbar-label {
  font-size: 10px;
  white-space: nowrap;
}

/* Content padding for tab bar */
.portal-body.portal-mobile .portal-content {
  padding-bottom: 70px;
}

/* Order tabs inline (in Orders panel) */
.portal-orders-header {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.portal-orders-header .portal-link-btn {
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--portal-red);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

.portal-orders-header .portal-link-btn:hover {
  text-decoration: underline;
}

.portal-order-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #fff;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.portal-order-tab {
  flex-shrink: 0;
  padding: 8px 14px;
  min-height: 40px;
  border: none;
  background: #f3f4f6;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  border-radius: 8px;
}

.portal-order-tab:hover {
  background: #e5e7eb;
  color: #333;
}

.portal-order-tab.active {
  background: var(--portal-primary);
  color: #333;
}

.portal-order-pane {
  margin-top: 0;
}

/* Lists */
.portal-loading {
  padding: 24px;
  text-align: center;
  color: #6b7280;
}

.portal-empty {
  padding: 24px;
  text-align: center;
  color: #6b7280;
}

.portal-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portal-row {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
}

.portal-row-status {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.portal-row-detail {
  display: block;
  font-size: 14px;
  color: #6b7280;
}

/* Wallet */
.portal-section-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 24px 0 12px 0;
}

.portal-btn {
  display: inline-block;
  padding: 12px 24px;
  min-height: 44px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  text-decoration: none;
  text-align: center;
}

.portal-btn-primary {
  background: var(--portal-primary);
  color: #333;
  margin-bottom: 24px;
}

.portal-btn-primary:hover {
  background: var(--portal-primary-dark);
}

.portal-btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.portal-btn-logout {
  background: #374151;
  color: #fff;
  margin-top: 24px;
  width: 100%;
}

.portal-btn-logout:hover {
  background: #1f2937;
}

.portal-btn-add {
  margin-bottom: 16px;
}

.portal-txn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid #e5e7eb;
}

.portal-txn-amount {
  font-weight: 600;
  color: #166534;
}

.portal-txn-type {
  color: #6b7280;
  font-size: 14px;
}

.portal-txn-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.portal-status-ok {
  background: #dcfce7;
  color: #166534;
}

.portal-status-pending {
  background: #fef3c7;
  color: #92400e;
}

.portal-status-fail {
  background: #fee2e2;
  color: #991b1b;
}

.portal-txn-date {
  margin-left: auto;
  font-size: 13px;
  color: #6b7280;
}

/* Profile */
.portal-profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.portal-avatar {
  width: 80px;
  height: 80px;
  border-radius: 40px;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.portal-profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.portal-profile-name {
  font-size: 20px;
  font-weight: 700;
  color: #333;
}

.portal-profile-email {
  font-size: 14px;
  color: #6b7280;
}

.portal-profile-country {
  font-size: 13px;
  color: #9ca3af;
}

.portal-profile-section {
  margin-bottom: 24px;
}

.portal-profile-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.portal-verify-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-verify-status {
  font-size: 16px;
  font-weight: 600;
}

.portal-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;
}

.portal-input {
  width: 100%;
  max-width: 400px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 16px;
  margin-bottom: 12px;
}

.portal-address-row {
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
}

.portal-address-main strong {
  display: block;
  margin-bottom: 4px;
}

.portal-address-main p {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

.portal-muted {
  font-size: 14px;
  color: #6b7280;
}

/* Shop For Me sub-tabs */
.portal-shop-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.portal-shop-tab {
  flex-shrink: 0;
  padding: 8px 14px;
  border: none;
  background: #f3f4f6;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  border-radius: 8px;
}

.portal-shop-tab:hover {
  background: #e5e7eb;
  color: #333;
}

.portal-shop-tab.active {
  background: var(--portal-primary);
  color: #333;
}

.portal-shop-pane {
  margin-top: 0;
}

.portal-textarea {
  min-height: 80px;
  resize: vertical;
}

/* Modals - when closed: no pointer events, invisible (prevents click-blocking) */
.portal-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
  visibility: hidden;
}

.portal-modal-overlay.portal-modal-open {
  display: flex;
  pointer-events: auto;
  visibility: visible;
}

.portal-modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.portal-modal-wide {
  max-width: 560px;
}

.portal-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
}

.portal-modal-close:hover {
  color: #333;
}

.portal-modal-hint {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 16px;
}

.portal-price-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.portal-price-card strong {
  display: block;
  margin-bottom: 8px;
}

.portal-select-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.portal-select-row {
  display: block;
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
}

.portal-select-row:hover {
  background: #f9fafb;
}

.portal-select-cb {
  margin-right: 8px;
}

.portal-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  background: #e5e7eb;
  color: #333;
}

.portal-badge-ok {
  background: var(--portal-primary);
  color: #333;
}

/* Shop For Me image upload */
.portal-upload-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.portal-upload-input {
  display: none;
}

.portal-upload-btn {
  flex-shrink: 0;
}

.portal-btn-outline {
  background: #fff;
  border: 2px solid var(--portal-primary);
  color: #333;
}

.portal-btn-outline:hover {
  background: #fffbeb;
}

.portal-upload-status {
  font-size: 13px;
  color: #6b7280;
}

.portal-image-preview {
  position: relative;
  margin-bottom: 12px;
  max-width: 200px;
}

.portal-image-preview img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.portal-preview-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-preview-remove:hover {
  background: var(--portal-red);
}

/* Deposit modal */
.portal-deposit-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.portal-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.portal-deposit-phone {
  margin-bottom: 16px;
}

.portal-deposit-pending {
  padding-top: 8px;
}

.portal-deposit-instruction {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #333;
}

.portal-deposit-pending .portal-link-btn {
  display: inline-block;
  margin-bottom: 12px;
}

.portal-row-title {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

/* Responsive - larger screens */
@media (min-width: 600px) {
  .portal-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .portal-card:nth-child(3) {
    grid-column: auto;
  }

  .portal-content {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
  }

  .portal-tabbar {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  }
}

@media (min-width: 768px) {
  .portal-scroll {
    padding: 24px;
  }

  .portal-order-tabs {
    flex-wrap: wrap;
  }

  .portal-input {
    max-width: 400px;
  }
}
