* { box-sizing: border-box }
html, body { height: 100% }

body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #111;
  background: linear-gradient(to top, #485696, #34486D, #2C5364);
  background-attachment: fixed;
}

.app-header, .app-footer {
  position: fixed;
  left: 0; right: 0;
  background: #fff;
  z-index: 1000;
}
.app-header { top: 0; box-shadow: 0 2px 10px rgba(0,0,0,.1) }
.app-footer { bottom: 0; text-align: center; padding: 10px 0; box-shadow: 0 -2px 10px rgba(0,0,0,.1) }

.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 16px }
.header-inner .logo img { height: 36px }
.nav { display: flex; align-items: center; gap: 8px }
.btn { border: 1px solid rgba(0,0,0,.15); padding: 8px 12px; border-radius: 999px; background: #fff; cursor: pointer }
.btn.primary { background: #485696; color: #fff; border-color: #485696 }
.btn.danger { background: #e74c3c; color: #fff; border-color: #e74c3c }
.btn.block { width: 100% }
.link { background: transparent; border: none; color: #485696; cursor: pointer; text-decoration: underline }
.logout-form { display: inline }

.page-wrapper {
  position: fixed;
  top: 64px; 
  bottom: 40px; /* footer height */
  left: 0; right: 0;
  padding: 16px;
  overflow: hidden;
}

.glass {
  background: rgba(255,255,255,0.3);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.card { padding: 16px }
.full-center { display: flex; align-items: center; justify-content: center; height: 100% }
.login-card { width: 100%; max-width: 420px }

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  height: 100%;
}
.link-card { display: flex; align-items: center; justify-content: center; font-weight: 600; text-align: center }

.two-col {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  height: 100%;
}

.left-pane, .right-pane, .contacts, .call {
  height: 100%;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.pane-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.right-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden; /* prevents pushing content under footer */
}

.scroll-area {
  flex: 1;
  overflow-y: auto;
  border-radius: 12px;
  padding: 8px;
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.6);
  padding-bottom: 16px; /* small breathing room */
  box-sizing: border-box;
}

.messages { display: flex; flex-direction: column; gap: 8px }
.msg { max-width: 70%; padding: 8px 12px; border-radius: 14px }
.msg.in { background: #ffffffb0; align-self: flex-start }
.msg.out { background: #485696c0; color: #fff; align-self: flex-end }
.msg .time { display: block; font-size: 12px; opacity: .8; margin-top: 2px }

/* Composer with growing textarea */
.composer { margin-top: 8px }
#send-form {
  display: flex;
  gap: 8px;
  align-items: flex-end; /* keep send button bottom aligned with textarea */
}
#send-form textarea {
  flex: 1;
  min-height: 40px;         /* starting height */
  max-height: 200px;        /* cap height */
  resize: none;             /* prevent manual resize, remove if you want to allow */
  font-family: inherit;
  font-size: 14px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,.15);
  box-sizing: border-box;
  overflow-y: auto;
}
#send-form input {
  flex: 1;
}

#conversation-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px }
.conv-item { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 10px; cursor: pointer }
.conv-item.active { background: rgba(0,0,0,0.07) }
.conv-name { font-weight: 600 }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #2ecc71 }

.contacts-table { width: 100%; border-collapse: collapse }
.contacts-table th, .contacts-table td { padding: 8px; text-align: left; border-bottom: 1px solid rgba(0,0,0,.08) }

.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.35) }
.modal.hidden { display: none }
.modal-content { width: 100%; max-width: 480px; padding: 16px }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px }

.status { margin-top: 12px; }

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr }
  .left-pane { height: 45% }
  .right-pane { height: 55% }
}
