/* ==========================================================================
   ESA SPECIFIC STYLES
   (Globalne definicje, tabele, modale itp. są w shared/styles/shared.css)
   ========================================================================== */

/* =================================
   1. APP LAYOUT (TOP NAVIGATION)
   ================================= */

#app-root {
  max-width: 1440px;
  margin: auto;
  background-color: var(--colors-grey-00);
}

body {
  background-color: var(--colors-grey-80);
}

.sticky-top-header {
  flex-shrink: 0;
  padding: 24px 80px 0 80px;
  background: var(--colors-grey-40);
  border-bottom: 1px solid var(--colors-grey-200);
  z-index: 20;
  margin-bottom: 16px;
}

.sticky-top-header>.wrapper {
  margin-left: auto;
  margin-right: auto;
  padding-bottom: 24px;
}

.main-navigation {
  display: flex;
  gap: 4px;
  margin-left: auto;
  margin-right: auto;
}

.nav-item {
  padding: 8px 16px;
  font-size: 16px;
  color: var(--colors-grey-500);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
  border: 2px solid transparent;
}

.nav-item:hover {
  color: var(--colors-grey-900);
}

.nav-item.active,
.nav-item.active:hover {
  color: var(--colors-grey-700);
  cursor: default;
  border: 2px solid var(--colors-grey-200);
  border-bottom: 2px solid transparent;
  border-radius: 12px 12px 0 0;
  box-shadow: 0px -4px 16px -4px rgba(0, 0, 0, 0.08);
  background-color: var(--colors-grey-00);
}

.nav-item.disabled {
  color: var(--colors-grey-300);
  cursor: not-allowed;
}

.secondary-navigation {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  border-bottom: 2px solid var(--colors-grey-200);
}

.nav-item.secondary {
  padding: 16px 12px;
  font-size: 16px;
  color: var(--colors-grey-500);
  border: 0;
  border-bottom: 2px solid transparent;
  box-shadow: none;
  border-radius: 0;
  margin-bottom: -2px;
  transition: none;
}

.nav-item.secondary:hover {
  color: var(--colors-grey-700);
  background-color: var(--colors-grey-200);
  border-radius: 8px;
  padding: 4px 8px;
  margin: 12px 4px;
  border: none;
}

.nav-item.secondary.active {
  cursor: default;
  color: var(--colors-brand-500);
  border-bottom: 2px solid var(--colors-brand-500);
  pointer-events: none;
}

.main-content {
  flex-grow: 1;
  overflow-y: auto;
  background-color: var(--colors-grey-00);
  padding: 0 80px 32px 80px;
}

.main-content>.content-wrapper-full {
  margin-left: auto;
  margin-right: auto;
  padding-top: 32px;
}

