/* ============================================================
   WhatsApp Style Chat Platform - Main Stylesheet
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --wa-primary:        #008069;
  --wa-primary-dark:   #006657;
  --wa-primary-light:  #d9fdd3;
  --wa-green:          #25d366;
  --wa-teal:           #00a884;
  --wa-blue:           #53bdeb;

  --wa-bg:             #f0f2f5;
  --wa-sidebar-bg:     #ffffff;
  --wa-panel-bg:       #ffffff;
  --wa-header-bg:      #008069;
  --wa-input-bg:       #f0f2f5;
  --wa-msg-sent:       #d9fdd3;
  --wa-msg-received:   #ffffff;
  --wa-border:         #e9edef;
  --wa-hover:          #f5f6f6;
  --wa-active:         #e9edef;

  --wa-text-primary:   #111b21;
  --wa-text-secondary: #667781;
  --wa-text-white:     #ffffff;
  --wa-text-muted:     #8696a0;
  --wa-text-green:     #25d366;

  --wa-shadow-sm:      0 1px 3px rgba(11,20,26,.15);
  --wa-shadow:         0 2px 8px rgba(11,20,26,.18);
  --wa-shadow-lg:      0 4px 20px rgba(11,20,26,.22);

  --wa-radius-sm:      4px;
  --wa-radius:         8px;
  --wa-radius-lg:      12px;
  --wa-radius-pill:    50px;

  --wa-font:           'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --wa-mono:           'Consolas', monospace;

  --transition-fast:   0.15s ease;
  --transition:        0.25s ease;
}

/* ── Dark Mode ──────────────────────────────────────────────── */
[data-theme="dark"] {
  --wa-bg:             #0b141a;
  --wa-sidebar-bg:     #111b21;
  --wa-panel-bg:       #202c33;
  --wa-header-bg:      #202c33;
  --wa-input-bg:       #2a3942;
  --wa-msg-sent:       #005c4b;
  --wa-msg-received:   #202c33;
  --wa-border:         #2a3942;
  --wa-hover:          #2a3942;
  --wa-active:         #2a3942;

  --wa-text-primary:   #e9edef;
  --wa-text-secondary: #8696a0;
  --wa-text-muted:     #667781;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--wa-font);
  font-size: 15px;
  color: var(--wa-text-primary);
  background: var(--wa-bg);
  min-height: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; }

/* ── Utility ────────────────────────────────────────────────── */
.text-muted-wa  { color: var(--wa-text-muted) !important; }
.text-green     { color: var(--wa-green) !important; }
.text-primary-wa{ color: var(--wa-primary) !important; }
.bg-wa-primary  { background: var(--wa-primary) !important; }
.border-wa      { border-color: var(--wa-border) !important; }

