@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-app: #0b141a;
  --bg-sidebar: #111b21;
  --bg-sidebar-hover: #202c33;
  --bg-sidebar-active: #2a3942;
  --bg-chat-header: #202c33;
  --bg-chat-body: #0b141a;
  --bg-chat-input: #202c33;
  --bg-modal: #222e35;
  --bg-input: #2a3942;
  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-muted: #667781;
  --accent-green: #00a884;
  --accent-blue: #53bdeb;
  --bubble-outgoing: #005c4b;
  --bubble-incoming: #202c33;
  --border-color: #222d34;
  --danger-color: #f15c6d;
  --panel-width-right: 360px;
  
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: #0c1317;
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* App Container */
.app-container {
  display: flex;
  width: 100%;
  height: 100%;
  background-color: var(--bg-app);
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}

@media (min-width: 1440px) {
  .app-container {
    width: 95%;
    height: 92%;
    border-radius: 12px;
    border: 1px solid var(--border-color);
  }
  body {
    background: radial-gradient(circle at 50% 50%, #1c2e36 0%, #0c1317 100%);
  }
}

/* Sidebar Styling */
.sidebar {
  width: 30%;
  min-width: 320px;
  max-width: 450px;
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
}

.sidebar-header {
  height: 60px;
  background-color: var(--bg-chat-header);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-green) 0%, #00d2a4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(0, 168, 132, 0.3);
}

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

.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

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

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

.icon-btn.active {
  color: var(--accent-green);
  background-color: rgba(0, 168, 132, 0.1);
}

/* Sidebar Search */
.sidebar-search {
  padding: 8px 12px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
}

.search-container {
  display: flex;
  align-items: center;
  background-color: var(--bg-input);
  padding: 6px 12px;
  border-radius: 8px;
  gap: 10px;
}

.search-container i {
  color: var(--text-muted);
  font-size: 14px;
}

.search-input {
  background: none;
  border: none;
  color: var(--text-primary);
  width: 100%;
  font-size: 14px;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* Chat List */
.chat-list {
  flex: 1;
  overflow-y: auto;
}

.chat-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition-smooth);
  border-bottom: 1px solid rgba(34, 45, 52, 0.5);
  gap: 12px;
}

.chat-item:hover {
  background-color: var(--bg-sidebar-hover);
}

.chat-item.active {
  background-color: var(--bg-sidebar-active);
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
  text-transform: uppercase;
}

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

.chat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

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

.chat-time {
  font-size: 12px;
  color: var(--text-muted);
}

.chat-msg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.chat-msg-snippet {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.chat-ticks {
  margin-right: 4px;
  font-size: 14px;
}

.tick-sent { color: var(--text-muted); }
.tick-delivered { color: var(--text-muted); }
.tick-read { color: var(--accent-blue); }

.unread-badge {
  background-color: var(--accent-green);
  color: #0b141a;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

/* Chat Area Styling */
.chat-window {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-chat-body);
  position: relative;
  overflow: hidden;
}

.chat-window::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.05;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Cpath fill-rule='evenodd' d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm1-61c3.16 0 6-2.84 6-6s-2.84-6-6-6-6 2.84-6 6 2.84 6 6 6zm-.667 30C26.543 59 21 53.457 21 46.667c0-6.79 5.543-12.334 12.333-12.334C40.124 34.333 45.667 39.876 45.667 46.667c0 6.79-5.543 12.333-12.334 12.333zm0-20.667c-4.602 0-8.333 3.73-8.333 8.334 0 4.602 3.731 8.333 8.333 8.333 4.602 0 8.334-3.731 8.334-8.333 0-4.603-3.732-8.334-8.334-8.334z'/%3E%3C/g%3E%3C/svg%3E");
}

/* Chat Welcome Screen */
.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  background-color: #222e35;
  border-bottom: 6px solid var(--accent-green);
  z-index: 1;
}

