/* SportBash Layout — единая структура экранов, списков, форм, адаптив */

/* ——— Responsive shell ——— */
@media (min-width: 480px) {
  :root { --app-max-width: 480px; }
}

@media (min-width: 768px) {
  :root { --app-max-width: 540px; }

  .app-viewport {
    padding: 20px 16px;
    align-items: flex-start;
  }

  .app-device {
    min-height: calc(100vh - 40px);
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.6);
  }

  .bottom-nav {
    border-radius: 0 0 28px 28px;
  }
}

@media (min-width: 1100px) {
  :root { --app-max-width: 580px; }
}

/* ——— Page structure ——— */
.screen {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.screen-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.screen-section {
  margin-bottom: 4px;
}

.screen-section + .screen-section {
  margin-top: 8px;
}

.screen-footer {
  margin-top: 16px;
  padding-top: 4px;
}

.screen-footer .btn-outline,
.screen-footer .btn-primary-gradient {
  width: 100%;
}

/* ——— Topbar v2 ——— */
.app-topbar {
  padding: 0 12px 0 16px;
  gap: 8px;
}

.app-topbar-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-topbar-actions {
  flex-shrink: 0;
  gap: 6px;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  text-decoration: none;
  position: relative;
  transition: background 0.15s, color 0.15s, transform 0.12s;
}

.topbar-btn .material-symbols {
  font-size: 20px;
}

.topbar-btn:active {
  transform: scale(0.94);
}

.topbar-btn.is-active {
  background: rgba(232, 177, 62, 0.2);
  border-color: var(--kurai-gold);
  color: #6b5210;
}

.topbar-btn--danger:hover,
.topbar-btn--danger:active {
  color: var(--energy-red);
}

.role-chip {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ——— Headers ——— */
.page-header {
  margin: 0 0 12px;
  padding: 18px 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--flag-blue) 0%, var(--flag-blue-dark) 100%);
  color: #fff;
  box-shadow: 0 6px 20px rgba(44, 95, 154, 0.28);
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  width: 140px;
  height: 140px;
  right: -40px;
  top: -50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  pointer-events: none;
}

.page-header__row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.page-header__icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 24px;
}

.page-header__icon .material-symbols {
  font-size: 26px;
}

.page-header__body {
  flex: 1;
  min-width: 0;
}

.page-header__title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.page-header__subtitle {
  margin: 0;
  font-size: 13px;
  opacity: 0.92;
  line-height: 1.4;
}

.page-header--compact {
  padding: 14px 16px;
}

.page-header--compact .page-header__title {
  font-size: 18px;
}

.page-header--green {
  background: linear-gradient(135deg, var(--flag-green), #2d6328);
  box-shadow: 0 6px 20px rgba(58, 125, 52, 0.28);
}

.page-header--gold {
  background: linear-gradient(135deg, #c49000, #8a6a12);
  box-shadow: 0 6px 20px rgba(196, 144, 0, 0.28);
}

/* alias */
.flutter-header {
  margin: 0 0 12px;
  padding: 18px 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--flag-blue), var(--flag-blue-dark));
  color: #fff;
  box-shadow: 0 6px 20px rgba(44, 95, 154, 0.28);
  position: relative;
  overflow: hidden;
}

.flutter-header .row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.flutter-header h1 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
}

.flutter-header p {
  margin: 0;
  font-size: 13px;
  opacity: 0.92;
}

.flutter-header .icon-box {
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  font-size: 24px;
  flex-shrink: 0;
}

/* ——— Section headers ——— */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 2px 10px;
  padding: 0 4px;
}

.section-header__title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-events);
  letter-spacing: -0.01em;
}

.section-header__link {
  font-size: 13px;
  font-weight: 600;
  color: var(--flag-blue);
  text-decoration: none;
  white-space: nowrap;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 2px 10px;
  padding: 0 4px;
}

.section-title-row h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-events);
}

/* ——— Cards ——— */
.list-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.m-card {
  margin-bottom: 0;
  transition: transform 0.12s, box-shadow 0.15s;
}

.m-card:hover {
  box-shadow: 0 6px 20px rgba(44, 95, 154, 0.1);
}

.m-card-row {
  align-items: center;
}

.m-card-main {
  flex: 1;
  min-width: 0;
}

.m-card-chevron {
  flex-shrink: 0;
  color: var(--text-hint);
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  margin-left: 4px;
}

.m-card--compact .m-card-body {
  padding: 10px 14px;
}

.m-card--compact h3,
.m-card--compact strong {
  font-size: 14px;
}

.m-card-icon--blue {
  background: rgba(44, 95, 154, 0.12);
  color: var(--flag-blue);
}

.m-card-icon--green {
  background: rgba(58, 125, 52, 0.12);
  color: var(--flag-green);
}

.m-card-icon--gold {
  background: rgba(232, 177, 62, 0.18);
  color: #8a6a12;
}

.m-card-icon--purple {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
}

