* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #0a0a0f;
  --glass-bg: rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.08);
  --accent: #6c63ff;
  --accent-glow: rgba(108,99,255,0.3);
  --green: #00e676;
  --red: #ff5252;
  --yellow: #ffd740;
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.7);
  --text-muted: rgba(255,255,255,0.4);
  --msg-sent: rgba(108,99,255,0.15);
  --msg-received: rgba(255,255,255,0.06);
}

body {
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  overflow: hidden;
}

/* Background Animation */
.bg-animation {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  overflow: hidden;
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #6c63ff, #3f51b5);
  top: -100px; left: -100px;
}

.orb-2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #00e676, #1b5e20);
  bottom: -50px; right: -80px;
  animation-delay: -7s;
}

.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #ff6b6b, #c0392b);
  top: 50%; left: 50%;
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(50px, -30px) scale(1.1); }
  50% { transform: translate(-30px, 50px) scale(0.9); }
  75% { transform: translate(30px, 30px) scale(1.05); }
}

/* Container */
.container {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  padding: 16px;
}

.chat-container {
  padding: 0;
}

/* Glass Card */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.lock-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Status Grid */
.status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.05);
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.red { background: var(--red); box-shadow: 0 0 6px var(--red); }
.status-dot.yellow { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }

/* Login Section */
.login-section {
  margin-bottom: 16px;
  text-align: left;
}

.login-section label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.user-select {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.user-btn {
  flex: 1;
  padding: 14px 10px;
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-family: inherit;
}

.user-btn:hover {
  background: rgba(108,99,255,0.1);
  border-color: rgba(108,99,255,0.3);
}

.user-btn.selected {
  background: rgba(108,99,255,0.15);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 0 16px var(--accent-glow);
}

.user-emoji {
  font-size: 28px;
}

input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: white;
  font-size: 15px;
  outline: none;
  transition: border-color 0.3s;
  font-family: inherit;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

#login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 12px;
  font-family: inherit;
}

#login-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

#login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error-text {
  color: var(--red);
  font-size: 13px;
  margin-top: 8px;
  text-align: center;
}

.footer-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 20px;
  line-height: 1.5;
}

/* Loading Screen */
.loading-card {
  max-width: 460px;
}

.loading-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: lockPulse 1.5s ease-in-out infinite;
}

@keyframes lockPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.loading-steps {
  text-align: left;
  margin: 20px 0;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  margin-bottom: 2px;
  border-radius: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.2);
  transition: all 0.4s ease;
}

.loading-step.active {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.03);
}

.loading-step.done {
  color: var(--green);
}

.step-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: transparent;
  border-radius: 50%;
  flex-shrink: 0;
}