.welcome-illustration {
  font-size: 96px;
  color: var(--accent-green);
  margin-bottom: 24px;
  opacity: 0.8;
  filter: drop-shadow(0 4px 16px rgba(0, 168, 132, 0.2));
  animation: float 4s ease-in-out infinite;
}

.welcome-title {
  font-size: 32px;
  font-weight: 400;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.welcome-desc {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 480px;
  line-height: 1.6;
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 30px;
  padding: 6px 12px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Chat Header */
.chat-header {
  height: 60px;
  background-color: var(--bg-chat-header);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  cursor: pointer;
}

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

.active-chat-status {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 8%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1;
}

.message-bubble {
  max-width: 65%;
  padding: 8px 12px 6px 12px;
  border-radius: 8px;
  font-size: 14.5px;
  line-height: 1.5;
  position: relative;
  word-wrap: break-word;
  animation: slideBubble 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.message-incoming {
  align-self: flex-start;
  background-color: var(--bubble-incoming);
  color: var(--text-primary);
  border-top-left-radius: 0;
}

.message-outgoing {
  align-self: flex-end;
  background-color: var(--bubble-outgoing);
  color: var(--text-primary);
  border-top-right-radius: 0;
}

.message-sender {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 3px;
  display: block;
}

.message-meta {
  display: inline-flex;
  align-items: center;
  float: right;
  margin-left: 12px;
  margin-top: 4px;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.45);
  user-select: none;
}

.message-meta i {
  margin-left: 4px;
  font-size: 14px;
}

.message-date-separator {
  align-self: center;
  background-color: rgba(17, 27, 33, 0.85);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 16px 0 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  z-index: 1;
}

/* Chat Input Area */
.chat-input-area {
  min-height: 60px;
  background-color: var(--bg-chat-input);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
}

.input-container {
  flex: 1;
  background-color: var(--bg-input);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
}

.chat-input {
  width: 100%;
  background: none;
  border: none;
  color: var(--text-primary);
  outline: none;
  font-size: 15px;
  max-height: 120px;
  resize: none;
}

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

.send-btn {
  background-color: var(--accent-green);
  color: #0b141a;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 2px 8px rgba(0, 168, 132, 0.2);
}

.send-btn:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

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

/* Right Detail Panels (Simulator & Settings) */
.slide-panel {
  width: var(--panel-width-right);
  height: 100%;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: absolute;
  right: calc(-1 * var(--panel-width-right));
  top: 0;
  z-index: 20;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.3);
}

.slide-panel.open {
  transform: translateX(calc(-1 * var(--panel-width-right)));
}

.panel-header {
  height: 60px;
  background-color: var(--bg-chat-header);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-green);
}

.form-input {
  background-color: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: var(--transition-smooth);
}

.form-input:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.15);
}

.form-input::placeholder {
  color: var(--text-muted);
}

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

.help-code {
  font-family: monospace;
  background-color: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--accent-blue);
  word-break: break-all;
}

.primary-btn {
  background-color: var(--accent-green);
  color: #0b141a;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-btn:hover {
  filter: brightness(1.1);
}

.primary-btn:active {
  transform: scale(0.98);
}

.secondary-btn {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.secondary-btn:hover {
  background-color: var(--bg-sidebar-hover);
}

/* Status Notifications */
.toast-notification {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background-color: var(--bg-modal);
  border-left: 4px solid var(--accent-green);
  padding: 12px 20px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.3s;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.toast-error {
  border-left-color: var(--danger-color);
}

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

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Keyframes Animations */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes popIn {
  0% { transform: scale(0); }
  90% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

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

/* Responsive adjustment */
@media (max-width: 900px) {
  .sidebar {
    width: 35%;
  }
  .slide-panel {
    width: 100%;
    right: -100%;
  }
  .slide-panel.open {
    transform: translateX(-100%);
  }
}

@media (max-width: 600px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    max-width: none;
    height: 40%;
  }
  .chat-window {
    height: 60%;
  }
  .message-bubble {
    max-width: 85%;
  }
}