.hover-bg:hover { background: var(--wa-hover); }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar              { width: 5px; height: 5px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: var(--wa-border); border-radius: var(--wa-radius-pill); }
::-webkit-scrollbar-thumb:hover  { background: var(--wa-text-muted); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn-wa {
  background: var(--wa-primary);
  color: var(--wa-text-white);
  border: none;
  border-radius: var(--wa-radius-pill);
  padding: 10px 28px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .3px;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-wa:hover  { background: var(--wa-primary-dark); box-shadow: var(--wa-shadow); color: #fff; }
.btn-wa:active { transform: scale(.98); }
.btn-wa:disabled { opacity: .6; pointer-events: none; }

.btn-wa-outline {
  background: transparent;
  color: var(--wa-primary);
  border: 2px solid var(--wa-primary);
  border-radius: var(--wa-radius-pill);
  padding: 9px 26px;
  font-weight: 600;
  transition: all var(--transition-fast);
}
.btn-wa-outline:hover { background: var(--wa-primary); color: #fff; }

.btn-icon {
  background: none;
  border: none;
  padding: 8px;
  border-radius: 50%;
  color: var(--wa-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}
.btn-icon:hover { background: var(--wa-hover); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-wa {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-wa {
  background: var(--wa-input-bg);
  border: 1.5px solid var(--wa-border);
  border-radius: var(--wa-radius-lg);
  padding: 12px 16px;
  font-size: 15px;
  color: var(--wa-text-primary);
  width: 100%;
  transition: border-color var(--transition-fast);
  font-family: var(--wa-font);
}
.input-wa:focus {
  outline: none;
  border-color: var(--wa-primary);
  background: var(--wa-panel-bg);
}
.input-wa::placeholder { color: var(--wa-text-muted); }

.form-label-wa {
  font-size: 13px;
  font-weight: 600;
  color: var(--wa-primary);
  margin-bottom: 4px;
  display: block;
}

.input-group-wa {
  position: relative;
}
.input-group-wa .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--wa-text-muted);
  pointer-events: none;
}
.input-group-wa .input-wa { padding-left: 42px; }

.form-error {
  font-size: 12px;
  color: #ef4444;
  margin-top: 4px;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card-wa {
  background: var(--wa-panel-bg);
  border-radius: var(--wa-radius-lg);
  box-shadow: var(--wa-shadow-sm);
  border: 1px solid var(--wa-border);
  overflow: hidden;
}

/* ── Avatar ─────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}
.avatar-sm  { width: 38px;  height: 38px; }
.avatar-md  { width: 48px;  height: 48px; }
.avatar-lg  { width: 64px;  height: 64px; }
.avatar-xl  { width: 100px; height: 100px; }
.avatar-xxl { width: 130px; height: 130px; }

.avatar-placeholder {
  border-radius: 50%;
  background: var(--wa-primary);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Online Badge ───────────────────────────────────────────── */
.online-badge {
  position: relative;
  display: inline-block;
}
.online-badge::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #25d366;
  border: 2px solid var(--wa-panel-bg);
}
.online-badge.offline::after { background: var(--wa-text-muted); }

/* ── Auth Pages ─────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #005c4b 0%, #128c7e 50%, #25d366 100%);
  padding: 24px;
}

.auth-card {
  background: var(--wa-panel-bg);
  border-radius: var(--wa-radius-lg);
  box-shadow: var(--wa-shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo .logo-icon {
  width: 64px;
  height: 64px;
  background: var(--wa-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.auth-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--wa-text-primary);
  margin: 0;
}
.auth-logo p {
  font-size: 13px;
  color: var(--wa-text-muted);
  margin: 4px 0 0;
}

/* ── Alert ──────────────────────────────────────────────────── */
.alert-wa {
  border-radius: var(--wa-radius);
  padding: 12px 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
}
.alert-wa-success { background: #dcfce7; color: #166534; }
.alert-wa-danger  { background: #fef2f2; color: #991b1b; }
.alert-wa-warning { background: #fefce8; color: #854d0e; }
.alert-wa-info    { background: #eff6ff; color: #1e40af; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar-wa {
  background: var(--wa-header-bg);
  color: var(--wa-text-white);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--wa-shadow-sm);
}
.navbar-wa .brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--wa-text-white);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Landing Page ───────────────────────────────────────────── */
.hero-section {
  background: linear-gradient(135deg, #005c4b 0%, #128c7e 40%, #1eb98b 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  color: #fff;
  overflow: hidden;
  position: relative;
}
.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content { position: relative; z-index: 1; }
.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 20px;
}
.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  opacity: .85;
  margin-bottom: 36px;
  max-width: 500px;
}
.hero-btns { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-btns .btn-white {
  background: #fff;
  color: var(--wa-primary);
  border: none;
  border-radius: var(--wa-radius-pill);
  padding: 12px 30px;
  font-size: 16px;
  font-weight: 700;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hero-btns .btn-white:hover { background: #e8f5e9; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.hero-btns .btn-outline-white {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,.7);
  border-radius: var(--wa-radius-pill);
  padding: 11px 28px;
  font-size: 16px;
  font-weight: 600;
  transition: all var(--transition-fast);
}
.hero-btns .btn-outline-white:hover { background: rgba(255,255,255,.15); }

.feature-card {
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--wa-radius-lg);
  padding: 24px;
  text-align: center;
  color: #fff;
  transition: transform var(--transition);
}
.feature-card:hover { transform: translateY(-4px); }
.feature-card .icon {
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 24px;
}

/* ── Toast Notification ─────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast-wa {
  background: #323232;
  color: #fff;
  border-radius: var(--wa-radius);
  padding: 12px 20px;
  font-size: 14px;
  box-shadow: var(--wa-shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  max-width: 360px;
  pointer-events: auto;
  animation: toastIn .3s ease;
}
.toast-wa.success { background: #1e6c48; }
.toast-wa.error   { background: #9b1c1c; }
.toast-wa.warning { background: #78350f; }

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

/* ── Loading Spinner ────────────────────────────────────────── */
.spinner-wa {
  width: 40px;
  height: 40px;
  border: 3px solid var(--wa-border);
  border-top-color: var(--wa-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

/* ── Profile Page ───────────────────────────────────────────── */
.profile-cover {
  height: 200px;
  background: linear-gradient(135deg, var(--wa-primary), var(--wa-teal));
  border-radius: var(--wa-radius-lg) var(--wa-radius-lg) 0 0;
  position: relative;
}
.profile-avatar-wrap {
  position: absolute;
  bottom: -50px;
  left: 32px;
}
.profile-avatar-wrap .avatar-xxl {
  border: 4px solid var(--wa-panel-bg);
  box-shadow: var(--wa-shadow);
}

/* ── Dark Mode Toggle ───────────────────────────────────────── */
.dark-toggle {
  background: none;
  border: none;
  color: var(--wa-text-white);
  font-size: 20px;
  padding: 6px;
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.dark-toggle:hover { background: rgba(255,255,255,.15); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .auth-card { padding: 28px 20px; }
}
