/* Colors come from the brand of the request host (--brand-* variables, set in App.razor). */

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #fafafa;
  color: rgba(0, 0, 0, .87);
}

a { color: var(--brand-primary); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Toolbar */

.toolbar {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 72px;
  padding: 6px 20px;
  box-sizing: border-box;
  background: var(--brand-primary);
  color: var(--brand-on-primary);
}

.toolbar-logo { display: flex; }
.toolbar-logo img { height: 60px; width: auto; }

.toolbar-title { flex: 1; }
.toolbar-title h1 { margin: 0; font-size: 1.4rem; font-weight: 400; }

.toolbar-actions a { color: var(--brand-on-primary); }

.content {
  flex: 1;
  padding: 0 16px 48px;
}

/* Search */

.search-box {
  display: flex;
  align-items: center;
  width: min(500px, 100%);
  margin: 16px auto;
  box-sizing: border-box;
  background: var(--brand-muted);
  border: 2px solid var(--brand-accent);
  border-radius: 25px;
}

.search-box .material-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  border-radius: 25px;
  background: var(--brand-primary);
  color: var(--brand-on-primary);
}

.search-box input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--brand-primary);
  font: inherit;
  font-weight: bold;
}

/* File list */

.file-group {
  max-width: 1130px;
  margin: 40px auto;
}

.group-heading {
  margin: 0 0 0 0;
  font-size: larger;
  font-weight: 400;
  color: var(--brand-on-muted);
}

.file-card {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(max-content, .9fr) minmax(max-content, 1.1fr) minmax(0, 5fr) 48px 64px;
  align-items: center;
  max-width: 1080px;
  min-height: 73px;
  margin: 15px auto;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 1px -1px rgba(0, 0, 0, .2), 0 1px 1px rgba(0, 0, 0, .14), 0 1px 3px rgba(0, 0, 0, .12);
  overflow: hidden;
}

.file-card > div { padding: 12px; overflow-wrap: anywhere; }

.file-name { font-weight: bold; color: var(--brand-primary); }
.file-card > .file-version,
.file-card > .file-date { white-space: nowrap; overflow-wrap: normal; }

.file-release-notes a { display: flex; color: var(--brand-primary); text-decoration: none; }
.file-release-notes .material-icons { font-size: 32px; }

.file-download {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  text-decoration: none;
}

.file-download .material-icons { font-size: 40px; }

@media (max-width: 640px) {
  .file-card {
    grid-template-columns: minmax(0, 1fr) auto 48px 64px;
    grid-template-areas:
      "name    version notes-link download"
      "date    date    notes-link download"
      "notes   notes   notes-link download";
  }
  .file-name { grid-area: name; }
  .file-version { grid-area: version; }
  .file-date { grid-area: date; padding-top: 0 !important; }
  .file-notes { grid-area: notes; padding-top: 0 !important; }
  .file-release-notes { grid-area: notes-link; }
  .file-download { grid-area: download; }
}

/* Messages and text pages */

.message {
  text-align: center;
  margin: 32px auto;
}

.release-notes,
.text-page,
.privacy {
  max-width: 830px;
  margin: 24px auto;
  padding: 8px 24px 24px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.release-notes h1 { font-size: 1.5rem; color: var(--brand-primary); }
.release-notes h2 { font-size: 1.2rem; }
.release-notes h3 { font-size: 1rem; }
.privacy h1 { font-size: 1.5rem; }
.privacy h2 { font-size: 1.1rem; }

/* Offline update */

.rounded-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: min(400px, 100%);
  height: 40px;
  margin: 32px auto 10px;
  box-sizing: border-box;
  border: 2px solid var(--brand-accent);
  border-radius: 25px;
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  font-size: 14pt;
  cursor: pointer;
}

.rounded-button:focus-within { outline: 3px solid var(--brand-accent); outline-offset: 2px; }

.rounded-button input[type=file] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Footer (impressum) */

.impressum {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 30px;
  padding: 8px 15px;
  background: var(--brand-muted);
  color: var(--brand-on-muted);
  font-weight: bold;
}

.impressum p { margin: 8px 0; }
.impressum a { color: var(--brand-on-muted); }
.impressum .version { margin-left: auto; font-weight: normal; opacity: .7; }

/* Account in the toolbar */

.toolbar-actions { display: flex; align-items: center; gap: 16px; }
.toolbar-user { opacity: .85; }
.inline-form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.link-button {
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* Admin pages (DevExpress components bring their own styles) */

.admin-page { max-width: 1100px; margin: 24px auto; }

.admin-nav { display: flex; gap: 4px; border-bottom: 2px solid var(--brand-primary); margin-bottom: 16px; }
.admin-nav a {
  padding: 8px 16px;
  border-radius: 4px 4px 0 0;
  text-decoration: none;
  color: var(--brand-primary);
}
.admin-nav a.active { background: var(--brand-primary); color: var(--brand-on-primary); }

.admin-page h2 { font-size: 1.1rem; margin-top: 32px; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.admin-table th, .admin-table td { padding: 8px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid #eee; }
.admin-table th { background: var(--brand-muted); color: var(--brand-on-muted); font-weight: 500; }
.admin-table tr.inactive td { opacity: .5; }

.hint, .muted { color: rgba(0, 0, 0, .6); }

.notice { padding: 12px 16px; border-radius: 4px; }
.notice-success { background: #e8f5e9; border: 1px solid #a5d6a7; }
.notice-error { background: #ffebee; border: 1px solid #ef9a9a; }
.new-key code { display: block; padding: 8px; background: #fff; font-size: 1.05rem; user-select: all; overflow-wrap: anywhere; }

@media (max-width: 800px) {
  .admin-table { display: block; overflow-x: auto; }
}

/* DevExpress admin area (phase 4) */

.admin-grid { margin: 16px 0 24px; }
.admin-heading { display: flex; align-items: baseline; gap: 8px; font-size: 1.15rem; font-weight: 500; margin: 16px 0 8px; }
.admin-heading a { text-decoration: none; }
.admin-heading-link { margin-left: auto; font-size: .9rem; font-weight: 400; }
.grid-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.form-buttons { display: flex; gap: 8px; margin-top: 8px; }
.form-value { line-height: 32px; }
.file-form { max-width: 1000px; background: #fff; padding: 8px 16px 16px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.inline-upload summary { cursor: pointer; color: var(--brand-primary); }
.staging-upload { margin: 16px 0; }

#blazor-error-ui {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 12px 16px;
  background: #fff3cd;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, .2);
}
