/* =============================================
   THỢ ĐỤNG - COMPLETE DESIGN SYSTEM
   ============================================= */

/* ---- CSS Variables ---- */
:root {
  --primary: #FFD600;
  --primary-dark: #F5C800;
  --primary-light: #FFF9D6;
  --primary-gradient: linear-gradient(135deg, #FFD600 0%, #F5C800 100%);
  
  --navy: #1A1F3C;
  --navy-light: #2B3266;
  
  --accent: #FFD600;
  --success: #00B14F;
  --danger: #E53935;
  --warning: #F39C12;
  --info: #1976D2;
  
  --text-primary: #1A1F3C;
  --text-secondary: #4A5080;
  --text-tertiary: #8B90A7;
  
  --bg-primary: #FFFFFF;
  --bg-secondary: #F4F5F9;
  --border: #E8EAF6;
  --border-light: #F0F1F8;
  
  --shadow-sm: 0 2px 8px rgba(26, 31, 60, 0.08);
  --shadow-md: 0 4px 16px rgba(26, 31, 60, 0.12);
  --shadow-lg: 0 8px 32px rgba(26, 31, 60, 0.16);
  --shadow-orange: 0 4px 20px rgba(255, 214, 0, 0.4);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 999px;
  
  --nav-height: 64px;
}

/* ---- Reset ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  overflow: hidden;
  height: 100%;
}

body {
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #1C1F3A;
  height: 100%;
  overflow: hidden;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ---- App Wrapper (mobile frame) ---- */
#app-wrapper {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #1C1F3A;
  overflow: hidden;
  position: relative;
}

#app {
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-secondary);
  overflow: hidden;
  position: relative;
}