.content-wrapper-full {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Auth Section Override */
.auth-section {
  background-color: var(--colors-grey-00);
  padding: 32px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  margin: auto;
}

/* =================================
   2. WELCOME & AGENCY SELECTOR
   ================================= */

.welcome-container {
  display: flex;
  width: 100%;
  max-width: 960px;
  background: var(--colors-grey-00);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  margin: auto;
  margin-top: 48px;
}

.welcome-left {
  flex-basis: 50%;
  background-color: var(--colors-grey-40);
}

.welcome-left img {
  width: 100%;
  height: 100%;
}

.welcome-right {
  flex-basis: 50%;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
}

.welcome-right .user-info {
  text-align: left;
}

.agency-list-column {
  flex-basis: 50%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px;
  border-radius: 8px;
}

.agency-box {
  display: flex;
  flex-flow: row;
  justify-content: space-between;
  align-items: center;
  padding: 24px 16px;
  gap: 24px;
  border: 1px solid var(--colors-grey-200);
  background: var(--colors-grey-00);
  color: var(--colors-grey-500);
  cursor: pointer;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: border 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.agency-box:hover {
  border: 1px solid var(--colors-grey-300);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.055);
  color: var(--colors-grey-700);
}

/* Mobile Responsiveness for Layout */
@media screen and (max-width: 768px) {

  .sticky-top-header,
  .main-content {
    padding: 16px;
  }

  .sticky-top-header {
    padding-bottom: 0;
  }

  .sticky-top-header>.wrapper {
    padding-bottom: 0;
  }

  .sticky-top-header>.wrapper>.wrapper {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  #activeUserInfo {
    display: none;
  }

  #agencySelectWrapper {
    flex-direction: column;
    gap: 24px;
    align-items: flex-start;
  }

  .agency-list-column {
    padding: 16px;
    gap: 16px;
  }

  #agencySelectWrapper img {
    display: none;
  }

  #agencySelectWrapper .agency-list-column {
    width: 100%;
  }

  .welcome-container {
    flex-direction: column;
    margin: auto 16px;
    width: auto;
    gap: 16px;
  }

  .welcome-left {
    max-height: 200px;
    flex-basis: auto;
  }

  .welcome-left img {
    max-height: 200px;
    object-fit: contain;
    object-position: top;
  }

  .welcome-right {
    padding: 24px;
    gap: 12px;
    flex-basis: auto;
  }

  #filter-search-section {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 16px;
  }

  #tab-header-with-button {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .quickfilters-container {
    display: none;
  }

  .search-input-wrapper {
    width: 100%;
  }

  #template-form>.preview-container {
    display: none;
  }
}

/* =================================
   3. SENDING VIEW SPECIFICS
   ================================= */

.box-wrapper.button {
  border-color: var(--colors-grey-300);
  background-color: var(--colors-grey-00);
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  box-shadow: none;
}

.box-wrapper.button:hover {
  border-color: var(--colors-brand-500);
  background-color: var(--colors-grey-40);
}

.box-wrapper.button .material-symbols-outlined {
  color: var(--colors-brand-500);
  transition: color 0.2s ease-in-out;
}

.box-wrapper.button:hover .material-symbols-outlined {
  color: var(--colors-brand-700);
}

.box-wrapper.button:active {
  border-color: var(--colors-brand-700);
  background-color: var(--colors-grey-80);
}

/* =================================
   4. STUDENT HISTORY MODAL
   ================================= */

.modal-body.scrollable {
  display: block;
  overflow-y: auto;
  padding: 24px 32px;
  background-color: var(--colors-grey-80);
}

.history-row {
  display: grid;
  grid-template-columns: 160px 240px 96px 1fr 1.5fr;
  gap: 24px;
  align-items: stretch;
  padding: 16px 0;
  border-bottom: 1px solid var(--colors-grey-200);
  min-height: 56px;
}

.history-row.cols3 {
  grid-template-columns: 160px 240px 1fr;
}

.history-row:last-child {
  border-bottom: none;
}

.history-header {
  font-size: 12px;
  font-weight: 500;
  color: var(--colors-grey-500);
  padding-bottom: 8px;
  align-items: end;
  min-height: 40px;
}

.contact-status-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-status-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  min-width: 8px;
  min-height: 8px;
  border-radius: 50%;
}

.status-dot.success {
  background-color: var(--colors-success-500);
}

.status-dot.error {
  background-color: var(--colors-error-500);
}

.status-dot.grey {
  background-color: var(--colors-grey-400);
}

/* =================================
   5. TEMPLATE PREVIEW & ATTACHMENTS
   ================================= */

.preview-container {
  width: 50%;
  padding: 32px;
  overflow-y: auto;
}

#message-preview {
  background: var(--colors-grey-00);
  border: 1px solid var(--colors-grey-300);
  border-radius: 8px;
  padding: 24px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--colors-grey-800);
}

#message-preview * {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
}

#message-preview strong {
  color: var(--colors-grey-900);
  font-weight: bold;
}

#message-preview h1 {
  font-weight: bold;
  font-size: 20px;
}

