* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

.screen {
  display: none;
}

.screen:not(.hidden) {
  display: block;
}

/* Auth Screen */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

#auth-screen .container {
  background: white;
  border-radius: 10px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 800px;
  width: 100%;
}

#auth-screen h1 {
  text-align: center;
  margin-bottom: 30px;
  color: #667eea;
  font-size: 2.5em;
}

.auth-forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.auth-form h2 {
  margin-bottom: 20px;
  color: #333;
  text-align: center;
}

.auth-form input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
}

.auth-form input:focus {
  outline: none;
  border-color: #667eea;
}

.auth-form button {
  width: 100%;
  padding: 12px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s;
}

.auth-form button:hover {
  background: #5568d3;
}

.error {
  color: #e74c3c;
  text-align: center;
  margin-top: 20px;
  font-weight: bold;
}

/* App Screen */
#app-screen {
  min-height: 100vh;
  padding-bottom: 40px;
}

.header {
  background: white;
  padding: 20px 40px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  color: #667eea;
  font-size: 1.8em;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-info span {
  color: #666;
  font-weight: 500;
}

#logout-btn, #pair-btn, #add-activity-btn, #send-message-btn {
  padding: 10px 20px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s;
  font-size: 14px;
}

#logout-btn:hover, #pair-btn:hover, #add-activity-btn:hover, #send-message-btn:hover {
  background: #5568d3;
}

.icon-btn {
  background: #f8f9fa;
  border: 2px solid #ddd;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 18px;
  position: relative;
  transition: all 0.3s;
}

.icon-btn:hover {
  background: #e9ecef;
  border-color: #667eea;
}

.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e74c3c;
  color: white;
  border-radius: 50%;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: bold;
}

.main-content {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}

.section {
  background: white;
  border-radius: 10px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.section h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.5em;
}

#user-select {
  width: 100%;
  max-width: 400px;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  margin-bottom: 15px;
}

#date-selector {
  width: 100%;
  max-width: 300px;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
}

.availability-toggle {
  display: flex;
  align-items: center;
  font-size: 18px;
}

.availability-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  cursor: pointer;
}

#activities-list {
  display: grid;
  gap: 15px;
  margin-bottom: 20px;
}

.activity-item {
  display: flex;
  align-items: center;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: all 0.3s;
}

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

.activity-item.selected {
  border-color: #667eea;
  background: #e8eaf6;
}

.activity-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 15px;
  cursor: pointer;
}

.activity-item label {
  flex: 1;
  cursor: pointer;
  font-size: 16px;
}

.activity-creator {
  font-size: 12px;
  color: #666;
  font-style: italic;
}

.add-activity {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

#new-activity-input {
  flex: 1;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
}

#new-activity-input:focus {
  outline: none;
  border-color: #667eea;
}

#common-activities-list {
  min-height: 100px;
}

.common-activity {
  padding: 15px;
  background: #d4edda;
  border: 2px solid #28a745;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 16px;
}

.placeholder {
  color: #999;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

/* Messages */
#messages-container {
  max-width: 800px;
}

#messages-list {
  max-height: 400px;
  overflow-y: auto;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  background: #f8f9fa;
}

.message {
  padding: 10px 15px;
  margin-bottom: 10px;
  border-radius: 8px;
  max-width: 70%;
  word-wrap: break-word;
}

.message.sent {
  background: #667eea;
  color: white;
  margin-left: auto;
  text-align: right;
}

.message.received {
  background: white;
  border: 1px solid #ddd;
}

.message-username {
  font-weight: bold;
  font-size: 12px;
  margin-bottom: 5px;
}

.message-time {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 5px;
}

.message-input {
  display: flex;
  gap: 10px;
}

#message-input {
  flex: 1;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
}

#message-input:focus {
  outline: none;
  border-color: #667eea;
}

/* Modal */
.modal {
  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: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px;
  border-bottom: 2px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  color: #333;
}

.close-btn {
  background: none;
  border: none;
  font-size: 30px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 30px;
  height: 30px;
  line-height: 30px;
}

.close-btn:hover {
  color: #333;
}

.small-btn {
  padding: 8px 15px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  margin-right: 10px;
}

.small-btn:hover {
  background: #5568d3;
}

#notifications-list {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

.notification {
  padding: 15px;
  background: #f8f9fa;
  border-left: 4px solid #667eea;
  border-radius: 5px;
  margin-bottom: 15px;
}

.notification.unread {
  background: #e8eaf6;
  border-left-color: #e74c3c;
}

.notification.match {
  border-left-color: #28a745;
}

.notification-time {
  font-size: 12px;
  color: #666;
  margin-top: 8px;
}

.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
  .auth-forms {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .header {
    flex-direction: column;
    gap: 15px;
    padding: 15px 20px;
  }

  .header-info {
    flex-direction: column;
    gap: 10px;
  }

  .main-content {
    margin: 20px auto;
  }

  .section {
    padding: 20px;
  }
}