/* ---- Screen ---- */
.screen {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---- Scroll Content ---- */
.scroll-content {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.scroll-content::-webkit-scrollbar {
  display: none;
}

.pb-nav {
  padding-bottom: calc(var(--nav-height) + 16px) !important;
}

/* ---- Typography ---- */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.3;
}

a {
  text-decoration: none;
  cursor: pointer;
}

button, input, textarea, select {
  font-family: inherit;
}

/* ---- Bottom Navigation ---- */
.bottom-nav {
  display: flex;
  align-items: center;
  background: white;
  border-top: 1px solid var(--border-light);
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  height: var(--nav-height);
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 2px 4px;
  transition: all 0.2s ease;
  border-radius: var(--radius-sm);
  outline: none;
}

.nav-icon {
  font-size: 20px;
  color: var(--text-tertiary);
  transition: all 0.25s ease;
  display: block;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  transition: all 0.25s ease;
  white-space: nowrap;
}

.nav-item.active .nav-icon {
  color: var(--primary);
  transform: translateY(-2px);
}

.nav-item.active .nav-label {
  color: var(--primary);
}

/* ---- App Header ---- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 56px;
}

.app-header.orange {
  background: var(--navy);
  color: white;
}
.app-header.orange .header-title { color: white; }
.app-header.primary {
  background: var(--primary-gradient);
  color: var(--navy);
}

.app-header.white {
  background: white;
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.app-header.transparent {
  background: transparent;
  position: absolute;
  left: 0; right: 0; top: 0;
}

/* ---- Buttons ---- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 50px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary-gradient);
  color: var(--navy);
  box-shadow: var(--shadow-orange);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(255, 123, 0, 0.4);
}

.btn-white {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.6);
  color: white;
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-secondary);
}

.btn-outline.dark {
  border-color: var(--border);
  color: var(--text-primary);
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  height: 50px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 16px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-secondary);
  transition: border-color 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  background: white;
}

.input-group {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-size: 16px;
  z-index: 1;
}

/* ---- OTP Inputs ---- */
.otp-container {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.otp-input {
  width: 48px;
  height: 56px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  background: var(--bg-secondary);
  outline: none;
  transition: all 0.2s ease;
}

.otp-input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(255, 123, 0, 0.15);
}

/* ---- Role Cards ---- */
.role-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.role-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.role-card:hover, .role-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.role-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.role-card-text h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.role-card-text p {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* ---- Chips ---- */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.chip-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.chip-success {
  background: #E8F5E9;
  color: var(--success);
}

.chip-warning {
  background: #FFF8E1;
  color: var(--warning);
}

.chip-danger {
  background: #FFEBEE;
  color: var(--danger);
}

.chip-info {
  background: #E3F2FD;
  color: var(--info);
}

/* ---- Order Card ---- */
.order-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 14px;
  margin: 0 16px 10px;
  border-left: 4px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.order-card:hover {
  box-shadow: var(--shadow-md);
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.order-id {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 3px;
}

.order-service {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.order-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.order-worker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-time {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.order-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
}

/* ---- Order Status ---- */
.order-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.order-status.pending {
  background: #FFF8E1;
  color: var(--warning);
}

.order-status.confirmed,
.order-status.in-progress {
  background: var(--primary-light);
  color: var(--primary);
}

.order-status.completed {
  background: #E8F5E9;
  color: var(--success);
}

.order-status.cancelled {
  background: #FFEBEE;
  color: var(--danger);
}

/* ---- Worker Card ---- */
.worker-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.worker-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.worker-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  border: 2px solid white;
  flex-shrink: 0;
}

.worker-info {
  flex: 1;
  min-width: 0;
}

.worker-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.worker-role {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.worker-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.worker-badge {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--text-secondary);
}

.worker-badge.star {
  color: #F59E0B;
}

.worker-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

/* ---- Status Badge ---- */
.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.status-badge.online {
  background: #E8F5E9;
  color: var(--success);
}

.status-badge.offline {
  background: var(--bg-secondary);
  color: var(--text-tertiary);
}

/* ---- Voucher Card ---- */
.voucher-card {
  display: flex;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin: 0;
}

.voucher-left {
  width: 80px;
  background: var(--primary-gradient);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  position: relative;
  padding: 12px 8px;
}

.voucher-icon {
  font-size: 20px;
  color: rgba(255, 255, 255, 0.8);
}

.voucher-discount {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}

.voucher-right {
  flex: 1;
  background: white;
  padding: 12px 14px;
}

.voucher-code {
  font-size: 14px;
  font-weight: 800;
  font-family: monospace;
  letter-spacing: 1px;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.voucher-name {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.voucher-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.voucher-expiry {
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 3px;
}

.btn-use-voucher {
  background: var(--primary-gradient);
  color: var(--navy);
  border: none;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.voucher-progress {
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}

.voucher-progress-bar {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* ---- Chat ---- */
.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.2s;
}

.chat-item:hover {
  background: var(--bg-secondary);
}

.chat-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
}

.notif-dot {
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid white;
}

.chat-info {
  flex: 1;
  min-width: 0;
}

.chat-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.chat-preview {
  font-size: 13px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.chat-time {
  font-size: 11px;
  color: var(--text-tertiary);
}

.chat-unread {
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ---- Notifications ---- */
.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.2s;
}

.notif-item.unread {
  background: #FFFBF7;
}

.notif-item:hover {
  background: var(--bg-secondary);
}

.notif-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-content {
  flex: 1;
}

.notif-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.notif-message {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 4px;
}

.notif-time {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ---- Toggle Switch ---- */
.toggle-switch {
  position: relative;
  width: 52px;
  height: 30px;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 15px;
  transition: all 0.3s ease;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary-gradient);
  box-shadow: 0 2px 10px rgba(255, 123, 0, 0.4);
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(22px);
}

/* ---- Empty State ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 32px;
  text-align: center;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-desc {
  font-size: 14px;
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1A1A2E;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  max-width: 90%;
  text-align: center;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: linear-gradient(135deg, #27AE60, #2ECC71);
}

.toast.error {
  background: linear-gradient(135deg, #E74C3C, #C0392B);
}

.toast.warning {
  background: linear-gradient(135deg, #F39C12, #E67E22);
}

.toast.info {
  background: linear-gradient(135deg, #3498DB, #2980B9);
}

/* ---- Loading Overlay ---- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.loading-overlay.hidden {
  display: none;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 123, 0, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  color: white;
  font-size: 14px;
  font-weight: 600;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Rating Dialog ---- */
.rating-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  z-index: 600;
  animation: fadeIn 0.2s ease;
}

.rating-sheet {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  background: white;
  border-radius: 24px 24px 0 0;
  padding: 24px;
  animation: slideUp 0.3s ease;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.rating-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.rating-star {
  font-size: 40px;
  color: var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.rating-star.active {
  color: #FFB800;
  transform: scale(1.1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ---- Misc ---- */
.opacity-50 {
  opacity: 0.5;
}

/* ---- Desktop: Centered App on Dark Background ---- */
@media (min-width: 431px) {
  body { background: #1C1F3A; }

  #app-wrapper {
    background: #1C1F3A;
    align-items: center;
    justify-content: center;
  }

  /* Bỏ label THỢ ĐỤNG APP */
  #app-wrapper::before {
    display: none;
  }

  /* App hiển thị như mobile, không có khung điện thoại */
  #app {
    width: 430px;
    max-width: 430px;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    margin: 0;
    box-shadow: none;
    overflow: hidden;
    position: relative;
  }

  /* Xóa notch */
  #app::before {
    display: none;
  }

  .bottom-nav {
    border-radius: 0;
  }
}


