/* MarsGit — Custom Theme
   Mars Design System: #7C3AED purple, Inter + JetBrains Mono */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* === Color overrides === */
:root {
  --color-primary: #7C3AED !important;
  --color-primary-dark-1: #6D28D9 !important;
  --color-primary-light-1: #8B5CF6 !important;
  --color-primary-light-2: #A78BFA !important;
  --color-primary-light-3: #C4B5FD !important;
  --color-primary-light-4: #DDD6FE !important;
  --color-primary-light-5: #EDE9FE !important;
  --color-primary-light-6: #F5F3FF !important;
  --color-primary-alpha-10: rgba(124, 58, 237, 0.1) !important;
  --color-primary-alpha-20: rgba(124, 58, 237, 0.2) !important;
  --color-primary-alpha-30: rgba(124, 58, 237, 0.3) !important;
  --color-primary-alpha-40: rgba(124, 58, 237, 0.4) !important;
}

/* === Typography === */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.markdown code,
.CodeMirror,
code,
pre,
.mono,
.diff-file-box .code-diff,
.repository .code-view .lines-code {
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace !important;
}

/* === Navbar === */
.ui.secondary.pointing.menu .active.item,
.ui.secondary.pointing.menu .active.item:hover {
  border-color: #7C3AED;
}

/* Top bar styling */
nav.navbar {
  background: #fff !important;
  border-bottom: 1px solid #E5E5E5 !important;
  box-shadow: none !important;
}

/* === Buttons === */
.ui.primary.button,
.ui.primary.buttons .button,
a.ui.primary.button {
  background-color: #7C3AED !important;
  border-radius: 8px !important;
}

.ui.primary.button:hover,
.ui.primary.buttons .button:hover,
a.ui.primary.button:hover {
  background-color: #6D28D9 !important;
}

.ui.primary.button:active,
.ui.primary.buttons .button:active {
  background-color: #5B21B6 !important;
}

/* Basic/outline buttons */
.ui.basic.primary.button,
.ui.basic.primary.buttons .button {
  color: #7C3AED !important;
  border-color: #7C3AED !important;
  border-radius: 8px !important;
}

.ui.basic.primary.button:hover {
  color: #6D28D9 !important;
  border-color: #6D28D9 !important;
  background: #F5F3FF !important;
}

/* All buttons get rounded corners */
.ui.button {
  border-radius: 8px !important;
}

/* === Links === */
a {
  color: #7C3AED;
}

a:hover {
  color: #6D28D9;
}

/* === Labels / Badges === */
.ui.label.primary,
a.ui.label.primary {
  background-color: #7C3AED !important;
}

/* === Repo header === */
.repository .repo-header {
  border-bottom: 1px solid #E5E5E5;
}

/* === Cards / Segments === */
.ui.segment {
  border-radius: 12px !important;
  border: 1px solid #E5E5E5 !important;
  box-shadow: none !important;
}

/* === Input fields === */
.ui.input input,
.ui.form input:not([type]),
.ui.form input[type="text"],
.ui.form input[type="email"],
.ui.form input[type="password"],
.ui.form textarea,
.ui.selection.dropdown {
  border-radius: 8px !important;
  border-color: #E5E5E5 !important;
}

.ui.input input:focus,
.ui.form input:focus,
.ui.form textarea:focus {
  border-color: #7C3AED !important;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15) !important;
}

/* === Sign-in page — redesigned === */