.loading-step.active .step-spinner {
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.loading-step.done .step-spinner {
  border: none;
  animation: none;
}

.loading-step.done .step-spinner::after {
  content: "✓";
  font-size: 13px;
  font-weight: bold;
  color: var(--green);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-bar-container {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 14px;
}

.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.loading-percent {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ============================================
   CHAT SCREEN
   ============================================ */

.chat-wrapper {
  width: 100%;
  max-width: 600px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  background: rgba(0,0,0,0.3);
  border-left: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.partner-avatar {
  width: 40px; height: 40px;
  background: rgba(108,99,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 2px solid rgba(108,99,255,0.3);
}

.partner-info {
  display: flex;
  flex-direction: column;
}

.partner-name {
  font-size: 15px;
  font-weight: 600;
}

.partner-status {
  font-size: 11px;
  color: var(--text-muted);
}

.partner-status.online {
  color: var(--green);
}

.partner-status.typing {
  color: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.encryption-badge {
  font-size: 11px;
  padding: 4px 10px;
  background: rgba(0,230,118,0.1);
  border: 1px solid rgba(0,230,118,0.2);
  border-radius: 12px;
  color: var(--green);
}

.header-btn {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.header-btn:hover {
  background: rgba(255,82,82,0.15);
  border-color: rgba(255,82,82,0.3);
}

/* Messages Area */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
}

.messages-area::-webkit-scrollbar {
  width: 4px;
}

.messages-area::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

.empty-chat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-sub {
  font-size: 12px;
  margin-top: 4px;
  color: var(--text-muted);
}

/* Date Separator */
.date-separator {
  text-align: center;
  margin: 12px 0;
}

.date-separator span {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 4px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
}

/* Messages */
.message {
  display: flex;
  margin-bottom: 2px;
}

.message.sent {
  justify-content: flex-end;
}

.message.received {
  justify-content: flex-start;
}

.msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  position: relative;
  word-wrap: break-word;
}

.message.sent .msg-bubble {
  background: var(--msg-sent);
  border: 1px solid rgba(108,99,255,0.15);
  border-bottom-right-radius: 6px;
}

.message.received .msg-bubble {
  background: var(--msg-received);
  border: 1px solid rgba(255,255,255,0.06);
  border-bottom-left-radius: 6px;
}

.msg-text {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-primary);
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
}

.msg-time {
  font-size: 10px;
  color: var(--text-muted);
}

.msg-status {
  font-size: 12px;
  font-weight: 600;
}

.msg-status.sent {
  color: var(--text-muted);
}

.msg-status.delivered {
  color: var(--text-secondary);
}

.msg-status.read {
  color: #4fc3f7;
}

/* Input Area */
.input-area {
  padding: 10px 16px 16px;
  background: rgba(255,255,255,0.02);
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
}

.input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 14px;
  color: white;
  outline: none;
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  flex-shrink: 0;
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 12px var(--accent-glow);
}

.send-btn:active {
  transform: scale(0.95);
}

/* Mobile Adjustments */
@media (max-width: 640px) {
  .chat-wrapper {
    max-width: 100%;
    border: none;
  }

  .glass-card {
    padding: 28px 20px;
    border-radius: 20px;
  }

  .msg-bubble {
    max-width: 85%;
  }
}
/* ============================================
   MEDIA & VOICE STYLES
   ============================================ */

.attach-btn, .voice-btn {
  width: 36px; height: 36px;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  flex-shrink: 0;
}

.attach-btn:hover, .voice-btn:hover {
  background: rgba(255,255,255,0.08);
}

.voice-btn.recording {
  background: rgba(255,82,82,0.2);
  animation: recordPulse 1s ease-in-out infinite;
}

@keyframes recordPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,82,82,0.3); }
  50% { box-shadow: 0 0 0 10px rgba(255,82,82,0); }
}

/* Upload Preview */
.upload-preview {
  margin-top: 10px;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
}

.preview-content img {
  max-width: 200px;
  max-height: 150px;
  border-radius: 10px;
  object-fit: cover;
}

.preview-content .file-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
}

.file-preview-icon {
  font-size: 28px;
}

.file-preview-info {
  font-size: 12px;
  color: var(--text-secondary);
}

.file-preview-name {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.preview-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}

.preview-cancel {
  padding: 6px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.preview-send {
  padding: 6px 16px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* Recording Indicator */
.recording-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin-top: 8px;
  background: rgba(255,82,82,0.08);
  border: 1px solid rgba(255,82,82,0.15);
  border-radius: 12px;
  font-size: 13px;
  color: var(--red);
}

.recording-dot {
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Media in Messages */
.msg-image {
  max-width: 260px;
  max-height: 300px;
  border-radius: 12px;
  cursor: pointer;
  object-fit: cover;
  display: block;
  margin-bottom: 4px;
}

.msg-image:hover {
  opacity: 0.9;
}

.msg-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 4px;
  text-decoration: none;
  color: inherit;
}

.msg-file:hover {
  background: rgba(255,255,255,0.08);
}

.msg-file-icon {
  font-size: 24px;
}

.msg-file-name {
  font-size: 13px;
  color: var(--text-primary);
}

.msg-file-size {
  font-size: 11px;
  color: var(--text-muted);
}

/* Voice Message */
.msg-voice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  min-width: 180px;
}

.voice-play-btn {
  width: 34px; height: 34px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.voice-waveform {
  flex: 1;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.voice-bar {
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.5;
}

.voice-duration {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Image Lightbox */
.lightbox {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 8px;
}

/* Deleted message style */
.msg-bubble.deleted {
  opacity: 0.5;
  font-style: italic;
}

.msg-bubble.deleted .msg-text {
  color: var(--text-muted);
}