/* Alawaleed BI - Pure JS Web Engine Design System */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&display=swap');

:root {
  --primary-green: #045652;
  --primary-green-dark: #023835;
  --primary-green-light: #087973;
  --accent-gold: #f39c12;
  --accent-green: #2ecc71;
  --wa-bg: #e5ddd5;
  --wa-chat-bg: #efeae2;
  --bg-gradient: linear-gradient(135deg, #045652 0%, #022b29 100%);
  --bg-light: #f8fafc;
  --card-bg: #ffffff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --border-radius: 16px;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --transition-fast: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-light);
  color: var(--text-dark);
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* App Header & Navigation */
.app-bar {
  background-color: var(--primary-green);
  color: #ffffff;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.app-bar .brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.menu-toggle {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  transition: var(--transition-fast);
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Side Drawer Overlay */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-fast);
}

.drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  height: 100%;
  background: #ffffff;
  z-index: 201;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transition: var(--transition-fast);
}

.drawer.active {
  right: 0;
}

.drawer-header {
  background: var(--primary-green);
  padding: 2rem 1.5rem;
  text-align: center;
}

.drawer-header img {
  max-height: 80px;
  object-fit: contain;
}

.drawer-menu {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.drawer-item {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: var(--primary-green);
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
}

.drawer-item:hover {
  background: var(--primary-green);
  color: #ffffff;
  transform: translateY(-2px);
}

/* Main Container & Layout */
.main-container {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1rem 6rem 1rem;
}

/* View Sections */
.view-section {
  display: none;
  animation: fadeIn 0.35s ease-out forwards;
}

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

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

/* Dynamic Carousel Banner */
.carousel-container {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  background: #e2e8f0;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
  object-fit: cover;
}

.carousel-slide.active {
  opacity: 1;
}

.carousel-controls {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 1rem;
  pointer-events: none;
}

.carousel-btn {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.85);
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.2rem;
  color: var(--primary-green-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.carousel-btn:hover {
  background: #ffffff;
  transform: scale(1.1);
}

.carousel-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: var(--transition-fast);
}

.dot.active {
  background: #ffffff;
  width: 24px;
  border-radius: 4px;
}

/* Action Button Grid */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.action-card {
  background: var(--bg-gradient);
  color: #ffffff;
  padding: 1.25rem;
  border-radius: var(--border-radius);
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.action-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, #087973 0%, #045652 100%);
}

/* Sponsor / Partner Badges */
.sponsor-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.sponsor-badge {
  background: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  max-height: 80px;
  max-width: 120px;
  object-fit: contain;
}

/* Contact Info Box */
.contact-info-card {
  background: var(--primary-green);
  color: #ffffff;
  padding: 1.25rem;
  border-radius: var(--border-radius);
  text-align: center;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-md);
}

.contact-info-card h4 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.contact-phone-numbers {
  font-size: 1.15rem;
  color: #a5f3fc;
  font-weight: 700;
  direction: ltr;
  user-select: all;
}

/* Details View Card */
.details-card {
  background: #ffffff;
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  line-height: 1.8;
  font-size: 1.05rem;
}

.details-card h2 {
  color: var(--primary-green);
  margin-bottom: 1rem;
  font-size: 1.5rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

/* Order Form */
.form-card {
  background: var(--primary-green);
  color: #ffffff;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.form-title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.form-control {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-dark);
  font-size: 1rem;
  transition: var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-gold);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.3);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1.25rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 600;
}

.radio-option input[type="radio"] {
  accent-color: var(--accent-green);
  width: 18px;
  height: 18px;
}

.btn-submit {
  width: 100%;
  background: var(--accent-green);
  color: #ffffff;
  border: none;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-sm);
  margin-top: 0.5rem;
}