/* Background: warm off-white with subtle dot pattern (matches Mars ID style) */
body.signin .full.height {
  background: #fffff8;
  background-image: radial-gradient(#e7e5e4 1px, transparent 1px);
  background-size: 22px 22px;
  min-height: calc(100vh - 110px);
  padding-top: 80px !important;
}

/* The main login container */
.signin .column {
  max-width: 440px !important;
}

/* Card wrapping the login form */
.signin .ui.form {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 24px;
  padding: 48px 40px !important;
  box-shadow: 0 20px 60px rgba(124, 58, 237, 0.08);
  margin: 0 !important;
}

/* Hide the default segment title "Sign In" */
.signin .ui.form .header.center,
.signin h4.ui.dividing.header {
  display: none !important;
}

/* Add our own header via pseudo-element */
.signin .ui.form::before {
  content: '';
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  background-image: url('/assets/img/logo.svg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 16px;
}

/* Custom heading injected via CSS */
.signin .ui.form > .inline.required.field:first-of-type::before,
.signin .ui.form > h2.mg-signin-title {
  display: none;
}

/* OAuth login buttons — make them prominent */
.signin .oauth2-login-navigator {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 !important;
}

.signin .oauth2-login-navigator .oauth-login-link,
.signin .oauth2-login-navigator a {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #1a1a1a !important;
  color: #fff !important;
  border: 3px solid #1a1a1a !important;
  border-radius: 14px !important;
  padding: 14px 24px !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  box-shadow: 5px 5px 0 #7C3AED !important;
  transition: all 0.15s ease !important;
  text-decoration: none !important;
  text-transform: none !important;
  width: 100% !important;
}

.signin .oauth2-login-navigator .oauth-login-link:hover,
.signin .oauth2-login-navigator a:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 #7C3AED !important;
  color: #fff !important;
}

/* Replace Telegram icon with inline SVG via pseudo — hide default */
.signin .oauth2-login-navigator img,
.signin .oauth2-login-navigator svg {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

/* Forgot password / OR separator / registration — hide */
.signin .field .forget-password,
.signin .oauth2-login-navigator-divider,
.signin .ui.divider,
.signin .or,
.signin .oauth2-login-navigator ~ .field {
  display: none !important;
}

/* Trust line below the card */
.signin .column::after {
  content: '🔒 Безопасный вход через Telegram';
  display: block;
  text-align: center;
  margin-top: 20px;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  color: #999;
}

/* === Landing / Home ===
   Custom landing page — styles are in home.tmpl override */

/* === Footer === */
.page-footer {
  background: #FAFAFA !important;
  border-top: 1px solid #E5E5E5 !important;
}

/* Hide Powered by Forgejo */
.page-footer .left-links {
  display: none !important;
}

/* Hide Licenses and API links */
.page-footer .right-links a[href*="licenses"],
.page-footer .right-links a[href*="swagger"] {
  display: none !important;
}

/* Center the language selector */
.page-footer .right-links {
  width: 100%;
  justify-content: center;
}

/* === Misc cleanups === */

/* Softer shadows */
.ui.card,
.ui.cards > .card {
  border-radius: 12px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  border: 1px solid #E5E5E5 !important;
}

.ui.card:hover,
.ui.cards > .card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
  transform: translateY(-1px);
}

/* Active menu items */
.ui.menu .active.item {
  color: #7C3AED !important;
}

/* Selection highlight */
::selection {
  background: rgba(124, 58, 237, 0.2);
}

/* Checkbox & toggle */
.ui.checkbox input:checked ~ label:before,
.ui.toggle.checkbox input:checked ~ label:before {
  background-color: #7C3AED !important;
}

/* Progress bars */
.ui.progress .bar {
  background-color: #7C3AED !important;
}

/* Pagination active */
.ui.pagination.menu .active.item {
  background-color: #7C3AED !important;
  color: #fff !important;
}

/* Contribution graph colors */
.heatmap-color-1 { background-color: #EDE9FE !important; }
.heatmap-color-2 { background-color: #C4B5FD !important; }
.heatmap-color-3 { background-color: #8B5CF6 !important; }
.heatmap-color-4 { background-color: #7C3AED !important; }
.heatmap-color-5 { background-color: #6D28D9 !important; }

/* Diff additions/deletions keep green/red */

/* OAuth login button — make it prominent on sign-in */
.signin .oauth2-login-navigator .oauth-login-link {
  background: #7C3AED !important;
  color: #fff !important;
  border: none !important;
  border-radius: 10px !important;
  padding: 14px 24px !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  text-align: center !important;
  display: block !important;
  transition: background 0.15s ease !important;
}

.signin .oauth2-login-navigator .oauth-login-link:hover {
  background: #6D28D9 !important;
}

/* =============================================
   PROFILE PAGE — Mars redesign
   Override of templates/user/profile.tmpl +
   templates/shared/user/profile_big_avatar.tmpl
   ============================================= */

.mg-profile-page .ui.container { padding-top: 16px; }

/* --- Welcome / orientation hero (own profile) --- */
.mg-welcome {
  background: #fff;
  border: 1px solid #ECECEC;
  border-radius: 16px;
  padding: 18px 22px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) 2fr;
  gap: 22px;
  align-items: center;
}
.mg-welcome-head { min-width: 0; }
.mg-welcome-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: #7C3AED;
  margin-bottom: 6px;
  font-weight: 700;
}
.mg-welcome-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: 1.55rem;
  line-height: 1.1;
  color: #1a1a1a;
  margin: 0 0 6px 0;
}
.mg-welcome-sub {
  color: #666;
  font-size: 0.82rem;
  margin: 0;
  line-height: 1.45;
}
.mg-welcome-sub code {
  background: #F5F3FF;
  color: #6D28D9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.92em;
}

/* Onboarding steps — compact 2x2 grid */
.mg-welcome-steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.mg-step {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FAFAFA;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 12px;
  text-decoration: none !important;
  color: #1a1a1a !important;
  transition: all 0.15s ease;
  position: relative;
  min-height: 48px;
}
.mg-step:hover {
  background: #fff;
  border-color: #C4B5FD;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(124,58,237,0.08);
}
.mg-step-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  background: #F5F3FF;
  border-radius: 8px;
  color: #7C3AED;
  flex-shrink: 0;
}
.mg-step-icon svg { fill: currentColor; }
.mg-step:hover .mg-step-icon { background: #7C3AED; color: #fff; }
.mg-step-body { flex: 1; min-width: 0; line-height: 1.2; }
.mg-step-title {
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: -0.01em;
}
.mg-step-desc {
  font-size: 0.7rem;
  color: #888;
  margin-top: 1px;
}
.mg-step.mg-step-done {
  background: #ECFDF5;
  border-color: #A7F3D0;
}
.mg-step.mg-step-done .mg-step-icon {
  background: #10B981;
  color: #fff;
}
.mg-step.mg-step-done .mg-step-title { color: #047857; }
.mg-step.mg-step-done .mg-step-desc { color: #059669; }
.mg-step.mg-step-done::after {
  content: '✓';
  position: absolute;
  top: 50%; right: 11px;
  transform: translateY(-50%);
  color: #10B981;
  font-weight: 700;
  font-size: 0.95rem;
}

/* --- Visitor banner (other person's profile) --- */
.mg-visitor {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FAFAFA;
  border: 1px solid #ECECEC;
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 0.84rem;
}
.mg-visitor-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  color: #7C3AED;
  font-weight: 700;
  padding-right: 10px;
  border-right: 1px solid #DDD;
}
.mg-visitor-text { color: #555; }
.mg-visitor-text strong { color: #1a1a1a; }
.mg-visitor-text a {
  color: #7C3AED;
  font-weight: 600;
  text-decoration: none;
  margin-left: 4px;
}

/* --- Redesigned avatar card --- */
.mg-profile-card.ui.card {
  border-radius: 20px !important;
  border: 1px solid #E5E5E5 !important;
  overflow: hidden !important;
  padding: 0 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
  background: #fff;
}

.mg-profile-cover {
  height: 96px;
  background:
    linear-gradient(135deg, #6D28D9 0%, #7C3AED 45%, #A78BFA 100%);
  position: relative;
  overflow: hidden;
}
.mg-profile-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 18% 60%, rgba(255,255,255,0.18) 0, transparent 35%),
    radial-gradient(circle at 82% 20%, rgba(255,255,255,0.12) 0, transparent 32%),
    repeating-linear-gradient(135deg, transparent 0 18px, rgba(255,255,255,0.05) 18px 19px);
}

.mg-profile-avatar-wrap {
  margin-top: -72px;
  padding: 0 20px;
  text-align: center;
  position: relative;
  z-index: 2;
}
.mg-profile-avatar {
  display: inline-block;
  position: relative;
}
.mg-profile-avatar img {
  width: 132px !important;
  height: 132px !important;
  border-radius: 20px !important;
  border: 5px solid #fff !important;
  box-shadow: 0 8px 24px rgba(31,18,87,0.18);
  background: #fff;
}

.mg-profile-identity {
  text-align: center;
  padding: 12px 20px 4px;
}
.mg-profile-fullname {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.15;
  color: #1a1a1a;
  margin: 0 0 4px 0;
  word-break: break-word;
}
.mg-profile-username {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: #777;
  word-break: break-word;
}
.mg-profile-username .mg-at { color: #C4B5FD; }
.mg-profile-username .mg-pronouns { color: #999; }

/* Mars ID badges row (filled by JS) */
.mg-profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 12px;
  min-height: 0;
}
.mg-profile-badges:empty { margin-top: 0; }
.mg-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #F5F3FF;
  color: #6D28D9;
  border: 1px solid #DDD6FE;
  text-decoration: none !important;
}
.mg-badge svg { width: 12px; height: 12px; fill: currentColor; }
.mg-badge.mg-badge-role {
  background: #7C3AED;
  color: #fff;
  border-color: transparent;
}
.mg-badge.mg-badge-tg {
  background: #fff;
  color: #229ED9;
  border-color: #BAE0F4;
}
.mg-badge.mg-badge-tg:hover {
  background: #E0F2FA;
}

/* Meta line (followers / following / actions) */
.mg-profile-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px 14px;
  font-size: 0.8rem;
  color: #777;
  border-bottom: 1px solid #F2F2F2;
}
.mg-profile-meta-link {
  color: #555 !important;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.mg-profile-meta-sep { color: #ccc; }
.mg-profile-meta-link:hover { color: #7C3AED !important; }

.mg-profile-actions-trigger details summary {
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #E5E5E5;
  cursor: pointer;
}
.mg-profile-actions-trigger details[open] summary,
.mg-profile-actions-trigger details summary:hover {
  background: #F5F3FF;
  border-color: #C4B5FD;
}

/* Follow button row */
.mg-profile-follow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
}
.mg-profile-follow .ui.button { border-radius: 10px !important; }

/* Quick actions (owner) */
.mg-profile-quickactions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 12px 16px 4px;
}
.mg-quick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 10px;
  background: #FAFAFA;
  border: 1px solid #EEE;
  color: #555 !important;
  text-decoration: none !important;
  font-size: 0.72rem;
  font-weight: 500;
  transition: all 0.15s ease;
}
.mg-quick:hover {
  background: #F5F3FF;
  border-color: #C4B5FD;
  color: #7C3AED !important;
  transform: translateY(-1px);
}
.mg-quick svg { fill: currentColor; }

/* Extra meta (location, email, joined, deploys, orgs, badges) */
.mg-profile-extra {
  padding: 14px 20px 18px;
}
.mg-profile-extra ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mg-profile-extra > ul > li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 0.85rem;
  color: #555;
  word-break: break-word;
}
.mg-profile-extra > ul > li > svg {
  flex-shrink: 0;
  color: #999;
  fill: currentColor;
}
.mg-profile-extra a { color: #555 !important; text-decoration: none !important; }
.mg-profile-extra a:hover { color: #7C3AED !important; }
.mg-profile-bio { display: block !important; }
.mg-profile-bio .render-content {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #444;
}

/* Deployed sites (MarshHub) */
.mg-profile-deploys[hidden] { display: none !important; }
.mg-profile-deploys {
  display: block !important;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #EEE;
}
.mg-deploys-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #999;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.mg-deploys-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.mg-deploy-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  background: #F5F3FF;
  color: #6D28D9 !important;
  border: 1px solid #DDD6FE;
  font-family: 'JetBrains Mono', monospace;
  text-decoration: none !important;
}
.mg-deploy-link:hover {
  background: #7C3AED;
  color: #fff !important;
  border-color: #7C3AED;
}

.mg-profile-extra .user-orgs,
.mg-profile-extra .user-badges {
  display: flex !important;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0;
  list-style: none;
  margin-top: 6px;
}
.mg-profile-extra .user-orgs img { border-radius: 8px; width: 32px; height: 32px; }

/* Mobile tweaks */
@media (max-width: 700px) {
  .mg-welcome { padding: 22px 20px; border-radius: 16px; }
  .mg-welcome-title { font-size: 1.6rem; }
  .mg-welcome-steps { grid-template-columns: 1fr; }
  .mg-profile-quickactions { grid-template-columns: repeat(3, 1fr); }
}
