@charset "UTF-8";
/* RESET i base */
* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: Arial,sans-serif;
  background:#1c1c1c;
  color:#ecf0f1;
  min-height:100vh;
  margin: 0;
}

/* Logo */
.logo-container{ text-align:center; margin-bottom:15px; }
.logo{ max-width:150px; height:auto; }

header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 16px 0 8px 0;
  gap: 10px;
}
.logo-container-dashboard {
  width: 100%;
  text-align: center;
}
.logo-dashboard {
  display: block;
  width: 120px;
  max-width: 90%;
  height: auto;
  margin: 0 auto 12px auto;
}

/* Auth */
#loginSection{ background:#0d0d0d; padding:20px; border:2px solid #b87333; border-radius:8px; width:300px; text-align:center; margin:40px auto 0 auto;}
#loginSection h1{ margin-bottom:15px; color:#b87333; }
#loginSection input{ width:100%; margin-bottom:10px; padding:8px; border-radius:4px; border:1px solid #555; background:#262626; color:#ecf0f1; }
#loginSection button{ width:100%; padding:10px; border:none; background:#b87333; color:#ecf0f1; cursor:pointer; border-radius:4px; }

/* Dashboard */
#dashboardSection{ width:96%; max-width:1080px; margin:0 auto;}

/* Menu */
#menuGrid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:15px; margin:20px; }
.menu-card{ background:#0d0d0d; border:2px solid #b87333; border-radius:8px; padding:20px; text-align:center; cursor:pointer; transition:background .2s; }
.menu-card:hover{ background:#262626; }

/* Modules */
.module-section {
  background:#0d0d0d;
  padding:20px;
  border:2px solid #b87333;
  border-radius:10px;
  box-sizing: border-box;
  margin: 22px auto;
  width: 96vw;
  max-width: 900px;
  min-width: 0;
}

@media (max-width: 700px) {
  .module-section {
    width: 96vw !important;
    max-width: 99vw !important;
    min-width: 0 !important;
    margin: 10px 2vw !important;  /* 2vw margines z każdej strony */
    border-radius: 7px !important;
    padding: 12px 2vw 12px 2vw !important;
    box-sizing: border-box;
  }
}

.back-btn{ background:none; border:none; color:#b87333; cursor:pointer; margin-bottom:15px; font-size:1.1em; }

.table-wrapper{ overflow-x:auto; width:100%; }
table{
  border-collapse: collapse;
  width: 100%;
  min-width:900px;
}
th, td {
  border: 1px solid #555;
  vertical-align: middle !important;
  text-align: center !important;
  padding: 8px;
}
th {
  background:#262626;
  color:#b87333;
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 600px) {
  .table-wrapper table { min-width: 1000px; font-size: 0.95em; }
}

/* Forms */
#assignForm select, #assignForm input{ width:100%; margin-bottom:10px; padding:8px; border-radius:4px; border:1px solid #555; background:#262626; color:#ecf0f1; }
#assignForm button{ padding:10px; border:none; background:#b87333; color:#ecf0f1; cursor:pointer; border-radius:4px; }
.individualFields{ display:flex; gap:10px; }
.individualFields.hidden{ display:none!important; }

.qr-scanner{ width:100%; max-width:500px; aspect-ratio:1/1; border:2px dashed #b87333; margin-top:15px; }
#qrCardMsg{ margin-top:10px; color:#ecf0f1; }
#logoutBtn{ padding:8px 12px; background:#c0392b; border:none; color:#ecf0f1; border-radius:4px; cursor:pointer; }

.hidden { display: none !important; }
.menu-card-messenger { display: flex; align-items: center; justify-content: center; padding-left: 60px; }
.menu-card-messenger .messenger-title { margin: 0 !important; width: 100%; text-align: center; font-weight: bold; }
#messengerSection h2 { margin-bottom: 25px; }

#recipientsList { margin-bottom: 10px; }
input:focus, button:focus { outline: 2px solid #b87333; outline-offset: 1px; }

/* ======================== KOMUNIKATOR - PANEL PRZYCISKÓW ======================== */

.messenger-root {
  display: flex;
  flex-direction: column;
  height: 72vh;
  min-height: 320px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  position: relative;
}

#memberButtonsPanel {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 10px 10px 18px 10px; /* 10px z lewej i prawej */
  background: transparent !important;
  width: auto;
  max-width: calc(100% - 20px); /* 10px + 10px marginesu */
  box-sizing: border-box;
}

/* Przycisk membera */
.member-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #161616;
  border: 1.7px solid #b87333;
  border-radius: 8px;
  padding: 9px 15px 9px 11px;
  min-width: 160px;
  max-width: 98vw;
  flex: 1 1 230px;
  gap: 13px;
  box-shadow: 0 2px 9px #0003;
  cursor: pointer;
  font-size: 1.07em;
  color: #fff;
  transition: background 0.15s, box-shadow 0.14s;
}

.member-btn.selected, .member-btn:active {
  background: #b87333 !important;
  color: #fff !important;
  border-color: #b87333 !important;
  box-shadow: 0 4px 11px #b8733333;
}

.member-btn .left {
  display: flex;
  align-items: center;
  gap: 9px;
}
.member-btn .member-name {
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.member-btn .member-checkbox {
  margin-left: 8px;
  width: 18px; height: 18px;
  accent-color: #b87333;
  cursor: pointer;
}
.member-btn .badge {
  margin-left: 20px;
  margin-right: 3px;
  background: #ff2323;
  color: #fff;
  border-radius: 50%;
  padding: 0 7px;
  min-width: 19px;
  height: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  text-align: right;
}

@media (max-width: 900px) {
  .module-section {
    width: 98vw !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    border-radius: 0 !important;
    margin: 10px 1vw !important;
    left: 0 !important;
    padding: 10px 1vw !important;
  }
  .messenger-root {
    height: 85vh;
    min-height: 320px;
    width: 99vw !important;
    max-width: 99vw !important;
    border-radius: 0 !important;
    margin: 0 auto !important;
  }
  #memberButtonsPanel {
    gap: 4px;
    margin-left: 4px;
    margin-right: 4px;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .member-btn {
    min-width: 130px;
    font-size: 0.98em;
    padding: 8px 8px 8px 7px;
    max-width: 98vw;
  }
  .member-btn .member-name {
    max-width: 75px;
  }
}

#messengerMain {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;     /* <-- TO DODAĆ */
  background: #181818;
  justify-content: flex-end;
  overflow: hidden;
  height: 100%;
  padding: 0;
  box-sizing: border-box;  /* <-- ZAWSZE! */
}

#messagesList {
  flex: 1 1 0%;
  overflow-y: auto;
  padding: 16px 18px 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  max-height: 60vh;
  scroll-behavior: smooth;
}

#adminMessengerForm {
  display: flex;
  gap: 8px;
  padding: 10px 14px 6px 14px;
  border-top: 1px solid #b87333;
  background: #181818;
  align-items: center;
  min-width: 0;         /* <-- to ZAWSZE! */
  width: 100%;          /* <-- rozciągnie na całą szerokość ramki */
  box-sizing: border-box;
}

#adminMessengerInput {
  flex: 1 1 0%;
  min-width: 0;
  padding: 9px 13px;
  border-radius: 11px;
  border: 1px solid #888;
  background: #222;
  color: #fff;
  font-size: 1.08em;
}

