/* =========================================================
   MISTFALL LAB — 1:1 EXACT THEORYCRAFTER.GG DESIGN THEME
   Self-contained stylesheet (Zero external conflicts)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;800;900&family=Tajawal:wght@400;500;700;800;900&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --mf-bg: #090c10;
  --mf-bg-surface: #0e121a;
  --mf-bg-card: #131722;
  --mf-bg-card-hover: #181e2b;
  --mf-border: rgba(255, 255, 255, 0.08);
  --mf-border-hover: rgba(255, 255, 255, 0.22);
  --mf-primary: #5865f2;
  --mf-accent: #6ee7b7;
  --mf-gold: #f59e0b;
  --mf-crimson: #ef4444;
  --mf-purple: #a855f7;
  --mf-blue: #38bdf8;
  --mf-green: #10b981;
  --mf-text: #f3f4f6;
  --mf-text-muted: #9ca3af;
  --mf-font-display: 'Cinzel', 'Tajawal', Georgia, serif;
  --mf-font-body: 'Inter', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body.mistfall-standalone {
  background-color: var(--mf-bg);
  background-image: 
    radial-gradient(circle at 10% 15%, rgba(88, 101, 242, 0.08) 0, transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(168, 85, 247, 0.07) 0, transparent 45%),
    radial-gradient(circle at 50% 90%, rgba(16, 185, 129, 0.06) 0, transparent 50%);
  color: var(--mf-text);
  font-family: var(--mf-font-body);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  direction: ltr !important;
  text-align: left !important;
}

/* NAVBAR */
.mf-navbar {
  background: rgba(11, 15, 22, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 12px 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mf-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: #fff;
}

.mf-brand-logo-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #a855f7, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.35);
}

.mf-brand-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.mf-brand-text h1 {
  margin: 0;
  font-family: var(--mf-font-display);
  font-size: 1.15rem;
  letter-spacing: 1px;
  color: #fff;
}

.mf-brand-text p {
  margin: 0;
  font-size: 0.72rem;
  color: var(--mf-text-muted);
}

.mf-nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mf-nav-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--mf-text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.mf-nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.mf-nav-btn.active {
  background: rgba(88, 101, 242, 0.25);
  color: #fff;
  border-color: #5865f2;
}

.mf-nav-btn.discord {
  background: rgba(88, 101, 242, 0.18);
  border-color: rgba(88, 101, 242, 0.4);
  color: #c7d2fe;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
  font-family: inherit;
}

.btn-primary {
  background: #5865f2;
  color: #fff;
}
.btn-primary:hover {
  background: #4752c4;
}

.btn-success {
  background: #238636;
  border: 1px solid #2ea043;
  color: #fff;
}
.btn-success:hover {
  background: #2ea043;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.78rem;
  border-radius: 6px;
}

/* CARDS & INPUTS */
.card {
  background: var(--mf-bg-surface);
  border: 1px solid var(--mf-border);
  border-radius: 12px;
  padding: 20px;
}

.form-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
}
.form-input:focus {
  border-color: #5865f2;
}

/* THEORYCRAFTER PAGE HEADER */
.mf-tc-header {
  margin-bottom: 24px;
  text-align: left;
}

.mf-tc-eyebrow {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #a3e635;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.mf-tc-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.mf-tc-h1 {
  font-family: var(--mf-font-display);
  font-size: 2.8rem;
  margin: 0;
  color: #fff;
  line-height: 1.1;
  font-weight: 800;
}

.mf-tc-subtitle {
  color: var(--mf-text-muted);
  font-size: 0.95rem;
  margin: 0;
  max-width: 800px;
}

.mf-tc-tabs {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
}

.mf-tc-tab {
  background: transparent;
  border: none;
  color: var(--mf-text-muted);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
  position: relative;
  transition: color 0.2s ease;
  font-family: inherit;
}

.mf-tc-tab:hover {
  color: #fff;
}

.mf-tc-tab.active {
  color: #a3e635;
}

.mf-tc-tab.active::after {
  content: '';
  position: absolute;
  bottom: -11px;
  left: 0;
  right: 0;
  height: 2px;
  background: #a3e635;
}

/* THEORYCRAFTER FILTER BAR */
.mf-tc-filter-card {
  background: var(--mf-bg-surface);
  border: 1px solid var(--mf-border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mf-tc-search-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px 18px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
  font-family: inherit;
}

.mf-tc-search-input:focus {
  border-color: #5865f2;
}

.mf-tc-selects-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  width: 100%;
}

