/*
Theme Name: Ai Papa Theme
Theme URI: http://blogpage.in/
Author: Ai Papa
Version: 1.0.0
*/

:root {
  --wa-header: #075E54;
  --wa-header-light: #128C7E;
  --wa-green: #25D366;
  --wa-green-dark: #00A884;
  --wa-blue-tick: #53BDEB;
  --wa-sent-bubble: #D9FDD3;
  --wa-received-bubble: #FFFFFF;
  --wa-chat-bg: #ECE5DD;
  --wa-bg: #FFFFFF;
  --wa-text-primary: #111B21;
  --wa-text-secondary: #667781;
  --wa-divider: #E9EDEF;
  --wa-search-bg: #F0F2F5;
  --wa-unread: #25D366;
  --wa-danger: #EA0038;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--wa-bg);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  color: var(--wa-text-primary);
}

@media (min-width: 480px) {
  body {
    background: #dcdcdc;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}

.app-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background-color: var(--wa-bg);
}

.app-container::-webkit-scrollbar {
  width: 4px;
}
.app-container::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.2);
  border-radius: 4px;
}

@media (min-width: 480px) {
  .app-container {
    max-width: 430px;
    margin: 20px auto;
    height: 90vh;
    min-height: 0;
    border-radius: 36px;
    border: 12px solid #1f1f1f;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  }
}

.wa-header {
  background: var(--wa-header);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.wa-header-title {
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.wa-header-actions {
  display: flex;
  gap: 4px;
}

.wa-header-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.wa-header-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.wa-header-btn:active {
  transform: scale(0.9);
}

.wa-tabs {
  background: var(--wa-header-light);
  display: flex;
  position: relative;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wa-tab {
  flex: 1;
  padding: 14px 0;
  text-align: center;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 1.2px;
  cursor: pointer;
  transition: color 0.3s ease;
  position: relative;
  text-transform: uppercase;
}

.wa-tab.active {
  color: #fff;
}

.tab-badge {
  background: rgba(255, 255, 255, 0.9);
  color: var(--wa-header);
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 10px;
  margin-left: 4px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.wa-tab-indicator {
  position: absolute;
  bottom: 0;
  height: 3px;
  background: #fff;
  border-radius: 3px 3px 0 0;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.wa-search {
  padding: 6px 10px;
  background: var(--wa-bg);
}

.wa-search-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--wa-search-bg);
  border-radius: 8px;
  padding: 0 12px;
  height: 36px;
}

.wa-search-input-wrapper svg {
  width: 18px;
  height: 18px;
  color: var(--wa-text-secondary);
  flex-shrink: 0;
}

.wa-search-input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  padding: 0 10px;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--wa-text-primary);
}

.wa-search-input-wrapper input::placeholder {
  color: var(--wa-text-secondary);
}

.wa-chat-list {
  flex-grow: 1;
  overflow-y: auto;
  padding-bottom: 80px;
}

.wa-chat-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.wa-chat-row:hover {
  background: #F5F6F6;
}

.wa-chat-row:active {
  background: #E9EDEF;
}

.wa-chat-row::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 82px;
  right: 16px;
  height: 1px;
  background: var(--wa-divider);
}

.wa-chat-row:last-child::after {
  display: none;
}

.wa-avatar {
  width: 49px;
  height: 49px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  margin-right: 14px;
  overflow: visible;
}

.wa-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.wa-online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  background: var(--wa-green);
  border-radius: 50%;
  border: 2px solid white;
  z-index: 2;
}

.wa-status-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--wa-green);
  pointer-events: none;
  opacity: 0;
}

.wa-status-ring.live {
  opacity: 1;
  border-color: var(--wa-danger);
  animation: pulse-ring 2s infinite;
}

.wa-chat-info {
  flex: 1;
  min-width: 0;
}

.wa-chat-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}

.wa-chat-name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--wa-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-chat-time {
  font-size: 0.72rem;
  color: var(--wa-text-secondary);
  flex-shrink: 0;
  margin-left: 6px;
}