.btn-submit:hover {
  background: #27ae60;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-submit:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

/* Success Card */
.success-card {
  background: #ffffff;
  border-radius: var(--border-radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.success-icon {
  font-size: 4rem;
  color: var(--accent-green);
  margin-bottom: 1rem;
}

.order-ref {
  background: #f8fafc;
  border: 2px dashed var(--primary-green);
  border-radius: 12px;
  padding: 1rem;
  margin: 1.5rem 0;
  font-size: 1.3rem;
  font-weight: 800;
  color: #e74c3c;
}

/* =========================================================
   WhatsApp Web Grade Fullscreen Immersive Chat Module
   ========================================================= */

/* Body in Chat Mode (Hides Header, Footer, and Floating buttons) */
body.is-chat-mode {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  background-color: var(--wa-chat-bg);
  display: flex;
  flex-direction: column;
}

body.is-chat-mode .app-bar,
body.is-chat-mode .app-footer,
body.is-chat-mode .floating-actions-layer {
  display: none !important;
}

body.is-chat-mode .main-container {
  max-width: 100% !important;
  width: 100% !important;
  height: 100% !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  flex: 1 !important;
}

body.is-chat-mode #view-chat-room.active {
  height: 100% !important;
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
  overflow: hidden !important;
}

body.is-chat-mode #view-chat-login.active {
  height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1rem !important;
  background: var(--bg-gradient);
}

.chat-card {
  background: var(--wa-chat-bg);
  border-radius: 0;
  height: 100%;
  max-height: 100%;
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: none;
  overflow: hidden;
  position: relative;
  border: none;
}

/* Modern Chat Header */
.chat-header {
  background: var(--primary-green);
  color: #ffffff;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  z-index: 10;
  flex-shrink: 0;
}

.chat-header-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.btn-chat-nav {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-chat-nav:hover {
  background: rgba(255, 255, 255, 0.15);
}

.chat-avatar-box {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.chat-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: contain;
}

.chat-avatar-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 12px;
  height: 12px;
  background: #2ecc71;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 6px #2ecc71;
}

.chat-info-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.chat-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-title-text {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-order-tag {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
}

.chat-status-sub {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 400;
}

.chat-header-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-tool-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 1.1rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.chat-tool-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.chat-tool-btn.btn-exit {
  background: rgba(239, 68, 68, 0.85);
  font-size: 0.95rem;
}

.chat-tool-btn.btn-exit:hover {
  background: #dc2626;
}

/* Chat Message Search Bar */
.chat-search-bar {
  background: #ffffff;
  padding: 0.5rem 1rem;
  display: none;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #cbd5e1;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.chat-search-bar.active {
  display: flex;
}

.chat-search-input {
  flex: 1;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  font-size: 0.9rem;
  outline: none;
}

.chat-search-close {
  background: none;
  border: none;
  color: #64748b;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
}

/* Animated Admin Typing Bar */
.typing-bar {
  background: #f1f5f9;
  color: var(--primary-green);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 1.25rem;
  display: none;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.typing-bar.active {
  display: flex;
}

.typing-dot-anim {
  width: 6px;
  height: 6px;
  background: var(--primary-green);
  border-radius: 50%;
  animation: pulse 0.8s infinite;
}

.chat-messages {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background-image: radial-gradient(rgba(4, 86, 82, 0.04) 1px, transparent 1px);
  background-size: 20px 20px;
}

.date-divider {
  align-self: center;
  background: rgba(225, 231, 239, 0.9);
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.85rem;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin: 0.5rem 0;
}

.msg-bubble {
  max-width: 78%;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: var(--transition-fast);
}

.msg-dropdown-trigger {
  position: absolute;
  top: 4px;
  left: 6px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 0.85rem;
  color: #54656f;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: all 0.15s ease;
  z-index: 5;
}

.msg-bubble:hover .msg-dropdown-trigger {
  display: flex;
}

.msg-dropdown-trigger:hover {
  background: #ffffff;
  color: #111b21;
  transform: scale(1.1);
}

/* WhatsApp Floating Context Menu */
.wa-context-menu {
  position: fixed;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  padding: 6px 0;
  min-width: 190px;
  z-index: 1000;
  display: none;
  flex-direction: column;
  animation: scaleIn 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.wa-context-menu.active {
  display: flex;
}

.wa-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: 0.9rem;
  color: #111b21;
  cursor: pointer;
  transition: background 0.15s ease;
  font-weight: 600;
  user-select: none;
}

.wa-menu-item:hover {
  background: #f0f2f5;
}

.wa-menu-item.danger {
  color: #dc2626;
}

.wa-menu-item.danger:hover {
  background: #fee2e2;
}

.wa-menu-icon {
  font-size: 1rem;
  width: 22px;
  text-align: center;
}

.msg-bubble.user {
  align-self: flex-end;
  background: #dcf8c6;
  color: #111b21;
  border-bottom-left-radius: 4px;
}

.msg-bubble.admin {
  align-self: flex-start;
  background: #ffffff;
  color: #111b21;
  border-bottom-right-radius: 4px;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 0.72rem;
  margin-top: 4px;
  color: #667781;
}

.msg-status-icon {
  font-size: 0.85rem;
}

.msg-reply-quote {
  background: rgba(0, 0, 0, 0.06);
  border-right: 4px solid var(--primary-green);
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.msg-reply-quote:hover {
  background: rgba(0, 0, 0, 0.12);
  transform: translateX(-2px);
}

@keyframes msgHighlightGlow {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(4, 86, 82, 0.8); }
  50% { transform: scale(1.03); box-shadow: 0 0 0 10px rgba(4, 86, 82, 0.25); background-color: #fff9c4 !important; }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(4, 86, 82, 0); }
}

.msg-highlight-pulse {
  animation: msgHighlightGlow 1.4s ease-in-out !important;
  z-index: 20;
}

.msg-img-preview {
  max-width: 100%;
  max-height: 260px;
  border-radius: 10px;
  object-fit: cover;
  margin-top: 4px;
  cursor: pointer;
  display: block;
  transition: opacity 0.2s ease;
}

.msg-img-preview:hover {
  opacity: 0.92;
}

.msg-image-wrapper {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 2px;
  cursor: pointer;
}

.msg-image-caption {
  padding: 6px 4px 2px 4px;
  font-size: 0.92rem;
  line-height: 1.4;
  word-break: break-word;
}

/* WhatsApp Video Message Player */
.msg-video-wrapper {
  position: relative;
  max-width: 280px;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 4px;
}

.msg-video-player {
  width: 100%;
  max-height: 280px;
  border-radius: 10px;
  display: block;
  background: #000;
}

/* WhatsApp Document Card */
.msg-document-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.05);
  padding: 10px 14px;
  border-radius: 12px;
  margin-top: 4px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.msg-bubble.user .msg-document-card {
  background: rgba(0, 0, 0, 0.04);
}

.msg-doc-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.msg-doc-info {
  flex: 1;
  min-width: 0;
}

.msg-doc-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: #111b21;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.msg-doc-ext {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
}

.btn-doc-download {
  background: var(--primary-green);
  color: #ffffff !important;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.95rem;
  transition: transform 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.btn-doc-download:hover {
  background: var(--primary-green-dark);
  transform: scale(1.08);
}

/* Text Message Content with multiline and link wrapping */
.msg-text-content {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  font-size: 0.95rem;
}

/* WhatsApp Message Reaction Badge */
.msg-reaction-badge {
  position: absolute;
  bottom: -10px;
  left: 8px;
  background: #ffffff;
  border-radius: 16px;
  padding: 1px 6px;
  font-size: 0.85rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid #e2e8f0;
  z-index: 10;
  user-select: none;
}

.msg-bubble.admin .msg-reaction-badge {
  left: auto;
  right: 8px;
}

/* Floating WhatsApp Emoji Reaction Bar */
.wa-reaction-bar {
  position: fixed;
  background: #ffffff;
  border-radius: 30px;
  padding: 4px 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  display: flex;
  gap: 6px;
  z-index: 9999;
  border: 1px solid #e2e8f0;
  animation: waPopIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes waPopIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.reaction-btn {
  background: none;
  border: none;
  font-size: 1.35rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.reaction-btn:hover {
  transform: scale(1.35);
  background: #f1f5f9;
}

.msg-forwarded-tag {
  font-size: 0.72rem;
  color: #64748b;
  font-style: italic;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* WhatsApp Voice Note Player */
.audio-player-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.04);
  padding: 0.5rem 0.75rem;
  border-radius: 20px;
  margin-top: 4px;
}

.audio-play-btn {
  background: var(--primary-green);
  color: #ffffff;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.audio-waveform-bar {
  flex: 1;
  height: 6px;
  background: #cbd5e1;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}

.audio-waveform-progress {
  height: 100%;
  background: var(--primary-green);
  width: 0%;
}

/* Voice Recording Active Banner */
.recording-bar {
  background: #fee2e2;
  color: #dc2626;
  padding: 0.6rem 1rem;
  display: none;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.9rem;
}

.recording-bar.active {
  display: flex;
}

.recording-dot {
  width: 10px;
  height: 10px;
  background: #dc2626;
  border-radius: 50%;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

/* Emoji Drawer */
.emoji-drawer {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 0.6rem 1rem;
  display: none;
  gap: 0.5rem;
  overflow-x: auto;
  font-size: 1.3rem;
  user-select: none;
}

.emoji-drawer.active {
  display: flex;
}

.emoji-item {
  cursor: pointer;
  transition: transform 0.15s;
}

.emoji-item:hover {
  transform: scale(1.3);
}

.reply-preview-bar {
  background: #f1f5f9;
  border-top: 1px solid #cbd5e1;
  padding: 0.5rem 1rem;
  display: none;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}

.reply-preview-bar.active {
  display: flex;
}

.chat-input-row {
  padding: 0.65rem 0.85rem;
  background: #f0f2f5;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}

.btn-chat-action {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--primary-green);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition-fast);
}

.btn-chat-action:hover {
  background: var(--primary-green);
  color: #ffffff;
}

.chat-input {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.95rem;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  font-size: 16px; /* Prevents iOS auto-zoom */
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 2px rgba(4, 86, 82, 0.15);
}

.btn-send {
  background: var(--primary-green);
  color: #ffffff;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-send:hover {
  background: var(--primary-green-dark);
  transform: scale(1.05);
}

/* Floating Action Buttons Layer (Chat FAB) */
.floating-actions-layer {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 150;
}

.floating-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.3rem;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: 0 10px 20px rgba(4, 86, 82, 0.35);
  cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  text-decoration: none;
  transition: var(--transition-fast);
  backdrop-filter: blur(10px);
}

.floating-btn.download-btn {
  background: linear-gradient(135deg, #045652 0%, #067872 100%);
  color: #ffffff;
}

.floating-btn.chat-fab-btn {
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
  color: #ffffff;
  position: relative;
}

.floating-btn:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25);
}

.unread-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #e74c3c;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-fast);
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--border-radius);
  max-width: 450px;
  width: 100%;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: var(--transition-fast);
  text-align: right;
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--primary-green);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

/* Footer */
.app-footer {
  background: var(--primary-green);
  color: rgba(255, 255, 255, 0.9);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  margin-top: auto;
}

/* Loading Spinner */
.spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  gap: 1rem;
  color: var(--primary-green);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--primary-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
  .floating-actions-layer {
    bottom: 16px;
    left: 16px;
    right: auto;
    gap: 8px;
  }
  .floating-btn {
    padding: 0.7rem 0.9rem;
    font-size: 0.82rem;
  }
}

