@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;600;700&family=Dancing+Script:wght@700&display=swap');

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

body {
  min-height: 100vh;
  font-family: 'Quicksand', sans-serif;
  background:
    linear-gradient(rgba(255, 255, 255, 0.34), rgba(255, 240, 247, 0.7)),
    url('mall-bg.jpg') center center / 420px auto repeat;
  color: #4a148c;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid rgba(255, 182, 193, 0.35);
}

.nav-logo {
  font-family: 'Dancing Script', cursive;
  font-size: 1.3em;
  color: #ad1457;
  padding: 12px 18px;
}

.nav-tab {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 1em;
  color: #7b1fa2;
  padding: 14px 18px;
  border: none;
  background: none;
  text-decoration: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.nav-tab:hover, .nav-tab.active {
  color: #e91e63;
  background: rgba(206, 147, 216, 0.15);
  border-bottom-color: #e91e63;
}

.chat-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 16px;
}

.chat-card {
  background: rgba(255, 255, 255, 0.93);
  border: 2px solid rgba(255, 182, 193, 0.48);
  border-radius: 28px;
  box-shadow: 0 12px 34px rgba(173, 20, 87, 0.13);
  overflow: hidden;
}

.chat-hero {
  padding: 24px 18px 18px;
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 224, 240, 0.95), rgba(243, 229, 245, 0.95));
}

.chat-hero h1 {
  font-family: 'Dancing Script', cursive;
  font-size: 2.7em;
  color: #ad1457;
  margin-bottom: 8px;
}

.chat-hero p {
  font-weight: 700;
  color: #7b1fa2;
  line-height: 1.55;
}

.chat-body { padding: 18px; }

.chat-notice {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: #fff3f8;
  color: #ad1457;
  font-weight: 700;
  border: 1px solid rgba(233, 30, 99, 0.18);
}

.chat-notice.ok { color: #2e7d32; background: #f1fff5; border-color: rgba(46,125,50,0.18); }

.screen { display: none; }
.screen.active { display: block; }

.form-grid {
  display: grid;
  gap: 12px;
}

label {
  font-weight: 700;
  color: #7b1fa2;
}

input, textarea, select {
  width: 100%;
  border: 2px solid rgba(206, 147, 216, 0.45);
  border-radius: 18px;
  padding: 12px 14px;
  font: inherit;
  color: #4a148c;
  outline: none;
  background: rgba(255, 255, 255, 0.94);
}

input:focus, textarea:focus, select:focus { border-color: #e91e63; }

button, .button-link {
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #e91e63, #ad1457);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(173, 20, 87, 0.18);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button.secondary, .button-link.secondary { background: linear-gradient(135deg, #ce93d8, #7b1fa2); }
button.soft { background: linear-gradient(135deg, #ffb74d, #f06292); }
button.danger { background: linear-gradient(135deg, #ef5350, #c62828); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.chat-home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.chat-list-item, .member-chip, .admin-row, .report-row {
  background: linear-gradient(135deg, #fff, #fff5fb);
  border: 2px solid rgba(255, 182, 193, 0.36);
  border-radius: 20px;
  padding: 13px;
}

.chat-list-item {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.chat-list-item:hover { transform: translateY(-2px); }
.chat-list-item strong { color: #ad1457; font-size: 1.08em; }
.chat-list-item small { color: #7b1fa2; font-weight: 700; }

.member-select-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow: auto;
  padding: 4px;
}

.member-chip {
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}

.member-chip input { width: auto; }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f8bbd0, #ce93d8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  overflow: hidden;
  flex: 0 0 auto;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.chat-room-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 22px;
  background: rgba(255, 224, 240, 0.8);
  margin-bottom: 12px;
}

.chat-room-header h2 {
  font-family: 'Dancing Script', cursive;
  color: #ad1457;
  font-size: 2em;
}

.chat-members {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 6px;
}

.member-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: #7b1fa2;
  font-size: 0.86em;
  font-weight: 700;
}

.messages {
  height: min(58vh, 560px);
  overflow-y: auto;
  padding: 12px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(243,229,245,0.68));
  border: 2px solid rgba(206, 147, 216, 0.25);
}

.message-row {
  display: flex;
  margin: 8px 0;
  gap: 8px;
  align-items: flex-end;
}

.message-row.mine { justify-content: flex-end; }
.message-row.system { justify-content: center; }

.bubble {
  max-width: min(76%, 560px);
  padding: 10px 12px;
  border-radius: 20px 20px 20px 6px;
  background: white;
  color: #4a148c;
  box-shadow: 0 3px 12px rgba(74,20,140,0.08);
  line-height: 1.42;
}

.message-row.mine .bubble {
  border-radius: 20px 20px 6px 20px;
  background: linear-gradient(135deg, #e91e63, #ad1457);
  color: white;
}

.message-row.system .bubble {
  max-width: 88%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: #7b1fa2;
  text-align: center;
  font-weight: 700;
  font-size: 0.9em;
}

.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 0.75em;
  font-weight: 700;
  opacity: 0.78;
  margin-bottom: 4px;
}

.bubble img {
  width: 100%;
  max-width: 320px;
  border-radius: 15px;
  display: block;
  margin-top: 6px;
}

.message-actions {
  margin-top: 6px;
}
.message-actions button {
  padding: 5px 9px;
  font-size: 0.75em;
  background: rgba(123, 31, 162, 0.18);
  color: inherit;
  box-shadow: none;
}

.composer {
  margin-top: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.file-label {
  border-radius: 999px;
  padding: 11px 14px;
  background: linear-gradient(135deg, #ce93d8, #7b1fa2);
  color: white;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(123, 31, 162, 0.18);
}
.file-label input { display: none; }

.image-preview {
  display: none;
  margin: 10px 0 0 48px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255,255,255,0.86);
  border: 2px dashed rgba(206,147,216,0.45);
  font-weight: 700;
  color: #7b1fa2;
}
.image-preview img { max-width: 130px; border-radius: 14px; display: block; margin-top: 6px; }

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.admin-row h3, .report-row h3 { color: #ad1457; margin-bottom: 7px; }
.admin-row p, .report-row p { font-weight: 700; line-height: 1.45; }

.status-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.8em;
  color: white;
  background: #7b1fa2;
}
.status-badge.inactive, .status-badge.open { background: #ef5350; }
.status-badge.active, .status-badge.resolved { background: #43a047; }

@media (max-width: 640px) {
  .chat-shell { padding: 10px; }
  .chat-hero h1 { font-size: 2.25em; }
  .chat-body { padding: 13px; }
  .nav-tab { padding: 10px 9px; font-size: 0.86em; }
  .nav-logo { width: 100%; text-align: center; padding-bottom: 4px; }
  .chat-room-header { flex-direction: column; }
  .messages { height: 56vh; padding: 8px; }
  .bubble { max-width: 84%; }
  .composer { grid-template-columns: auto 1fr; }
  .composer button { grid-column: 1 / -1; }
  .image-preview { margin-left: 0; }
}
