/* ==========================================================================
   WHATSAPP-STYLE LANDING PAGE DESIGN SYSTEM
   ========================================================================== */

:root {
  --bg-desktop: #0c1317;
  --bg-desktop-gradient: radial-gradient(circle at 50% 20%, #182229 0%, #0c1317 75%);
  --app-bg: #111b21;
  --header-bg: #202c33;
  --header-border: rgba(134, 150, 160, 0.15);
  --feed-bg: #0b141a;
  
  --card-bg: #202c33;
  --card-bg-hover: #233138;
  --card-border: rgba(255, 255, 255, 0.06);
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);

  --primary-green: #00a884;
  --primary-green-hover: #02906f;
  --primary-green-active: #008069;
  --accent-bright: #25d366;
  
  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-muted: #667781;
  --blue-ticks: #53bdeb;

  --input-bar-bg: #202c33;
  --input-bg: #2a3942;
  --input-placeholder: #8696a0;
  --icon-color: #8696a0;
  --icon-hover: #aebac1;

  --modal-overlay: rgba(11, 20, 26, 0.85);
  --modal-bg: #1f2c34;
  --modal-border: rgba(255, 255, 255, 0.12);

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --app-max-width: 500px;
}

/* Global Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-family);
  background-color: var(--bg-desktop);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(134, 150, 160, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(134, 150, 160, 0.45);
}

/* Desktop Surrounding Layout */
.desktop-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-desktop-gradient);
  padding: 16px;
}

/* Chat App Container */
.chat-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--app-max-width);
  height: 100%;
  max-height: 920px;
  background-color: var(--feed-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
}

/* Chat Background Doodle Wallpaper */
.chat-wallpaper {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='%23ffffff'%3E%3Cpath d='M28 22a8 8 0 1 1-8-8 8 8 0 0 1 8 8zm4 18h-8a6 6 0 0 0-6 6v10h20V46a6 6 0 0 0-6-6zm70-14a6 6 0 0 0-6 6v2a6 6 0 0 0 12 0v-2a6 6 0 0 0-6-6zm32 50a10 10 0 0 0-10 10c0 8 10 16 10 16s10-8 10-16a10 10 0 0 0-10-10zm-96 40c-6.6 0-12 4.5-12 10 0 2.8 1.4 5.3 3.8 7.1L20 156l9.6-4.8c1.3.5 2.8.8 4.4.8 6.6 0 12-4.5 12-10s-5.4-10-12-10zm72-24a8 8 0 0 0-8 8v16a8 8 0 0 0 16 0v-16a8 8 0 0 0-8-8zm-24-46l-4 8-8 1 6 6-1 8 7-4 7 4-1-8 6-6-8-1-4-8z'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 240px 240px;
  z-index: 1;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.chat-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  min-height: 62px;
  padding: 0 12px;
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  user-select: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.header-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--icon-color);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.header-back-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.header-avatar-btn {
  position: relative;
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: var(--radius-full);
  overflow: visible;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.header-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  display: block;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.15);
}

.online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background-color: var(--accent-bright);
  border: 2px solid var(--header-bg);
  border-radius: var(--radius-full);
}

.header-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  cursor: pointer;
}

.header-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.header-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.verified-icon {
  width: 16px;
  height: 16px;
  color: var(--primary-green);
  flex-shrink: 0;
}

.header-status {
  font-size: 12.5px;
  color: var(--accent-bright);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.header-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--icon-color);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.header-action-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--icon-hover);
}

.header-action-btn:active {
  transform: scale(0.92);
}

/* ==========================================================================
   DROPDOWN MENU
   ========================================================================== */
.header-menu-dropdown {
  position: absolute;
  top: 56px;
  right: 12px;
  width: 210px;
  background-color: var(--modal-bg);
  border: 1px solid var(--modal-border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  padding: 6px 0;
  z-index: 50;
  opacity: 0;
  transform: translateY(-8px) scale(0.95);
  pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.header-menu-dropdown.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.menu-item-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.menu-item-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   FEED / MESSAGES AREA
   ========================================================================== */
.chat-feed {
  position: relative;
  z-index: 2;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Info Badges (Encryption & Date) */
.feed-badge-container {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.encryption-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: #182229;
  border: 1px solid rgba(255, 215, 0, 0.15);
  color: #ffd279;
  font-size: 11.5px;
  line-height: 1.4;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  max-width: 90%;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.date-divider {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #182229;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  margin: 4px auto;
}

/* Post Cards */
.post-card {
  position: relative;
  align-self: flex-start;
  width: 100%;
  max-width: 94%;
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.post-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

/* Card Message Tail effect */
.post-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 8px 10px 0;
  border-color: transparent var(--card-bg) transparent transparent;
}

.post-image-wrap {
  position: relative;
  width: 100%;
  height: 475px;
  min-height: 475px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: #182229;
  cursor: pointer;
}

.post-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.post-image-wrap:hover .post-image {
  transform: scale(1.025);
}

.post-image-overlay-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-full);
  padding: 4px;
  color: #fff;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.post-image-wrap:hover .post-image-overlay-hint {
  opacity: 1;
}

/* Latest Post Highlighting Badge */
.latest-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 168, 132, 0.18);
  border: 1px solid rgba(0, 168, 132, 0.4);
  color: var(--accent-bright);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  width: fit-content;
  margin-bottom: 2px;
}

