/* $Id$ */

/**
 * @file
 * Styles for Simple Chat module.
 */

/* Chat Widget - Main Container */
#simple-chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Chat Button */
.simple-chat-button {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.simple-chat-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.simple-chat-button img {
  width: 40px;
  height: 40px;
}

.simple-chat-button-active {
  transform: scale(0.9);
}

/* Chat Window */
.simple-chat-window {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 380px;
  height: 600px;
  max-height: calc(100vh - 100px);
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
}

/* Chat Header */
.simple-chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  flex: 0 0 auto;
}

.simple-chat-title {
  font-size: 16px;
}

.simple-chat-close {
  font-size: 28px;
  line-height: 20px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.simple-chat-close:hover {
  opacity: 1;
}

/* Messages Container */
.simple-chat-messages {
  flex: 1 1 0%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  background: #f5f5f5;
  height: 450px;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .simple-chat-messages {
    height: 400px;
  }
}

@media (max-width: 480px) {
  .simple-chat-messages {
    height: 350px;
  }
}

/* Individual Message */
.simple-chat-message {
  margin-bottom: 16px;
  animation: slideIn 0.3s ease;
}

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

.simple-chat-message-sender {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #555;
}

.simple-chat-message-text {
  background: white;
  padding: 10px 14px;
  border-radius: 12px;
  word-wrap: break-word;
  line-height: 1.4;
  font-size: 14px;
  color: #333;
}

.simple-chat-message-time {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

/* User Message */
.user-message .simple-chat-message-sender {
  text-align: right;
  color: #667eea;
}

.user-message .simple-chat-message-text {
  background: #667eea;
  color: white;
  margin-left: 40px;
  border-bottom-right-radius: 4px;
}

.user-message .simple-chat-message-time {
  text-align: right;
}

/* Admin Message */
.admin-message .simple-chat-message-text {
  background: white;
  margin-right: 40px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* System Message */
.system-message {
  text-align: center;
}

.system-message .simple-chat-message-text {
  background: #e3f2fd;
  color: #1976d2;
  display: inline-block;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 16px;
}

/* Input Area */
.simple-chat-input-area {
  display: flex;
  padding: 12px 16px;
  background: white;
  border-top: 1px solid #e0e0e0;
  flex: 0 0 auto;
}

.simple-chat-input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.simple-chat-input:focus {
  border-color: #667eea;
}

.simple-chat-send {
  margin-left: 8px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.simple-chat-send:hover {
  background: #5568d3;
}

.simple-chat-send:active {
  transform: scale(0.98);
}

/* Scrollbar Styling */
.simple-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.simple-chat-messages::-webkit-scrollbar-track {
  background: #f0f0f0;
}

.simple-chat-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.simple-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Admin Interface Styles */
.simple-chat-admin-session {
  max-width: 800px;
  margin: 20px auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 24px;
}

.simple-chat-admin-session h3 {
  margin-top: 0;
  color: #333;
  border-bottom: 2px solid #667eea;
  padding-bottom: 12px;
}

.simple-chat-session-info {
  background: #f5f5f5;
  padding: 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.8;
}

.simple-chat-admin-messages {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 20px;
  background: #fafafa;
  max-height: 500px;
  overflow-y: scroll;
  overflow-x: hidden;
  margin-bottom: 20px;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.simple-chat-admin-input {
  display: flex;
  flex-direction: column;
}

.simple-chat-admin-input textarea {
  width: 100%;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.simple-chat-admin-input textarea:focus {
  border-color: #667eea;
}

#simple-chat-admin-send {
  align-self: flex-end;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#simple-chat-admin-send:hover {
  background: #5568d3;
}

#simple-chat-admin-send:active {
  transform: scale(0.98);
}

/* Responsive Design */
@media (max-width: 768px) {
  .simple-chat-window {
    width: 340px;
    height: 550px;
  }
  
  #simple-chat-widget {
    bottom: 10px;
    right: 10px;
  }
  
  .simple-chat-button {
    width: 45px;
    height: 45px;
  }
  
  .simple-chat-button img {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 480px) {
  .simple-chat-window {
    width: calc(100vw - 40px);
    height: 500px;
    right: -10px;
  }
}