@media (max-width: 1200px) {
  .mf-tc-selects-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 700px) {
  .mf-tc-selects-row {
    grid-template-columns: 1fr;
  }
}

.mf-tc-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 9px 12px;
  color: #e5e7eb;
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
  font-family: inherit;
}

.mf-tc-select:focus,
.mf-tc-select:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

/* THEORYCRAFTER 2-COLUMN WIDE BUILDS GRID */
.mf-tc-builds-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  width: 100%;
}

@media (max-width: 1050px) {
  .mf-tc-builds-grid {
    grid-template-columns: 1fr;
  }
}

.mf-tc-build-card {
  background: var(--mf-bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 200px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
}

.mf-tc-build-card:hover {
  background: var(--mf-bg-card-hover);
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6);
}

/* Glowing watermark crest on the right */
.mf-tc-card-crest {
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 220px;
  height: 220px;
  opacity: 0.16;
  pointer-events: none;
  filter: drop-shadow(0 0 16px currentColor);
  transition: opacity 0.2s ease;
}

.mf-tc-build-card:hover .mf-tc-card-crest {
  opacity: 0.26;
}

.mf-tc-card-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Card Header: Avatar + Author + Title */
.mf-tc-card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.mf-tc-author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.mf-tc-card-title-group {
  flex: 1;
}

.mf-tc-author-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--mf-text-muted);
  margin-bottom: 2px;
}

.mf-tc-build-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
  line-height: 1.25;
}

/* Tags Row */
.mf-tc-tags-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mf-tc-tag-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #d1d5db;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.mf-tc-tag-pill.highlight {
  background: rgba(168, 85, 247, 0.18);
  border-color: rgba(168, 85, 247, 0.45);
  color: #e9d5ff;
}

/* Skills Row: Big Square Tiles */
.mf-tc-skills-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.mf-tc-skill-tile {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.mf-tc-skill-tile:hover {
  transform: translateY(-2px);
  border-color: #5865f2;
}

.mf-tc-skill-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Card Footer Bar */
.mf-tc-card-footer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 10px;
}

.mf-tc-stats-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mf-tc-stat-badge {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mf-tc-stat-badge:hover {
  background: rgba(255, 255, 255, 0.12);
}

.mf-tc-date-text {
  font-size: 0.75rem;
  color: var(--mf-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.mf-tc-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

/* CLASS CREST WATERMARK ASSET */
.mf-tc-class-pill {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  z-index: 1;
}

/* CLASS SELECTOR GRID */
.mf-class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.mf-class-card-pro {
  background: var(--mf-bg-card);
  border: 1px solid var(--mf-border);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.mf-class-card-pro:hover {
  background: var(--mf-bg-card-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.mf-class-card-pro.active {
  border-color: #5865f2;
  background: rgba(88, 101, 242, 0.18);
  box-shadow: 0 0 16px rgba(88, 101, 242, 0.35);
}

.mf-class-icon-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin: 0 auto 6px auto;
}

.mf-class-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
}

.mf-class-badge {
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 2px;
}

/* GEAR & SOCKETS */
.mf-gear-grid-pro {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.mf-slot-card-pro {
  background: var(--mf-bg-card);
  border: 1px solid var(--mf-border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  text-align: left;
}

.mf-slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mf-slot-title {
  font-weight: 800;
  font-size: 0.92rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mf-slot-rarity-select {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.mf-sockets-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.mf-gem-socket-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px dashed rgba(255, 255, 255, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.mf-gem-socket-btn:hover {
  transform: scale(1.12);
  border-color: #f1c40f;
}
.mf-gem-socket-btn.filled {
  border-style: solid;
}

.mf-gem-icon-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

/* AFFIX BARS */
.mf-affix-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mf-affix-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
}

.mf-affix-bar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.mf-affix-icon-img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.mf-affix-bar-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.mf-affix-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  direction: ltr !important;
  text-align: left !important;
}

.modal-card {
  background: #111622;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--mf-text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
}
.modal-close-btn:hover {
  color: #fff;
}

/* TOAST NOTIFICATION */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mf-toast {
  background: #1e2433;
  color: #fff;
  border: 1px solid rgba(88, 101, 242, 0.4);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  animation: slideInToast 0.25s ease-out;
}

@keyframes slideInToast {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