.schedule-preview {
  background: var(--colors-grey-80);
  border-radius: 4px;
  padding: 16px;
  margin: 16px 0;
  font-size: 13px;
}

.attachmentsList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: var(--colors-grey-00);
  border: 1px solid var(--colors-grey-300);
  border-radius: 4px;
  font-size: 14px;
  color: var(--colors-grey-800);
}

.attachment-item .file-info {
  flex-grow: 1;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.attachment-item .actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 12px;
}

/* Info items (used in modals and headers) */
.info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--colors-grey-700);
}

.info-item .material-symbols-outlined {
  font-size: 20px;
}

.details-header {
  border: 1px solid var(--colors-grey-300);
  background: var(--colors-grey-00);
  border-radius: 8px;
  display: flex;
  flex-direction: row;
  padding: 16px 24px;
  gap: 24px;
}

.details-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

#schedule-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 24px;
  border-left: 1px solid var(--colors-grey-300);
  opacity: 0;
  pointer-events: none;
  cursor: not-allowed;
}

#schedule-options.active {
  opacity: 1;
  pointer-events: auto;
  cursor: default;
}

/* =================================
   6. TRIX EDITOR OVERRIDES
   ================================= */

trix-toolbar .trix-button-group--file-tools {
  display: none;
}

trix-toolbar .trix-button--icon-quote {
  display: none;
}

trix-toolbar .trix-button--icon-code {
  display: none;
}

trix-toolbar .trix-button--icon {
  width: 32px;
  height: 20px;
}

trix-editor {
  min-height: 150px;
  border: 1px solid var(--colors-grey-300);
  border-radius: 4px;
  transition: all 0.2s ease;
  background-color: var(--colors-grey-00);
}

trix-editor:focus {
  border-color: var(--colors-grey-700);
}

trix-toolbar {
  padding: 0%;
  margin: 0;
}

trix-toolbar .trix-button {
  background: none;
  border: none;
  color: var(--colors-grey-700);
  transition: color 0.2s, background-color 0.2s;
}

trix-toolbar .trix-button-group {
  margin: 0;
  border: 1px solid var(--colors-grey-300);
  border-radius: 4px;
}

trix-toolbar .trix-button:hover {
  background-color: var(--colors-grey-200);
  color: var(--colors-grey-900);
}

trix-toolbar .trix-button.trix-active {
  background-color: var(--colors-brand-50);
  color: var(--colors-grey-900);
}

trix-toolbar .trix-button.trix-active:hover {
  background-color: var(--colors-brand-100);
}

#trix-body-editor *,
#trix-ending-editor * {
  font-family: Verdana, Geneva, Tahoma, sans-serif !important;
  font-size: 14px;
  background-color: var(--colors-grey-00);
}

#trix-body-editor h1,
#trix-ending-editor h1 {
  font-size: 20px;
  letter-spacing: -1px;
  font-weight: bold;
}

#trix-body-editor strong,
#trix-ending-editor strong {
  font-weight: 600;
}

trix-editor a,
trix-editor a:visited,
#message-preview a,
#message-preview a:visited {
  color: var(--colors-brand-500);
  font-weight: bold;
  text-decoration: underline;
}

.trix-dialog__link-fields {
  position: relative;
  padding-bottom: 18px !important;
}

.trix-dialog__link-fields input[name="href"]:invalid:not(:placeholder-shown)~.trix-button-group::after {
  content: "Adres musi zaczynać się od https://";
  position: absolute;
  left: 0;
  bottom: 0;
  font-size: 11px;
  color: var(--colors-error-500);
  pointer-events: none;
}

/* =================================
   7. CONTEXT SELECTOR
   ================================= */

.context-selector-wrapper {
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}

.context-selector-wrapper.active {
  opacity: 1;
  pointer-events: all;
}

.context-selector-wrapper .select-display {
  background-color: var(--colors-grey-100);
}

.context-selector-wrapper.active .select-display {
  background-color: var(--colors-grey-00);
}