/* chatroom.css - Full Page Chat Room */

body, html {
  margin: 0;
  padding: 0;
  height: 100%;
}

.cr-main {
  height: calc(100vh - 70px); /* Adjust for header height */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
  background-image: url('assets/img/bg-circle.png');
  background-size: cover;
  background-position: center;
}

.cr-container {
  width: 100%;
  max-width: 1200px;
  height: 100%;
  background: rgba(20, 15, 30, 0.85);
  backdrop-filter: blur(15px);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Sidebar */
.cr-sidebar {
  width: 320px;
  background: rgba(10, 5, 20, 0.9);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.cr-sidebar-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cr-sidebar-header h2 {
  margin: 0;
  color: white;
  font-size: 20px;
}

.cr-icon-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.cr-icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.cr-tab-bar {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cr-tab {
  flex: 1;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  padding: 15px 0;
  cursor: pointer;
  font-weight: bold;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.cr-tab.active {
  color: #ffd000;
  border-bottom-color: #ffd000;
  background: rgba(255, 208, 0, 0.05);
}

.cr-inbox-list {
  flex: 1;
  overflow-y: auto;
}

.cr-inbox-item {
  display: flex;
  padding: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background 0.2s;
}

.cr-inbox-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.cr-inbox-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  margin-right: 15px;
  object-fit: cover;
  background: #333;
}

.cr-inbox-details {
  flex: 1;
  overflow: hidden;
}

.cr-inbox-name {
  color: white;
  font-weight: bold;
  margin-bottom: 5px;
  font-size: 15px;
}

.cr-inbox-lastmsg {
  color: #aaa;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cr-empty-text {
  padding: 20px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

.cr-global-desc {
  padding: 20px;
  color: #888;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

/* Chat Area */
.cr-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.cr-chat-header {
  padding: 20px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
}

.cr-chat-header h3 {
  margin: 0;
  color: white;
  flex: 1;
  text-align: center;
}

.cr-back-btn {
  background: none;
  border: none;
  color: #ffd000;
  cursor: pointer;
  font-weight: bold;
}

.cr-messages-list {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.cr-loading {
  text-align: center;
  color: #888;
  margin-top: 20px;
}

.cr-msg {
  display: flex;
  max-width: 80%;
}

.cr-msg.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.cr-msg.theirs {
  align-self: flex-start;
}

.cr-msg-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  margin: 0 10px;
  background: #444;
}

.cr-msg-content {
  display: flex;
  flex-direction: column;
}

.cr-msg.mine .cr-msg-content {
  align-items: flex-end;
}

.cr-msg.theirs .cr-msg-content {
  align-items: flex-start;
}

.cr-msg-name {
  font-size: 12px;
  color: #ffd000;
  margin-bottom: 4px;
  font-weight: bold;
}

.cr-msg-bubble {
  background: #3a225c;
  color: white;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.4;
  word-wrap: break-word;
}

.cr-msg.mine .cr-msg-bubble {
  background: #ffd000;
  color: #1a1a1a;
  border-top-right-radius: 4px;
}

.cr-msg.theirs .cr-msg-bubble {
  border-top-left-radius: 4px;
}

.cr-msg-image {
  max-width: 250px;
  border-radius: 12px;
  margin-top: 5px;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.1);
}

.cr-msg-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 5px;
}

/* Input Area */
.cr-input-area {
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 10px;
  align-items: center;
}

.cr-attach-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.cr-attach-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.cr-msg-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  padding: 12px 20px;
  color: white;
  font-size: 15px;
  outline: none;
}

.cr-msg-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.cr-send-btn {
  background: #ffd000;
  color: #2b0054;
  border: none;
  padding: 0 25px;
  height: 45px;
  border-radius: 25px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s;
}

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

/* Modal Overlay */
.cr-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cr-modal {
  background: #1e1528;
  width: 90%;
  max-width: 400px;
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cr-modal h3 {
  color: white;
  margin-top: 0;
  margin-bottom: 20px;
}

.cr-avatar-upload {
  margin-bottom: 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cr-avatar-upload img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #ffd000;
  margin-bottom: 15px;
}

.cr-avatar-upload button {
  background: rgba(255,255,255,0.1);
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 15px;
  cursor: pointer;
}

#crNameInput {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  outline: none;
  font-size: 16px;
  text-align: center;
  box-sizing: border-box;
}

.cr-primary-btn {
  width: 100%;
  background: #ffd000;
  color: #2b0054;
  border: none;
  padding: 15px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
}

/* Image Viewer */
.cr-image-viewer {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cr-close-image {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  cursor: pointer;
}

.cr-image-viewer img {
  max-width: 90%;
  max-height: 90vh;
  border-radius: 8px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .cr-container {
    flex-direction: column;
    border-radius: 0;
  }
  
  .cr-main {
    padding: 0;
    height: calc(100vh - 60px);
  }

  .cr-sidebar {
    width: 100%;
    height: 100%;
  }

  .cr-chat-area {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #140f1e;
    z-index: 5;
    display: none;
  }
  
  .cr-chat-area.active {
    display: flex;
  }
  
  .cr-back-btn {
    display: block !important;
  }
  
  .cr-msg {
    max-width: 90%;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
}
