/* Reset i podstawowe style */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #2c3e50;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

/* Układ ekranów */
.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

/* Kontener główny */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 3rem;
  color: white;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
  font-weight: 300;
}

/* Główna zawartość */
.main-content {
  background: white;
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 2rem;
  align-items: start;
}

.participant-section,
.host-section {
  text-align: center;
}

.participant-section h2,
.host-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: #2c3e50;
}

.divider {
  width: 1px;
  background: linear-gradient(to bottom, transparent, #e0e6ed, transparent);
  min-height: 200px;
}

/* Formularze */
.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #555;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e6ed;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Przyciski */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-2px);
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
  transform: translateY(-2px);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Ekran pokoju */
.room-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: white;
}

.room-header {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.room-info h2 {
  margin: 0;
  font-size: 1.5rem;
}

.participant-info {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}

.separator {
  margin: 0 0.5rem;
}

/* Chat */
.chat-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.participants-sidebar {
  width: 280px;
  background: #f8f9fa;
  border-right: 1px solid #e0e6ed;
  padding: 1.5rem;
  overflow-y: auto;
}

.participants-sidebar h3 {
  margin-bottom: 1rem;
  color: #2c3e50;
  font-size: 1.1rem;
}

.participant-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  transition: background-color 0.2s ease;
}

.participant-item:hover {
  background: #e9ecef;
}

.participant-item.current {
  background: #e3f2fd;
  border: 1px solid #2196f3;
}

.participant-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin-right: 0.75rem;
}

.participant-info {
  flex: 1;
}

.participant-name {
  font-weight: 500;
  color: #2c3e50;
}

.participant-stats {
  font-size: 0.8rem;
  color: #6c757d;
}

.participant-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 0.5rem;
}

.participant-status.online {
  background: #28a745;
}

/* Wiadomości */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.messages-container {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  background: #ffffff;
}

.message {
  margin-bottom: 1rem;
  animation: fadeIn 0.3s ease;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.message-author {
  font-weight: 500;
  color: #2c3e50;
}

.message-time {
  font-size: 0.8rem;
  color: #6c757d;
}

.message-content {
  background: #f8f9fa;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid #e0e6ed;
  word-wrap: break-word;
}

.own-message .message-content {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  margin-left: 2rem;
}

.other-message .message-content {
  margin-right: 2rem;
}

.system-message {
  text-align: center;
  font-style: italic;
  color: #6c757d;
  font-size: 0.9rem;
}

.system-message .message-content {
  background: transparent;
  border: none;
  padding: 0.5rem;
}

/* Input wiadomości */
.message-input-container {
  padding: 1.5rem;
  background: #f8f9fa;
  border-top: 1px solid #e0e6ed;
  display: flex;
  gap: 1rem;
}

#message-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e6ed;
  border-radius: 25px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

#message-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Panel gospodarza */
.host-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f8f9fa;
}

.host-header {
  background: white;
  padding: 1rem 2rem;
  border-bottom: 1px solid #e0e6ed;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.host-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.host-sidebar {
  width: 320px;
  background: white;
  border-right: 1px solid #e0e6ed;
  padding: 1.5rem;
  overflow-y: auto;
}

.host-actions {
  margin-bottom: 2rem;
}

.host-actions .btn {
  width: 100%;
  margin-bottom: 0.5rem;
}

.rooms-section h3 {
  margin-bottom: 1rem;
  color: #2c3e50;
}

.room-item {
  background: #f8f9fa;
  border: 1px solid #e0e6ed;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.room-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.room-item.active {
  border-color: #28a745;
}

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.room-header h4 {
  margin: 0;
  color: #2c3e50;
}

.room-status {
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.room-status.active {
  background: #d4edda;
  color: #155724;
}

.room-status.inactive {
  background: #f8d7da;
  color: #721c24;
}

.room-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat {
  text-align: center;
  flex: 1;
}

.stat-value {
  display: block;
  font-size: 1.2rem;
  font-weight: 600;
  color: #2c3e50;
}

.stat-label {
  font-size: 0.8rem;
  color: #6c757d;
}

.room-actions {
  display: flex;
  gap: 0.5rem;
}

.room-actions .btn {
  flex: 1;
}

/* Dashboard gospodarza */
.host-main {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.dashboard h2 {
  margin-bottom: 2rem;
  color: #2c3e50;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
}

.stat-card h3 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 0.5rem;
}

.stat-card p {
  color: #6c757d;
  font-weight: 500;
}

/* Szczegóły pokoju */
.room-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e0e6ed;
}

.room-actions {
  display: flex;
  gap: 0.5rem;
}

.room-details-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.participants-panel,
.messages-panel {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.participants-panel h3,
.messages-panel h3 {
  margin-bottom: 1rem;
  color: #2c3e50;
}

.participant-detail-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #f0f0f0;
}

.participant-detail-item:last-child {
  border-bottom: none;
}

.participant-meta {
  font-size: 0.8rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

.participant-meta span {
  margin-right: 0.5rem;
}

#details-messages-container {
  max-height: 400px;
  overflow-y: auto;
}

.message-detail-item {
  padding: 0.75rem;
  border-bottom: 1px solid #f0f0f0;
}

.message-detail-item:last-child {
  border-bottom: none;
}

/* Powiadomienia */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  z-index: 1000;
  transform: translateX(400px);
  transition: transform 0.3s ease;
  max-width: 400px;
  word-wrap: break-word;
}

.notification.show {
  transform: translateX(0);
}

.notification-success {
  background: #28a745;
}

.notification-error {
  background: #dc3545;
}

.notification-info {
  background: #17a2b8;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e0e6ed;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  color: #2c3e50;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6c757d;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.modal-close:hover {
  background: #f0f0f0;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e0e6ed;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Link do pokoju */
.room-link {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.room-link input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: monospace;
}

.room-link button {
  padding: 0.5rem 1rem;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* Brak pokoi */
.no-rooms {
  text-align: center;
  color: #6c757d;
  font-style: italic;
  padding: 2rem;
}

/* Animacje */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsywność */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .main-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .divider {
    width: 100%;
    height: 1px;
    min-height: auto;
    background: linear-gradient(to right, transparent, #e0e6ed, transparent);
  }

  .room-header {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .chat-container {
    flex-direction: column;
  }

  .participants-sidebar {
    width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid #e0e6ed;
  }

  .host-content {
    flex-direction: column;
  }

  .host-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e0e6ed;
  }

  .room-details-content {
    grid-template-columns: 1fr;
  }

  .room-actions {
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .main-content {
    padding: 1.5rem;
  }

  .modal {
    width: 95%;
  }

  .notification {
    right: 10px;
    left: 10px;
    transform: translateY(-100px);
  }

  .notification.show {
    transform: translateY(0);
  }
}

/* Dodatkowe style dla lepszej UX */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Focus states dla dostępności */
.btn:focus,
input:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Hover effects */
.participant-item:hover .participant-avatar {
  transform: scale(1.05);
}

.stat-card:hover {
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Status indicators */
.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.status-online {
  background: #28a745;
}

.status-offline {
  background: #6c757d;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: #e3f2fd;
  color: #1976d2;
}

.badge-success {
  background: #e8f5e8;
  color: #2e7d32;
}

.badge-warning {
  background: #fff3e0;
  color: #f57c00;
}

.badge-danger {
  background: #ffebee;
  color: #d32f2f;
}