/* Secure Chat - SaaS Professional Design */
/* Clean, modern, functional */

:root {
  --bg-primary: #0c0c0c;
  --bg-secondary: #141414;
  --bg-tertiary: #1c1c1c;
  --bg-hover: #242424;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border-color: #27272a;
  --border-hover: #3f3f46;
  --accent: #22c55e;
  --accent-hover: #16a34a;
  --accent-bg: rgba(34, 197, 94, 0.1);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

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

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

.hidden { display: none !important; }

/* LANDING PAGE */
.page {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.hero {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.hero h1 {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  line-height: 1.1;
}

.hero h1 span {
  color: var(--accent);
}

.tagline {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-weight: 500;
}

.description {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 40px;
  line-height: 1.6;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 48px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 200ms ease;
  background: var(--bg-secondary);
  color: var(--text-primary);
  text-decoration: none;
  font-family: inherit;
}

.btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-tertiary);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-secondary {
  background: transparent;
  border-color: var(--border-color);
}

.btn-danger {
  color: var(--error);
  border-color: var(--error);
  background: transparent;
}

.btn-danger:hover {
  background: var(--error-bg);
}

.btn-small {
  padding: 10px 20px;
  font-size: 13px;
}

/* Features Grid */
.features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: left;
}

.feature-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

.feature-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.feature-text strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 2px;
}

/* WAITING STATE */
.waiting-container {
  text-align: center;
  padding: 60px 20px;
}

.waiting-container h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 12px;
}

.waiting-container p {
  color: var(--text-muted);
  margin-bottom: 32px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 32px;
}

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

/* PRIVATE ROOM CREATED */
.private-container {
  width: 100%;
  max-width: 480px;
  padding: 40px 20px;
}

.private-container h2 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
  text-align: center;
}

.private-container > p {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 32px;
}

.invite-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.invite-section label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.invite-box {
  display: flex;
  gap: 8px;
}

.invite-box input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: monospace;
}

.invite-box input:focus {
  outline: none;
  border-color: var(--border-hover);
}

.waiting-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.waiting-status .dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* CHAT INTERFACE */
#chat.page {
  padding: 0;
}

.chat-container {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  height: 72px;
}

.chat-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  background: var(--bg-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
}

.chat-details h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-status {
  font-size: 13px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

/* Message Bubbles */
.message {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  animation: messageIn 200ms ease;
}

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

.message.own {
  align-self: flex-end;
  background: var(--accent);
  color: #000;
  border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
}

.message.other {
  align-self: flex-start;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 4px;
}

.message-content {
  word-wrap: break-word;
}

.message-time {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 4px;
  text-align: right;
}

.message.own .message-time {
  color: rgba(0, 0, 0, 0.6);
}

.message.other .message-time {
  color: var(--text-muted);
}

/* System Messages */
.message-system {
  align-self: center;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* Chat Input Area */
.chat-input-area {
  padding: 16px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.chat-input-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  transition: border-color 200ms ease;
}

.chat-input-wrapper:focus-within {
  border-color: var(--border-hover);
  background: var(--bg-secondary);
}

#message-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  resize: none;
  min-height: 24px;
  max-height: 120px;
  outline: none;
  padding: 0;
}

#message-input::placeholder {
  color: var(--text-muted);
}

.btn-send {
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms ease;
  flex-shrink: 0;
}

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

.btn-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 24px 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.typing-indicator .dots {
  display: flex;
  gap: 3px;
}

.typing-indicator .dots span {
  width: 4px;
  height: 4px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator .dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Error Page */
.error-container {
  text-align: center;
  padding: 60px 20px;
}

.error-container h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--error);
  margin-bottom: 12px;
}

.error-container p {
  color: var(--text-muted);
  margin-bottom: 32px;
}

.error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 40px;
  }
  
  .features {
    grid-template-columns: 1fr;
  }
  
  .message {
    max-width: 85%;
  }
  
  .chat-header,
  .chat-messages,
  .chat-input-area {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Empty state */
.empty-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.empty-chat h3 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-chat p {
  font-size: 14px;
}


/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 14px;
    margin-top: auto;
}

.footer p {
    margin: 0;
}
