/* css/list.css - Messages table styling */

/* Table container */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.9rem;
}

/* Table headers */
thead tr {
  background: #2563eb;
  color: white;
}

th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Table cells */
td {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}

/* Row styling */
tbody tr {
  transition: background-color 0.2s ease;
}

tbody tr:nth-child(even) {
  background: #f9fafb;
}

tbody tr:hover {
  background: #f3f4f6;
}

/* Status styling */
td:nth-child(5) {
  font-weight: 600;
}

td:nth-child(5):contains("new") {
  color: #dc2626;
}

td:nth-child(5):contains("read") {
  color: #059669;
}

td:nth-child(5):contains("archived") {
  color: #6b7280;
}

/* Action links */
td:last-child {
  text-align: center;
}

td:last-child a {
  color: #2563eb;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 2px solid #2563eb;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-weight: 500;
  display: inline-block;
}

td:last-child a:hover {
  background: #2563eb;
  color: white;
  transform: translateY(-1px);
}

/* Date formatting */
td:nth-child(6) {
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 0.8rem;
  color: #6b7280;
}

/* Header styling */
header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e5e7eb;
}

header h1 {
  color: #1f2937;
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
}

/* Empty state */
p {
  text-align: center;
  color: #6b7280;
  font-style: italic;
  padding: 3rem;
  font-size: 1.1rem;
}

/* Flash messages */
.flash-error {
  background: #fee2e2;
  color: #b91c1c;
  padding: 1rem;
  border: 1px solid #fecaca;
  border-radius: 6px;
  margin: 1rem 0;
}

.flash-success {
  background: #d1fae5;
  color: #065f46;
  padding: 1rem;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  margin: 1rem 0;
}

.flash-error p,
.flash-success p {
  margin: 0;
  padding: 0;
  font-style: normal;
}

/* ===== MOBILE CARD VIEW FOR MESSAGES ===== */
@media (max-width: 768px) {
  /* Hide table headers */
  thead {
    display: none;
  }

  /* Convert rows to cards */
  tbody tr {
    display: block;
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  }

  /* Make cells stack vertically */
  tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px !important;
    border: none;
    border-bottom: 1px solid #eee;
    text-align: right;
  }

  /* Remove border from last cell */
  tbody td:last-child {
    border-bottom: none;
  }

  /* Add labels before each cell */
  tbody td::before {
    content: attr(data-label);
    font-weight: bold;
    color: #4b5563;
    margin-right: 15px;
    text-align: left;
    flex: 1;
  }

  /* Special handling for action column */
  tbody td:last-child::before {
    content: "Action";
  }

  /* Action links styling for mobile */
  tbody td:last-child {
    justify-content: flex-start;
    padding-top: 15px !important;
  }

  tbody td:last-child a {
    width: 100%;
    text-align: center;
    padding: 0.75rem;
  }

  /* Status indicators */
  td:nth-child(5) {
    font-weight: 600;
  }

  /* Date formatting */
  td:nth-child(6) {
    font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  }
}

/* Very small phones */
@media (max-width: 480px) {
  tbody td {
    font-size: 0.85rem;
    padding: 8px !important;
  }

  tbody td::before {
    font-size: 0.8rem;
  }

  .flash-error,
  .flash-success {
    padding: 0.75rem;
    font-size: 0.85rem;
  }
}

/* Original responsive design (keep as fallback) */
@media (max-width: 768px) {
  /* Keep your existing responsive styles */
  table {
    font-size: 0.8rem;
  }

  th,
  td {
    padding: 0.75rem 0.5rem;
  }

  header h1 {
    font-size: 2rem;
  }

  td:last-child a {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
}
