* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

/* Login Page Styles */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 400px;
  animation: slideUp 0.5s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-box h1 {
  color: #667eea;
  text-align: center;
  margin-bottom: 10px;
  font-size: 28px;
}

.subtitle {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-weight: 600;
  font-size: 14px;
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
  text-decoration: none;
  display: block;
  text-align: center;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.login-footer {
  margin-top: 30px;
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

.login-footer p {
  margin: 5px 0;
  font-size: 12px;
  color: #666;
}

.login-footer a {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* Chat Page Styles */
.chat-container {
  display: flex;
  height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  background: white;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: #2c3e50;
  color: white;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px;
  background: #34495e;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h2 {
  font-size: 18px;
}

.user-count {
  background: #667eea;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
}

.user-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.user-item {
  padding: 12px;
  margin-bottom: 8px;
  background: #34495e;
  border-radius: 8px;
  transition: background 0.2s;
}

.user-item:hover {
  background: #3d566e;
}

.user-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.user-item small {
  color: #bdc3c7;
  font-size: 12px;
}

.sidebar-footer {
  padding: 20px;
  background: #1a252f;
  border-top: 1px solid #34495e;
}

.current-user {
  margin-bottom: 15px;
  padding: 12px;
  background: #34495e;
  border-radius: 8px;
}

.current-user strong {
  display: block;
  margin-bottom: 4px;
  color: #667eea;
}

.current-user small {
  color: #bdc3c7;
  font-size: 12px;
}

.btn-logout {
  width: 100%;
  padding: 10px;
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  text-decoration: none;
  display: block;
  text-align: center;
}

.btn-logout:hover {
  background: #c0392b;
}

/* Main Chat Area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f5f7fa;
}

.chat-header {
  padding: 20px 30px;
  background: white;
  border-bottom: 2px solid #e0e0e0;
}

.chat-header h1 {
  color: #2c3e50;
  font-size: 24px;
  margin-bottom: 5px;
}

.chat-header p {
  color: #7f8c8d;
  font-size: 14px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 30px;
}

/* Message Styles */
.message {
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
}

.message-author {
  font-weight: 600;
  color: #667eea;
  font-size: 14px;
}

.message-kelas {
  background: #e8eaf6;
  color: #667eea;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.message-time {
  color: #95a5a6;
  font-size: 12px;
  margin-left: auto;
}

.copy-message-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
  opacity: 0;
  transition: all 0.2s;
  margin-left: 8px;
}

.message:hover .copy-message-btn {
  opacity: 1;
}

.copy-message-btn:hover {
  background: #f0f0f0;
}

.copy-message-btn.copied {
  background: #4caf50;
}

.copy-message-btn.copied .copy-icon {
  animation: pulse 0.3s ease;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.message-content {
  background: white;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  max-width: 70%;
  word-wrap: break-word;
}

.message-text {
  color: #2c3e50;
  line-height: 1.5;
  font-size: 14px;
}

.message-file {
  margin-top: 10px;
}

.file-preview-img {
  max-width: 300px;
  max-height: 300px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.file-preview-img:hover {
  transform: scale(1.02);
}

.file-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  background: #667eea;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
  transition: background 0.2s;
}

.file-download:hover {
  background: #5568d3;
}

/* System Messages */
.system-message {
  text-align: center;
  margin: 15px 0;
  padding: 8px;
  background: #ecf0f1;
  border-radius: 20px;
  font-size: 13px;
  color: #7f8c8d;
}

/* Chat Input */
.chat-input-container {
  display: flex;
  gap: 10px;
  padding: 20px 30px;
  background: white;
  border-top: 2px solid #e0e0e0;
}

.btn-attach {
  padding: 12px 16px;
  background: #95a5a6;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s;
}

.btn-attach:hover {
  background: #7f8c8d;
}

#messageInput {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.3s;
  resize: none;
  min-height: 44px;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.5;
}

#messageInput:focus {
  outline: none;
  border-color: #667eea;
}

.btn-send {
  padding: 12px 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-send:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* File Preview */
.file-preview {
  padding: 10px 30px;
  background: #e8eaf6;
  border-top: 1px solid #c5cae9;
  display: flex;
  align-items: center;
  gap: 10px;
}

#fileName {
  flex: 1;
  color: #667eea;
  font-size: 13px;
  font-weight: 600;
}

.btn-cancel {
  background: #e74c3c;
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
}

.btn-cancel:hover {
  background: #c0392b;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #bdc3c7;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #95a5a6;
}

/* Code Block Styles */
.code-block {
  margin: 10px 0;
  border-radius: 8px;
  overflow: hidden;
  background: #1e1e1e;
  border: 1px solid #333;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #2d2d2d;
  border-bottom: 1px solid #333;
}

.code-language {
  color: #9cdcfe;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.copy-code-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: #3c3c3c;
  color: #fff;
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.copy-code-btn:hover {
  background: #4c4c4c;
  border-color: #667eea;
}

.copy-code-btn.copied {
  background: #4caf50;
  border-color: #4caf50;
}

.copy-icon {
  font-size: 14px;
}

.code-block pre {
  margin: 0;
  padding: 15px;
  overflow-x: auto;
  background: #1e1e1e;
}

.code-block code {
  color: #d4d4d4;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
  display: block;
}

.inline-code {
  background: #f4f4f4;
  color: #e83e8c;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  border: 1px solid #e0e0e0;
}

/* Scrollbar untuk code block */
.code-block pre::-webkit-scrollbar {
  height: 8px;
}

.code-block pre::-webkit-scrollbar-track {
  background: #2d2d2d;
}

.code-block pre::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

.code-block pre::-webkit-scrollbar-thumb:hover {
  background: #666;
}

/* Chat Footer */
.chat-footer {
  padding: 10px 30px;
  background: white;
  border-top: 1px solid #e0e0e0;
  text-align: center;
}

.chat-footer p {
  margin: 0;
  font-size: 12px;
  color: #666;
}

.chat-footer a {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
}

.chat-footer a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 200px;
  }
  
  .message-content {
    max-width: 90%;
  }
  
  .chat-input-container {
    padding: 15px;
  }
  
  .code-block code {
    font-size: 12px;
  }
  
  .chat-footer {
    padding: 10px 15px;
  }
  
  .chat-footer p {
    font-size: 11px;
  }
}
