/**
 * Qubic.id - Messages Panel & Header Notification Styles
 * Path: /assets/css/messages.css
 */

/* ==========================================================================
   1. Header Envelope Icon & Notification Badge
   ========================================================================== */
.qubic-msg-btn {
  height: 31px;
  min-width: 42px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  position: relative;
  transition: all 0.2s ease-in-out;
  text-decoration: none;
  font-size: 0.95rem;
}

.qubic-msg-btn:hover {
  background: rgba(0, 229, 255, 0.15);
  border-color: #00e5ff;
  color: #00e5ff;
}

.qubic-msg-badge {
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #080c14;
  box-shadow: 0 0 6px rgba(220, 53, 69, 0.6);
}

/* ==========================================================================
   2. Main Layout Container
   ========================================================================== */
.messages-page-wrapper {
  min-height: calc(100vh - 140px);
  padding: 1.5rem 0 3rem;
}

.messages-layout-card {
  background: #0b111e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  height: 780px;
  display: flex;
}

@media (max-width: 991.98px) {
  .messages-layout-card {
    height: auto;
    flex-direction: column;
  }
}

/* ==========================================================================
   3. Left Sidebar: Conversations
   ========================================================================== */
.messages-sidebar {
  width: 360px;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  background: #080d17;
}

@media (max-width: 991.98px) {
  .messages-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    max-height: 380px;
  }
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.sidebar-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.3px;
}

.btn-new-message {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  background: linear-gradient(135deg, #00e5ff 0%, #0072ff 100%);
  color: #000000;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: opacity 0.2s ease, transform 0.1s ease;
}

.btn-new-message:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  color: #000000;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0.5rem;
}

.conversation-list::-webkit-scrollbar {
  width: 6px;
}

.conversation-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.conversation-item {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid transparent;
  color: #cbd5e1;
  text-decoration: none;
}

.conversation-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.conversation-item.active {
  background: rgba(0, 229, 255, 0.08);
  border-color: rgba(0, 229, 255, 0.25);
  color: #ffffff;
}

.conversation-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.2), rgba(0, 114, 255, 0.2));
  border: 1px solid rgba(0, 229, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #00e5ff;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.2rem;
}

.conversation-partner {
  font-weight: 600;
  font-size: 0.9rem;
  color: #f1f5f9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-time {
  font-size: 0.72rem;
  color: #64748b;
  flex-shrink: 0;
}

.conversation-preview {
  font-size: 0.8rem;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
}

.conversation-item.unread .conversation-partner {
  color: #00e5ff;
  font-weight: 700;
}

.conversation-item.unread .conversation-preview {
  color: #ffffff;
  font-weight: 600;
}

.unread-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  background: #00e5ff;
  color: #000000;
}

.conversation-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
}

/* ==========================================================================
   4. Right Chat Area
   ========================================================================== */
.messages-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0b111e;
  position: relative;
  min-width: 0;
}

.chat-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 13, 23, 0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.chat-partner-details {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.chat-partner-name {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.chat-partner-wallet {
  font-size: 0.75rem;
  color: #94a3b8;
  letter-spacing: 0.5px;
  word-break: break-all;
}

.chat-partner-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(0, 229, 255, 0.12);
  color: #00e5ff;
  border: 1px solid rgba(0, 229, 255, 0.25);
  font-weight: 600;
}

/* Message Feed */
.chat-messages-feed {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-messages-feed::-webkit-scrollbar {
  width: 6px;
}

.chat-messages-feed::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.chat-empty-state {
  margin: auto;
  text-align: center;
  color: #64748b;
  max-width: 380px;
  padding: 2rem;
}

.chat-empty-icon {
  font-size: 3rem;
  color: rgba(0, 229, 255, 0.4);
  margin-bottom: 1rem;
}

/* Bubbles */
.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

.msg-row.sent {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-row.received {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-bubble {
  padding: 0.85rem 1.15rem;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}

.msg-row.sent .msg-bubble {
  background: linear-gradient(135deg, #0072ff 0%, #00b4d8 100%);
  color: #ffffff;
  border-bottom-right-radius: 3px;
  box-shadow: 0 4px 15px rgba(0, 114, 255, 0.25);
}

.msg-row.received .msg-bubble {
  background: #141c2e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-bottom-left-radius: 3px;
}

.msg-meta-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: #64748b;
}

.msg-row.sent .msg-meta-bar {
  justify-content: flex-end;
}

.msg-ardrive-link {
  color: #00e5ff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: color 0.15s ease;
}

.msg-ardrive-link:hover {
  color: #67e8f9;
  text-decoration: underline;
}

.msg-cost-tag {
  color: #94a3b8;
}

/* ==========================================================================
   5. Composer / Input Section
   ========================================================================== */
.chat-composer-box {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 13, 23, 0.75);
}

/* Manuel Alıcı Inputu (Yeni Mesaj İçin) */
.receiver-input-group {
  margin-bottom: 0.85rem;
}

.receiver-input-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 0.35rem;
  display: flex;
  justify-content: space-between;
}

.receiver-input-field {
  background: #121927;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #ffffff;
  font-family: monospace;
  font-size: 0.85rem;
  padding: 0.55rem 0.85rem;
  letter-spacing: 0.5px;
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.receiver-input-field:focus {
  outline: none;
  border-color: #00e5ff;
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15);
  background: #151d2d;
  color: #ffffff;
}

.receiver-input-field::placeholder {
  color: #475569;
}

.receiver-input-field.is-valid {
  border-color: #10b981;
}

.receiver-input-field.is-invalid {
  border-color: #ef4444;
}

/* Mesaj Textarea */
.message-textarea {
  background: #121927;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #ffffff;
  font-size: 0.92rem;
  padding: 0.75rem 1rem;
  width: 100%;
  resize: none;
  min-height: 75px;
  max-height: 160px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.message-textarea:focus {
  outline: none;
  border-color: #00e5ff;
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15);
  background: #151d2d;
  color: #ffffff;
}

.message-textarea::placeholder {
  color: #64748b;
}

/* Composer Alt Bilgi ve Buton */
.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.composer-stats-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: #94a3b8;
  flex-wrap: wrap;
}

.composer-stat-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.composer-stat-highlight {
  color: #00e5ff;
  font-weight: 700;
}

.btn-send-message {
  padding: 0.55rem 1.4rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  background: linear-gradient(135deg, #00e5ff 0%, #0072ff 100%);
  color: #000000;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: opacity 0.2s ease, transform 0.1s ease;
}

.btn-send-message:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
  color: #000000;
}

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

/* Alert / Warning Boxes */
.messages-alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.messages-alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #f59e0b;
}

.messages-alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #ef4444;
}

.messages-alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #10b981;
}

/* User Wallet Overview Card (Header of Messages Page) */
.user-overview-strip {
  background: #0b111e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.user-strip-wallet {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-strip-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #00e5ff 0%, #0072ff 100%);
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.user-strip-info {
  display: flex;
  flex-direction: column;
}

.user-strip-title {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 0;
}

.user-strip-address {
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
}

.user-strip-balances {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.user-balance-block {
  text-align: right;
}

.user-balance-label {
  font-size: 0.72rem;
  color: #64748b;
  margin: 0;
}

.user-balance-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #00e5ff;
  margin: 0;
}