.bubble.sent {
  background: #b87333;
  color: #fff;
  border-radius: 18px 18px 6px 18px;
  padding: 12px 16px 8px 15px;
  min-width: 70px;
  max-width: 400px;
  word-break: break-word;
  box-shadow: 0 2px 8px 0 rgba(0,0,0,0.09);
  align-self: flex-end;
}
.bubble.received {
  background: #1280ea;
  color: #fff;
  border-radius: 18px 18px 18px 6px;
  padding: 12px 16px 8px 15px;
  min-width: 70px;
  max-width: 400px;
  word-break: break-word;
  box-shadow: 0 2px 8px 0 rgba(0,0,0,0.09);
  align-self: flex-start;
}
.bubble-date {
  font-size: 0.81em;
  color: #e6e6e6;
  opacity: 0.83;
  text-align: right;
  margin-top: 3px;
}
.bubble-content { display: block; white-space: pre-line; }
input:focus, button:focus { outline: 2px solid #b87333; outline-offset: 1px; }
#messagesList > div { padding: 2px 0; }

/* Emoji picker */
#emojiPickerAdmin {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 0.72em;
  padding-left: 8px;
}

@media (max-width: 900px) {
  #messengerMain {
    max-width: 100vw !important;
    width: 100vw !important;
  }
}

/* Koniec stylów komunikatora */

html, body {
  max-width: 100vw;
  overflow-x: hidden;
}
html, body {
  max-width: 100vw !important;
  overflow-x: hidden !important;
}

#dashboardSection,
#messengerSection,
.module-section,
.messenger-root,
#memberButtonsPanel,
#messengerMain {
  box-sizing: border-box !important;
  max-width: 100vw !important;
  width: 100vw !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  overflow-x: hidden !important;
}

#memberButtonsPanel {
  margin-left: 10px !important;
  margin-right: 10px !important;
  width: calc(100vw - 20px) !important;
  max-width: calc(100vw - 20px) !important;
  background: transparent !important;
}

.member-btn {
  min-width: 120px;
  max-width: 95vw;
}

html, body, #dashboardSection, #messengerSection, .module-section, .messenger-root, #messengerMain, #memberButtonsPanel {
  max-width: 100vw !important;
  width: 100vw !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}
#adminMessengerIcon {
  display: inline-block;
  position: relative;
  margin-left: 14px;
  vertical-align: middle;
}
#adminMessengerIcon img {
  height: 32px !important;
  width: auto !important;
  display: block;
  aspect-ratio: auto;
}
#adminMessengerBadgeIcon {
  position: absolute;
  right: -7px;
  top: -7px;
  background: #ff2b2b;
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  border-radius: 15px;
  padding: 0 7px;
  display: none;
  z-index: 10;
  box-shadow: 0 0 0 2px #0d0d0d;
}
:root { --safe-bottom: env(safe-area-inset-bottom, 0px); }
.version-footer { bottom: calc(var(--safe-bottom) + 10px) !important; }
.update-toast   { bottom: calc(var(--safe-bottom) + 18px) !important; }

/* Collapse members list */
.messenger-root.members-collapsed #memberButtonsPanel{display:none!important;}