.latest-pulse {
  width: 6px;
  height: 6px;
  background-color: var(--accent-bright);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
  animation: pulseGreen 1.8s infinite;
}

@keyframes pulseGreen {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 5px rgba(37, 211, 102, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
  }
}

.post-content {
  padding: 2px 6px 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-text {
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text-primary);
  word-break: break-word;
}

/* Post Action CTA */
.post-cta-wrap {
  margin-top: 2px;
}

.post-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px 14px;
  background: linear-gradient(135deg, var(--primary-green) 0%, #008f70 100%);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(0, 168, 132, 0.3);
  transition: background 0.2s ease, transform var(--transition-fast), box-shadow var(--transition-fast);
}

.post-cta-btn:hover {
  background: linear-gradient(135deg, var(--primary-green-hover) 0%, #007a60 100%);
  box-shadow: 0 4px 10px rgba(0, 168, 132, 0.45);
  transform: translateY(-1px);
}

.post-cta-btn:active {
  transform: translateY(0);
}

.post-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  user-select: none;
  margin-top: 2px;
}

.post-time {
  font-size: 11px;
}

.read-ticks {
  display: inline-flex;
  align-items: center;
  color: var(--blue-ticks);
}

/* ==========================================================================
   BOTTOM MESSAGE BAR
   ========================================================================== */
.chat-bottom-bar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background-color: var(--input-bar-bg);
  border-top: 1px solid var(--header-border);
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.bottom-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--icon-color);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.bottom-icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--icon-hover);
}

.bottom-icon-btn:active {
  transform: scale(0.92);
}

.chat-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  background-color: var(--input-bg);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  min-height: 42px;
  border: 1px solid transparent;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input-wrapper.focus {
  border-color: var(--primary-green);
}

.chat-input-wrapper.shake {
  animation: shakeInput 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  border-color: #f15c6d;
}

@keyframes shakeInput {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

.chat-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.4;
}

.chat-input::placeholder {
  color: var(--input-placeholder);
}

.send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  background-color: var(--primary-green);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 168, 132, 0.35);
  transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.send-btn:hover {
  background-color: var(--primary-green-hover);
  box-shadow: 0 4px 10px rgba(0, 168, 132, 0.5);
}

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

/* ==========================================================================
   LOGIN / SIGNUP MODAL
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--modal-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

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

.modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background-color: var(--modal-bg);
  border: 1px solid var(--modal-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transform: scale(0.9) translateY(16px);
  transition: transform var(--transition-normal);
}

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

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: var(--radius-full);
  color: var(--icon-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.modal-avatar-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  margin-bottom: 14px;
}

.modal-avatar {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 2px var(--primary-green);
}

.modal-channel-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-bright);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-secondary);
  margin-bottom: 22px;
  padding: 0 6px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.modal-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--primary-green) 0%, #008069 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 3px 10px rgba(0, 168, 132, 0.35);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.modal-btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-green-hover) 0%, #00705a 100%);
  box-shadow: 0 5px 14px rgba(0, 168, 132, 0.5);
  transform: translateY(-1px);
}

.modal-btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.modal-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
}

.modal-footer-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   IMAGE LIGHTBOX
   ========================================================================== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

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

.lightbox-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: var(--radius-full);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
  z-index: 10;
}

.lightbox-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.lightbox-image-container {
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.92);
  transition: transform var(--transition-normal);
}

.lightbox-overlay.active .lightbox-image-container {
  transform: scale(1);
}

.lightbox-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.lightbox-caption {
  margin-top: 14px;
  max-width: 600px;
  font-size: 14px;
  color: #cfd9df;
  text-align: center;
  line-height: 1.4;
  padding: 0 12px;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Mobile Phones (up to 600px) */
@media (max-width: 600px) {
  .desktop-wrapper {
    padding: 0;
    height: 100vh;
    height: 100dvh;
    background: var(--feed-bg);
  }

  .chat-container {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .chat-header {
    height: 56px;
    min-height: 56px;
    padding: 0 8px;
  }

  .header-name {
    font-size: 15px;
  }

  .header-status {
    font-size: 11.5px;
  }

  .post-card {
    max-width: 98%;
    padding: 5px;
  }

  .post-text {
    font-size: 14px;
  }

  .modal-card {
    max-width: 92%;
    padding: 20px 16px;
  }
}

/* Tablet (601px to 1024px) */
@media (min-width: 601px) and (max-width: 1024px) {
  .desktop-wrapper {
    padding: 12px;
  }

  .chat-container {
    max-width: 480px;
    max-height: 94vh;
  }
}

/* Large Desktop screens (1440px+) */
@media (min-width: 1440px) {
  .chat-container {
    max-width: 520px;
    max-height: 880px;
  }
}
