.contact-section {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 20px;
}

.contact-container {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  overflow: hidden;
}

.car-info-card {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.car-info-photo img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.2);
}

.car-info-details h3 {
  margin: 0 0 8px 0;
  font-size: 1.4em;
  font-weight: 600;
  color: white !important;
}

.car-price {
  font-size: 1.3em;
  font-weight: bold;
  margin: 5px 0;
  color: #fef3c7;
}

.car-seller {
  margin: 8px 0 0 0;
  opacity: 0.9;
  font-size: 0.95em;
}

.contact-form-card {
  padding: 40px;
}

.contact-form-card h1 {
  color: #1e293b;
  margin-bottom: 8px;
  font-size: 2em;
}

.contact-subtitle {
  color: #64748b;
  margin-bottom: 30px;
  font-size: 1.1em;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 500;
}

.alert-error {
  background-color: #fee2e2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.alert-success {
  background-color: #dcfce7;
  border: 1px solid #bbf7d0;
  color: #16a34a;
}

.alert-info {
  background-color: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 8px;
  color: #374151;
}

.form-group input,
.form-group textarea {
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1em;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input[readonly] {
  background-color: #f9fafb;
  color: #6b7280;
  cursor: not-allowed;
}

.form-group textarea {
  resize: vertical;
  font-family: inherit;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-secondary {
  background: #f1f5f9;
  color: #475569;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-primary {
  background: #6366f1;
  color: white;
}

.btn-primary:hover {
  background: #5855eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.login-note {
  margin-top: 20px;
  padding: 16px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  text-align: center;
}

.login-note p {
  margin: 0;
  color: #0369a1;
}

.login-note a {
  color: #6366f1;
  text-decoration: none;
  font-weight: 600;
}

.login-note a:hover {
  text-decoration: underline;
}

/* Messages Inbox Styles */
.messages-section {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 20px;
}

.messages-container {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  overflow: hidden;
}

.messages-header {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  padding: 30px;
  text-align: center;
}

.messages-header h1 {
  margin: 0 0 8px 0;
  font-size: 2.2em;
  font-weight: 600;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.message-icon {
  width: 32px;
  height: 32px;
  display: inline-block;
  position: relative;
}

.message-icon::before {
  content: '';
  width: 32px;
  height: 32px;
  background: white;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 8l7.89 4.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z' /%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  display: block;
}

.messages-subtitle {
  margin: 0;
  opacity: 0.9;
  font-size: 1.1em;
}

.conversations-list {
  padding: 20px;
}

.conversation-card {
  border: 2px solid #f1f5f9;
  border-radius: 12px;
  margin-bottom: 16px;
  transition: all 0.2s;
  overflow: hidden;
}

.conversation-card:hover {
  border-color: #6366f1;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.1);
}

.conversation-card.unread {
  border-color: #fbbf24;
  background: #fffbeb;
}

.conversation-link {
  display: flex;
  align-items: center;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  gap: 20px;
}

.conversation-car {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 250px;
}

.conversation-car-photo {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
}

.car-photo-placeholder {
  width: 80px;
  height: 60px;
  background: #f3f4f6;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #9ca3af;
}

.conversation-car-info h3 {
  margin: 0 0 5px 0;
  font-size: 1.1em;
  font-weight: 600;
  color: #1e293b;
}

.conversation-date {
  margin: 0;
  font-size: 0.9em;
  color: #64748b;
}

.conversation-message {
  flex: 1;
  min-width: 0;
}

.conversation-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sender-name {
  font-weight: 600;
  color: #374151;
}

.unread-badge {
  background: #ef4444;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 600;
}

.conversation-subject {
  margin: 0 0 5px 0;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-preview {
  margin: 0;
  color: #64748b;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-arrow {
  color: #6366f1;
  font-size: 1.2em;
  margin-left: 10px;
}

.empty-state {
  text-align: center;
  padding: 60px 40px;
}

.empty-icon {
  font-size: 4em;
  margin-bottom: 20px;
}

.empty-state h2 {
  color: #374151;
  margin-bottom: 10px;
}

.empty-state p {
  color: #64748b;
  margin-bottom: 30px;
  line-height: 1.6;
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
}

/* Conversation View Styles */
.conversation-section {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 20px;
}

.conversation-container {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  overflow: hidden;
}

.conversation-header {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  padding: 30px;
}

.back-link {
  color: white;
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 20px;
  display: inline-block;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.back-link:hover {
  opacity: 1;
}

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

.conversation-car-photo-header {
  width: 100px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.3);
}

.car-photo-placeholder-header {
  width: 100px;
  height: 70px;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: rgba(255,255,255,0.7);
}

.car-unavailable {
  color: rgba(255,255,255,0.8);
  font-style: italic;
  margin: 0;
}

.conversation-car-details h2 {
  margin: 0 0 5px 0;
  font-size: 1.5em;
  font-weight: 600;
  color: white !important;
}

.conversation-car-details .car-price {
  font-size: 1.2em;
  font-weight: bold;
  margin: 5px 0 10px 0;
  color: #fef3c7;
}

.view-listing-link {
  color: white;
  text-decoration: none;
  font-size: 0.9em;
  opacity: 0.9;
  border-bottom: 1px solid rgba(255,255,255,0.3);
  transition: opacity 0.2s;
}

.view-listing-link:hover {
  opacity: 1;
}

.messages-thread {
  padding: 30px;
  max-height: 500px;
  overflow-y: auto;
}

.message-bubble {
  margin-bottom: 20px;
  max-width: 80%;
}

.message-bubble.sent {
  margin-left: auto;
}

.message-bubble.received {
  margin-right: auto;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.9em;
}

.message-bubble.sent .message-header {
  flex-direction: row-reverse;
}

.message-date {
  color: #64748b;
}

.message-subject {
  margin-bottom: 10px;
  color: #374151;
}

.message-content {
  background: #f8fafc;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  line-height: 1.5;
}

.message-bubble.sent .message-content {
  background: #6366f1;
  color: white;
  border-color: #6366f1;
}

.message-status {
  text-align: right;
  font-size: 0.8em;
  color: #64748b;
  margin-top: 5px;
}

.reply-form-container {
  border-top: 1px solid #e5e7eb;
  padding: 30px;
  background: #f8fafc;
}

.reply-form-container h3 {
  margin: 0 0 20px 0;
  color: #374151;
}

.reply-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Guest message notice */
.reply-form-container.guest-message-notice {
  background: #fef3c7;
  border: 1px solid #f59e0b;
}

.guest-notice {
  color: #92400e;
}

.guest-notice p {
  margin: 0 0 8px 0;
}

.guest-notice p:last-child {
  margin-bottom: 0;
}

.guest-indicator {
  background: #fbbf24;
  color: #78350f;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: 500;
  margin-left: 8px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .contact-section {
    margin: 20px auto;
    padding: 0 15px;
  }
  
  .car-info-card {
    flex-direction: column;
    text-align: center;
  }
  
  .car-info-photo img {
    width: 150px;
    height: 100px;
  }
  
  .contact-form-card {
    padding: 25px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .messages-section,
  .conversation-section {
    margin: 20px auto;
    padding: 0 15px;
  }
  
  .messages-header,
  .conversation-header {
    padding: 25px 20px;
  }
  
  .conversation-link {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .conversation-car {
    min-width: auto;
    width: 100%;
  }
  
  .conversation-car-header {
    flex-direction: column;
    text-align: center;
  }
  
  .conversation-car-photo-header {
    width: 120px;
    height: 80px;
  }
  
  .messages-thread {
    padding: 20px;
  }
  
  .message-bubble {
    max-width: 95%;
  }
  
  .reply-form-container {
    padding: 20px;
  }
  
  .empty-actions {
    flex-direction: column;
    align-items: center;
  }
}
