/* ============================
   CONTACT SYSTEM STYLES
   ============================ */

/* ======= LAYOUT PRINCIPALE ======= */
.contact-container {
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.contact-header {
  background: linear-gradient(135deg, rgb(13 110 253 / 71%), rgb(255 193 7 / 39%));
  border: 1px solid rgba(13, 110, 253, 0.2);
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.s_frame{
    background: rgb(0 0 0);
}
/* ======= FORM NUOVO MESSAGGIO ======= */
.message-form {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.message-form .form-control {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 0.375rem;
}

.message-form .form-control:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: #0d6efd;
  color: #fff;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.message-form .form-control::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.char-counter {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  text-align: right;
  margin-top: 0.25rem;
}

.char-counter.warning {
  color: #ffc107;
}

.char-counter.danger {
  color: #dc3545;
}

/* ======= LISTA MESSAGGI ======= */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message-card {
  background: rgb(10 9 9 / 79%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  padding: 1.25rem;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.message-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.message-card.unread {
  border-left: 4px solid #0d6efd;
  background: rgb(5 6 6 / 97%);
}

.message-card.closed {
  opacity: 0.7;
  background: rgba(108, 117, 125, 0.1);
  border-color: rgba(108, 117, 125, 0.3);
}

.message-header {
  display: flex;
  justify-content: between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.message-subject {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
  flex-grow: 1;
}

.message-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  gap: 0.25rem;
}

.message-status {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 1rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02rem;
}

.message-preview {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  line-height: 1.4;
  margin: 0.5rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.message-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
}

.reply-count {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.unread-indicator {
  background: #dc3545;
  color: #fff;
  font-size: 0.6rem;
  padding: 0.1rem 0.4rem;
  border-radius: 1rem;
  font-weight: 600;
}

/* ======= DETTAGLIO MESSAGGIO ======= */
.message-detail {
  background: rgb(0 0 0 / 78%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  overflow: hidden;
}

.message-detail-header {
  background: rgba(13, 110, 253, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.25rem;
}

.message-detail-subject {
  font-size: 1.3rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 0.5rem 0;
}

.message-detail-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

.message-detail-body {
  padding: 1.25rem;
}

.message-content {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.375rem;
  padding: 1rem;
  color: #fff;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ======= RISPOSTE ======= */
.replies-section {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.2);
}

.replies-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reply-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.375rem;
  padding: 1rem;
  margin-bottom: 1rem;
  position: relative;
}

.reply-item:last-child {
  margin-bottom: 0;
}

.reply-item.admin-reply {
  background: rgba(255, 193, 7, 0.05);
  border-color: rgba(255, 193, 7, 0.2);
  margin-left: 1rem;
}

.reply-item.user-reply {
  background: rgba(13, 110, 253, 0.05);
  border-color: rgba(13, 110, 253, 0.2);
  margin-right: 1rem;
}

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

.reply-sender {
  font-weight: 600;
  color: #fff;
}

.reply-sender.admin {
  color: #ffc107;
}

.reply-sender.user {
  color: #0d6efd;
}

.reply-date {
  color: rgba(255, 255, 255, 0.6);
}

.reply-content {
  color: #fff;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.reply-unread {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  width: 0.5rem;
  height: 0.5rem;
  background: #dc3545;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.9);
}

/* ======= FORM RISPOSTA ======= */
.reply-form {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.375rem;
  padding: 1rem;
  margin-top: 1rem;
}

.reply-form .form-control {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  resize: vertical;
  min-height: 80px;
}

.reply-form .form-control:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: #0d6efd;
  color: #fff;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* ======= ALERT PERSONALIZZATI ======= */
.contact-alert {
  border: none;
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.contact-alert-info {
  background: rgb(4 4 5 / 95%);
  color: #b3d4fc;
  border-left: 4px solid #0d6efd;
}

.contact-alert-warning {
  background: rgba(255, 193, 7, 0.1);
  color: #fff3cd;
  border-left: 4px solid #ffc107;
}

.contact-alert-danger {
  background: rgba(220, 53, 69, 0.1);
  color: #f8d7da;
  border-left: 4px solid #dc3545;
}

.contact-alert-success {
  background: rgba(25, 135, 84, 0.1);
  color: #d1e7dd;
  border-left: 4px solid #198754;
}

/* ======= PULSANTI SPECIALIZZATI ======= */
.btn-contact-primary {
  background: linear-gradient(135deg, #0d6efd, #0b5ed7);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.btn-contact-primary:hover {
  background: linear-gradient(135deg, #0b5ed7, #0a58ca);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.btn-contact-warning {
  background: linear-gradient(135deg, #ffc107, #e0a800);
  border: none;
  color: #000;
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.btn-contact-warning:hover {
  background: linear-gradient(135deg, #e0a800, #d39e00);
  color: #000;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.btn-contact-danger {
  background: linear-gradient(135deg, #dc3545, #bb2d3b);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.btn-contact-danger:hover {
  background: linear-gradient(135deg, #bb2d3b, #b02a37);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* ======= STATI MESSAGGI ======= */
.status-nuovo {
  background: rgba(13, 110, 253, 0.2);
  color: #b3d4fc;
}

.status-letto {
  background: rgba(13, 202, 240, 0.2);
  color: #9eeaf9;
}

.status-in-attesa-admin {
  background: rgba(255, 193, 7, 0.2);
  color: #fff3cd;
}

.status-in-attesa-utente {
  background: rgba(25, 135, 84, 0.2);
  color: #d1e7dd;
}

.status-chiuso {
  background: rgba(108, 117, 125, 0.2);
  color: #d6d8db;
}

/* ======= RESPONSIVE ======= */
@media (max-width: 768px) {
  .contact-container {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .contact-header {
    padding: 1rem;
    text-align: center;
  }
  
  .message-form {
    padding: 1rem;
  }
  
  .message-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .message-meta {
    align-items: flex-start;
    width: 100%;
  }
  
  .message-detail-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .reply-item.admin-reply {
    margin-left: 0.5rem;
  }
  
  .reply-item.user-reply {
    margin-right: 0.5rem;
  }
  
  .replies-section {
    padding: 1rem;
  }
  
  .message-detail-header,
  .message-detail-body {
    padding: 1rem;
  }
}

@media (max-width: 576px) {
  .contact-container {
    padding: 0.75rem;
  }
  
  .message-card {
    padding: 1rem;
  }
  
  .message-subject {
    font-size: 1rem;
  }
  
  .reply-item.admin-reply,
  .reply-item.user-reply {
    margin-left: 0;
    margin-right: 0;
  }
  
  .btn-contact-primary,
  .btn-contact-warning,
  .btn-contact-danger {
    width: 100%;
    margin-bottom: 0.5rem;
  }
}

/* ======= ANIMAZIONI ======= */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-card,
.reply-item {
  animation: slideInUp 0.3s ease-out;
}

.contact-alert {
  animation: slideInUp 0.4s ease-out;
}

/* ======= UTILITÀ ======= */
.text-muted-light {
  color: rgba(255, 255, 255, 0.6) !important;
}

.bg-dark-subtle {
  background: rgba(255, 255, 255, 0.02) !important;
}

.border-light-subtle {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* ======= LOADING STATES ======= */
.loading-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 1rem;
  height: 1rem;
  top: 50%;
  left: 50%;
  margin-left: -0.5rem;
  margin-top: -0.5rem;
  border: 2px solid transparent;
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}