/* Desktop Responsive Viewport Container for WhatsApp-Grade Web Chat */
@media (min-width: 1024px) {
  body.is-chat-mode {
    background: linear-gradient(180deg, #045652 0%, #045652 120px, #d1d7db 120px, #d1d7db 100%);
    padding: 1.25rem 0;
    align-items: center;
    justify-content: center;
  }

  body.is-chat-mode .main-container {
    max-width: 1100px !important;
    height: 95vh !important;
    max-height: 95vh !important;
    margin: auto !important;
    border-radius: 16px !important;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25) !important;
    overflow: hidden !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
  }

  body.is-chat-mode .chat-card {
    border-radius: 16px !important;
    height: 100% !important;
  }
}


/* App Download Buttons and Banners */
.btn-app-download-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  color: #ffffff !important;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(243, 156, 18, 0.35);
  transition: all 0.25s ease;
}

.btn-app-download-nav:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(243, 156, 18, 0.5);
}

.apk-download-banner {
  background: linear-gradient(135deg, #045652 0%, #033c39 100%);
  color: #ffffff;
  border-radius: var(--border-radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.apk-banner-content {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 260px;
}

.apk-banner-icon {
  font-size: 2.2rem;
  background: rgba(255, 255, 255, 0.15);
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.apk-banner-text h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}

.apk-banner-text p {
  margin: 4px 0 0;
  font-size: 0.85rem;
  opacity: 0.9;
  line-height: 1.4;
}

.btn-download-apk {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #f39c12 0%, #d35400 100%);
  color: #ffffff !important;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 0.95rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
  transition: all 0.25s ease;
  white-space: nowrap;
}

.btn-download-apk:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 18px rgba(243, 156, 18, 0.6);
}

@media (max-width: 640px) {
  .btn-app-download-nav {
    font-size: 0.78rem;
    padding: 5px 10px;
  }
  .apk-download-banner {
    padding: 1rem;
    flex-direction: column;
    text-align: center;
  }
  .apk-banner-content {
    flex-direction: column;
    text-align: center;
  }
  .btn-download-apk {
    width: 100%;
    justify-content: center;
  }
}

/* Fix Image Send Modal and Lightbox Z-Index & Visibility */
#image-send-modal,
#image-lightbox-modal {
  z-index: 99999 !important;
}

#image-send-modal.active,
#image-lightbox-modal.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Responsive Chat Controls & Mobile Optimization */
@media (max-width: 600px) {
  .floating-actions-layer {
    bottom: 16px;
    left: 16px;
  }
  .chat-header {
    padding: 0.5rem 0.75rem;
  }
  .chat-header-main {
    gap: 0.5rem;
  }
  .chat-title-text {
    font-size: 0.92rem;
  }
  .chat-messages {
    padding: 0.75rem 0.5rem;
    gap: 0.5rem;
  }
  .msg-bubble {
    max-width: 88% !important;
  }
  .chat-input-row {
    padding: 0.45rem 0.45rem;
    gap: 0.35rem;
  }
  .btn-chat-action {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
    flex-shrink: 0;
  }
  .btn-send {
    width: 38px;
    height: 38px;
    font-size: 1rem;
    flex-shrink: 0;
  }
  .chat-input {
    padding: 0.55rem 0.75rem;
    font-size: 16px;
  }
}


/* Layout Stability & Dimension Fixes for View Sections */
.view-section.active {
  display: block;
  width: 100% !important;
  box-sizing: border-box !important;
}

#view-home {
  width: 100%;
  box-sizing: border-box;
}