.wa-chat-time.unread {
  color: var(--wa-green-dark);
  font-weight: 600;
}

.wa-chat-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wa-chat-preview {
  font-size: 0.85rem;
  color: var(--wa-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 3px;
}

.wa-msg-status {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--wa-text-secondary);
}

.wa-msg-status.read {
  color: var(--wa-blue-tick);
}

.wa-unread-badge {
  background: var(--wa-unread);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
  margin-left: 6px;
}

.wa-chat-row.active-call {
  background: #F0FFF4;
  animation: row-highlight 0.4s ease forwards;
}

.wa-chat-row.active-call .wa-avatar::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid var(--wa-green);
  border-radius: 50%;
  animation: avatar-pulse 1.5s infinite;
}

.wa-call-icon {
  position: absolute;
  right: 16px;
  width: 24px;
  height: 24px;
  color: var(--wa-green-dark);
  opacity: 0;
  transition: opacity 0.3s;
}

.wa-chat-row.active-call .wa-call-icon {
  opacity: 1;
  animation: phone-ring 0.5s infinite;
}

.wa-sidebar {
  position: absolute;
  top: 0;
  left: 0;
  width: 300px;
  height: 100%;
  background: white;
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
}

.wa-sidebar.open {
  transform: translateX(0);
}

.wa-sidebar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  z-index: 195;
  transition: opacity 0.3s;
  backdrop-filter: blur(2px);
}

.wa-sidebar-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.wa-sidebar-header {
  padding: 50px 20px 20px;
  background: var(--wa-header);
  color: white;
}

.wa-sidebar-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
}

.wa-close-sidebar {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.wa-sidebar-links {
  list-style: none;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
}

.wa-sidebar-links li a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  color: var(--wa-text-primary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
}

.wa-sidebar-links li a:hover,
.wa-sidebar-links li a.active {
  background: var(--wa-search-bg);
}

.wa-sidebar-links li a.active {
  color: var(--wa-green-dark);
  font-weight: 600;
}

.wa-sidebar-links li a svg {
  width: 22px;
  height: 22px;
  color: var(--wa-text-secondary);
}

.wa-fab {
  position: absolute;
  bottom: 20px;
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--wa-green-dark);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 168, 132, 0.35);
  z-index: 90;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.wa-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 168, 132, 0.45);
}

.wa-fab:active {
  transform: scale(0.94);
}

.wa-fab svg {
  width: 26px;
  height: 26px;
}

.wa-call-modal {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}

.wa-call-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.wa-call-modal-content {
  width: 88%;
  max-width: 350px;
  background: white;
  border-radius: 24px;
  padding: 40px 24px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  transform: scale(0.9);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.wa-call-modal.show .wa-call-modal-content {
  transform: scale(1);
}

.wa-call-avatar {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 20px;
}

.wa-call-avatar img,
.wa-call-profile {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.wa-call-ring-pulse,
.wa-call-ring-pulse-two {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--wa-green);
  opacity: 0;
}

.wa-call-modal.show .wa-call-ring-pulse {
  animation: call-ripple 2s infinite;
}

.wa-call-modal.show .wa-call-ring-pulse-two {
  animation: call-ripple 2s infinite 1s;
}

.wa-call-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--wa-text-primary);
  margin-bottom: 6px;
}

.wa-call-status {
  font-size: 0.9rem;
  color: var(--wa-text-secondary);
  margin-bottom: 16px;
}

.wa-call-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8faf0 0%, #c7f7de 100%);
  color: var(--wa-green);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 5;
  border: 3px solid white;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
}

.wa-call-timer {
  font-size: 1rem;
  font-weight: 700;
  color: var(--wa-green-dark);
  margin-bottom: 24px;
  letter-spacing: 1px;
}

.wa-hangup-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--wa-danger);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(234, 0, 56, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.wa-hangup-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(234, 0, 56, 0.5);
}

.wa-hangup-btn:active {
  transform: scale(0.92);
}