/* ——— Detail tiles ——— */
.detail-tile {
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: transform 0.12s, box-shadow 0.15s;
}

.detail-tile .tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 20px;
}

.detail-tile .tile-icon.material-symbols {
  font-size: 22px;
}

.detail-tile strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.detail-tile .meta {
  font-size: 12px;
  line-height: 1.35;
}

/* ——— Detail rows ——— */
.detail-row {
  padding: 10px 0;
  gap: 16px;
}

.detail-row .meta {
  flex-shrink: 0;
  max-width: 45%;
  font-size: 13px;
  color: var(--text-secondary);
}

.detail-row strong {
  text-align: right;
  font-weight: 600;
  color: var(--text-events);
  word-break: break-word;
}

/* ——— Forms ——— */
.form-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-stack .form-field {
  margin-bottom: 14px;
}

.form-stack .form-field:last-child {
  margin-bottom: 0;
}

.form-stack label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.form-actions--row {
  flex-direction: row;
}

.form-actions--row .btn-outline,
.form-actions--row .btn-primary-gradient {
  flex: 1;
}

/* ——— Buttons ——— */
.btn-block {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-decoration: none;
}

.btn-block--md {
  height: 48px;
  font-size: 14px;
}

.btn-block--sm {
  height: 42px;
  font-size: 13px;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-row .btn-outline,
.btn-row .btn-primary-gradient {
  flex: 1;
  min-width: 120px;
}

/* ——— Chips & filters ——— */
.filter-row {
  padding: 2px 0 14px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  white-space: nowrap;
}

.filter-chip .material-symbols {
  font-size: 16px;
}

/* ——— Sub-tabs ——— */
.sub-tabs {
  margin-bottom: 14px;
  padding: 4px;
  background: #eef1f5;
  border: none;
  border-radius: 14px;
  gap: 4px;
  display: flex;
}

.sub-tabs a {
  flex: 1;
  padding: 10px 8px;
  border-radius: 11px;
  font-size: 12px;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.sub-tabs a.active {
  background: #fff;
  color: var(--flag-blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ——— Empty & alerts ——— */
.empty-state {
  padding: 40px 24px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed var(--card-border);
}

.flash {
  margin: 0 0 12px;
  border-radius: var(--radius);
}

.flash a {
  color: inherit;
  font-weight: 600;
}

/* ——— Back link ——— */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--flag-blue);
  text-decoration: none;
}

.back-link .material-symbols {
  font-size: 18px;
}

/* ——— Newsfeed strip ——— */
.feed-strip {
  margin: 16px 0 8px;
}

.feed-strip__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}

.feed-strip__title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.feed-strip__link {
  font-size: 13px;
  font-weight: 600;
  color: var(--flag-blue);
  text-decoration: none;
}

.feed-strip__text {
  margin: 4px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ——— Quick actions ——— */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

/* ——— App content padding ——— */
.app-content {
  padding: 14px 14px 12px;
}

.app-scroll {
  -webkit-overflow-scrolling: touch;
}

/* ——— Material symbols base ——— */
.material-symbols {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ——— Public shell ——— */
.sportbash-public .public-main {
  max-width: var(--app-max-width);
}

/* ——— Utility ——— */
.u-hidden { display: none !important; }
.u-text-center { text-align: center; }
.u-mt-0 { margin-top: 0 !important; }
.u-mb-12 { margin-bottom: 12px !important; }
.u-mb-16 { margin-bottom: 16px !important; }
.u-gap-sm { gap: 8px; }

.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-flash {
  max-width: var(--app-max-width);
  margin: 12px auto;
}

.flash-action {
  margin-top: 8px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.m-card--link {
  cursor: pointer;
}

.banner-warn--link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.banner-warn__icon {
  font-size: 16px;
  vertical-align: middle;
}

.qr-scanner-chip--green {
  background: rgba(58, 125, 52, 0.15);
  color: var(--flag-green);
}

.qr-scanner-chip--teal {
  background: rgba(5, 150, 105, 0.12);
  color: #059669;
}

.qr-scanner-chip--purple {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
}

.qr-scanner-chip--outline {
  background: #fff;
  color: var(--flag-blue);
  border: 1px solid var(--card-border);
  box-shadow: none;
}

.flash-wrap {
  padding-bottom: 0 !important;
}

.profile-header-initial {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}

.linking-code {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  margin: 8px 0;
  color: var(--flag-blue-dark);
}

/* Глобально: любой input/select/textarea в формах */
.app-content input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.app-content select,
.app-content textarea {
  font-family: inherit;
}

.app-content form input[style*="width:100%"],
.app-content form select[style*="width:100%"],
.app-content form textarea[style*="width:100%"] {
  width: 100% !important;
  padding: 12px 14px !important;
  border: 1px solid var(--card-border) !important;
  border-radius: 12px !important;
  font-size: 15px !important;
  background: #f8fafc !important;
  margin-bottom: 10px;
}