/* Ensure Desktop Home layout resets completely when exiting chat mode */
@media (min-width: 1024px) {
  body:not(.is-chat-mode) {
    align-items: stretch !important;
    justify-content: flex-start !important;
    padding: 0 !important;
    background: var(--bg-light) !important;
  }

  body:not(.is-chat-mode) .main-container {
    max-width: 900px !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 auto !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
    padding: 1rem 1rem 6rem 1rem !important;
    overflow: visible !important;
  }
}

/* =========================================================
   Notification Permission Modal & Educational Prompt
   ========================================================= */
.notif-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  direction: rtl;
  animation: notifFadeIn 0.3s ease-out forwards;
}

@keyframes notifFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.notif-modal-card {
  background: #ffffff;
  border-radius: 22px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.35);
  border: 1.5px solid rgba(4, 86, 82, 0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: notifSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes notifSlideUp {
  from { transform: translateY(24px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.notif-modal-header {
  background: linear-gradient(135deg, #045652 0%, #033c39 100%);
  color: #ffffff;
  padding: 1.4rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.notif-modal-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  animation: notifBellRing 2.2s infinite ease-in-out;
}

@keyframes notifBellRing {
  0%, 100% { transform: rotate(0); }
  10%, 30% { transform: rotate(14deg); }
  20%, 40% { transform: rotate(-14deg); }
  50% { transform: rotate(0); }
}

.notif-modal-titles h3 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.3;
}

.notif-modal-titles p {
  margin: 4px 0 0;
  font-size: 0.84rem;
  opacity: 0.88;
}

.notif-modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: #f8fafc;
}

.notif-feature-box {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.notif-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #ffffff;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.notif-feature-bullet {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.notif-feature-item div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.86rem;
  line-height: 1.45;
}

.notif-feature-item strong {
  color: #0f172a;
  font-size: 0.9rem;
}

.notif-feature-item span {
  color: #475569;
}

.notif-blocked-alert {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.84rem;
  line-height: 1.5;
}

.notif-modal-footer {
  padding: 1rem 1.25rem 1.25rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border-top: 1px solid #e2e8f0;
}

.btn-notif-action {
  background: linear-gradient(135deg, #045652 0%, #067872 100%);
  color: #ffffff;
  border: none;
  padding: 0.9rem 1.25rem;
  border-radius: 14px;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(4, 86, 82, 0.35);
  transition: all 0.25s ease;
}

.btn-notif-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(4, 86, 82, 0.5);
  background: linear-gradient(135deg, #067872 0%, #045652 100%);
}

.btn-notif-dismiss {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #64748b;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-notif-dismiss:hover {
  background: #f1f5f9;
  color: #334155;
}