.wa-chat-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 55%;
  max-height: 420px;
  background: white;
  border-radius: 20px 20px 0 0;
  z-index: 250;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.15);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.wa-chat-drawer.open {
  transform: translateY(0);
}

.wa-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  z-index: 245;
  transition: opacity 0.3s;
}

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

.wa-drawer-header {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--wa-divider);
  background: var(--wa-header);
  border-radius: 20px 20px 0 0;
  color: white;
}

.wa-drawer-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: white;
}

.wa-close-drawer {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background 0.2s;
}

.wa-close-drawer:hover {
  background: rgba(255,255,255,0.3);
}

.wa-drawer-messages {
  flex: 1;
  padding: 12px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--wa-chat-bg);
}

.wa-chat-msg {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  max-width: 80%;
  line-height: 1.4;
  position: relative;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}

.wa-chat-msg.system {
  align-self: center;
  background: rgba(255,255,255,0.9);
  color: var(--wa-text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

.wa-chat-msg.user-msg {
  align-self: flex-start;
  background: white;
  color: var(--wa-text-primary);
  border-top-left-radius: 2px;
}

.wa-chat-msg.sent-msg {
  align-self: flex-end;
  background: var(--wa-sent-bubble);
  color: var(--wa-text-primary);
  border-top-right-radius: 2px;
}

.wa-user-label {
  font-weight: 600;
  color: var(--wa-green-dark);
  margin-right: 3px;
  font-size: 0.8rem;
  display: block;
  margin-bottom: 2px;
}

.wa-drawer-input {
  padding: 8px 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--wa-search-bg);
}

.wa-drawer-input input {
  flex: 1;
  height: 40px;
  border-radius: 20px;
  border: none;
  padding: 0 16px;
  outline: none;
  font-family: inherit;
  font-size: 0.88rem;
  background: white;
}

.wa-drawer-input button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--wa-green-dark);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.wa-drawer-input button:hover {
  background: var(--wa-green);
}

.wa-seo-footer {
  padding: 24px 20px;
  background: white;
  text-align: center;
  border-top: 1px solid var(--wa-divider);
}

.wa-footer-copyright {
  font-size: 0.85rem;
  color: var(--wa-text-primary);
  margin-bottom: 4px;
}

.wa-footer-desc {
  font-size: 0.72rem;
  color: var(--wa-text-secondary);
  line-height: 1.5;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}

@keyframes avatar-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.2); opacity: 0; }
}

@keyframes call-ripple {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.5); opacity: 0; }
}

@keyframes phone-ring {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(15deg); }
  40% { transform: rotate(-15deg); }
  60% { transform: rotate(10deg); }
  80% { transform: rotate(-10deg); }
}

@keyframes row-highlight {
  0% { transform: translateY(4px); opacity: 0.8; }
  100% { transform: translateY(0); opacity: 1; }
}

@media (max-width: 375px) {
  .wa-avatar {
    width: 45px;
    height: 45px;
  }
  .wa-chat-row {
    padding: 8px 12px;
  }
  .wa-chat-row::after {
    left: 71px;
    right: 12px;
  }
}

/* --- WHATSAPP NOTIFICATION TOAST --- */
.wa-notification-toast {
  position: absolute;
  top: -120px;
  left: 12px;
  right: 12px;
  background: #111B21;
  color: #E9EDEF;
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
  opacity: 0;
  pointer-events: none;
}

.wa-notification-toast.show {
  transform: translateY(132px);
  opacity: 1;
  pointer-events: auto;
}

.toast-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.toast-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.toast-app-icon {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: var(--wa-green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #111B21;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

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

.toast-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #FFFFFF;
}

.toast-time {
  font-size: 0.7rem;
  color: #8696A0;
}

.toast-message {
  font-size: 0.82rem;
  color: #8696A0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-close-btn {
  background: none;
  border: none;
  color: #8696A0;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.toast-close-btn:hover {
  color: #FFFFFF;
}