/* ==========================================================================
   MANDOOBI | مندوبي — FLOVO Field Operations Design System
   Modern Glassmorphic, Polished, Production-Grade Styling
   ========================================================================== */

:root {
  --primary: #2D144B;
  --primary-light: #F3EEF9;
  --primary-dark: #1E0B34;
  --accent: #E65100;
  --accent-light: #FFF0E6;
  --accent-hover: #D84315;
  --success: #16A34A;
  --success-light: #DCFCE7;
  --warning: #D97706;
  --warning-light: #FEF3C7;
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --info: #2563EB;
  --info-light: #DBEAFE;
  
  --bg-page: #F4F6F9;
  --bg-surface: #FFFFFF;
  --bg-surface-glass: rgba(255, 255, 255, 0.88);
  --border-glass: rgba(255, 255, 255, 0.9);
  
  --text-main: #0F172A;
  --text-body: #334155;
  --text-muted: #64748B;
  --border: #E2E8F0;
  
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.09);
  --shadow-glass: 0 8px 24px -4px rgba(0, 0, 0, 0.05), inset 0 1px 1px 0 rgba(255, 255, 255, 0.9);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-page);
  color: var(--text-body);
  direction: rtl;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  margin: 0;
}

/* App Outer Shell (Responsive Container) */
.app-shell {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  background: var(--bg-surface);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
}

@media (min-width: 600px) {
  body {
    padding: 24px 0 40px;
    background: radial-gradient(circle at 50% 10%, #E8EDF5 0%, #D8DFE9 100%);
  }
  .app-shell {
    border-radius: 36px;
    min-height: 860px;
    max-height: 94vh;
    overflow-y: auto;
    border: 8px solid #1E293B;
    box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.4);
  }
}

/* Scrollbar styling */
.app-shell::-webkit-scrollbar {
  width: 5px;
}
.app-shell::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   TOP STATUS & BRAND HEADER
   -------------------------------------------------------------------------- */
.phone-top-bar {
  padding: 8px 18px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-main);
  background: #FFF;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-hero-section {
  padding: 8px 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #FFFFFF;
}

.brand-header-img {
  width: 100%;
  max-width: 250px;
  height: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(230, 81, 0, 0.12));
}

/* Rep Context & Shift Bar */
.rep-context-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 16px 14px;
  padding: 6px 14px;
  background: rgba(241, 245, 249, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-xl);
  font-size: 0.76rem;
}

.rep-id-badge {
  background: var(--primary);
  color: #FFFFFF;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 900;
  font-size: 0.68rem;
  letter-spacing: 0.5px;
}

.shift-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--success);
  background: var(--success-light);
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.7rem;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.5; }
  50% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.5; }
}

/* --------------------------------------------------------------------------
   8-MODULES GLASSMORPHIC GRID (HOME SCREEN)
   -------------------------------------------------------------------------- */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 0 16px 16px;
}

.module-card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  transition: all 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.02);
  border: 1.5px solid var(--border-glass);
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Specular reflection gradient highlight */
.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.65) 0%, rgba(255, 255, 255, 0) 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  pointer-events: none;
}

.module-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 14px 28px -4px rgba(0, 0, 0, 0.08), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
}

.module-card:active {
  transform: scale(0.96);
}

/* Soft Pastel Gradients matching reference photo */
.card-attendance {
  background: linear-gradient(145deg, #FFE4D2 0%, #FFD6BD 100%);
}
.card-visits {
  background: linear-gradient(145deg, #D7F6E4 0%, #C3F0D4 100%);
}
.card-tasks {
  background: linear-gradient(145deg, #E4E6FB 0%, #D5D9F8 100%);
}
.card-pos {
  background: linear-gradient(145deg, #FFF1E6 0%, #FFE5D2 100%);
}
.card-customers {
  background: linear-gradient(145deg, #E3E9FB 0%, #D4DEF8 100%);
}
.card-stock {
  background: linear-gradient(145deg, #FFF2E8 0%, #FFE7D4 100%);
}
.card-cash {
  background: linear-gradient(145deg, #EAE6FB 0%, #DCD5F9 100%);
}
.card-comm {
  background: linear-gradient(145deg, #D8F6E6 0%, #C2F2D7 100%);
}

/* Glassmorphic Icon Wrapper */
.card-icon-wrap {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.06));
}

.module-card:hover .card-icon-wrap {
  transform: scale(1.1) translateY(-2px);
}

.card-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Card Text */
.card-title-text {
  font-size: 1.08rem;
  font-weight: 900;
  color: #1E293B;
  letter-spacing: -0.3px;
}

/* --------------------------------------------------------------------------
   NEXT IMMEDIATE ASSIGNMENT PEEK (HOME SCREEN)
   -------------------------------------------------------------------------- */
.next-assignment-bar {
  margin: 0 16px 16px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.next-assignment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.next-assignment-badge {
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 800;
}

/* --------------------------------------------------------------------------
   MODULE DETAIL VIEWS (SUBPAGES)
   -------------------------------------------------------------------------- */
.module-view {
  display: none;
  padding: 0 16px 80px;
  animation: fadeIn 0.22s ease-in-out;
}

.module-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sticky Module Header with Back Button */
.module-top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 42px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 90;
}

.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(45, 20, 75, 0.15);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-back-home:hover {
  background: var(--primary);
  color: #FFF;
}

.module-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   COMMON CARDS, BUTTONS & INPUTS
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 800;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
}
.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-accent {
  background: var(--accent);
  color: #FFFFFF;
}
.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-success {
  background: var(--success);
  color: #FFFFFF;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary-light);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

.input-group {
  margin-bottom: 12px;
}

.input-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-body);
  margin-bottom: 5px;
}

.input-field {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.88rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #FFF;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s;
}

.input-field:focus {
  border-color: var(--accent);
}

/* Attendance Hero */
.attendance-hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-lg);
  padding: 20px;
  color: #FFF;
  text-align: center;
  margin-bottom: 14px;
  box-shadow: 0 10px 25px -5px rgba(45, 20, 75, 0.3);
}

.attendance-timer {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #FFB380;
  margin: 6px 0;
  font-variant-numeric: tabular-nums;
}

/* Product & Cart Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.product-card {
  background: #FFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   BOTTOM NAVIGATION BAR (MATCHING MOCKUP)
   -------------------------------------------------------------------------- */
.bottom-dock {
  height: 64px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 16px;
  position: sticky;
  bottom: 0;
  z-index: 100;
  margin-top: auto;
}

.dock-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  color: #94A3B8;
  transition: all 0.2s ease;
  width: 54px;
  height: 52px;
  user-select: none;
}

.dock-tab:hover {
  color: var(--accent);
}

.dock-tab.active {
  color: var(--accent);
}

.dock-tab svg {
  width: 26px;
  height: 26px;
  transition: transform 0.2s ease;
}

.dock-tab.active svg {
  transform: scale(1.12);
}

.dock-tab-indicator {
  position: absolute;
  bottom: 4px;
  width: 26px;
  height: 3px;
  background: var(--accent);
  border-radius: 4px;
  display: none;
}

.dock-tab.active .dock-tab-indicator {
  display: block;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal-sheet {
  background: #FFF;
  width: 100%;
  max-width: 440px;
  border-radius: 28px 28px 0 0;
  padding: 22px 20px 32px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: #CBD5E1;
  border-radius: 2px;
  margin: 0 auto 16px;
}
