@import url("theme.css");

/* Admin Portal (separate UI) */

.admin{
  margin: 0;
  min-height: 100vh;
  background: #f4efe4;
  color: #3e2a20;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

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

.muted{ color: var(--mtc-muted); }
.tiny{ font-size: 0.85rem; }

h1{ margin: 0; font-size: clamp(1.7rem, 2.6vw, 2.4rem); }
h2{ margin: 0; font-size: 1.2rem; }

/* Buttons */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  text-decoration: none;
  font-weight: 950;
  border: 1px solid transparent;
  transition: 0.2s ease;
  cursor: pointer;
}

.btn-primary{
  background: #fdc211;
  color: #1b120e;
  box-shadow: 0 14px 28px rgba(233,78,26,0.18);
}
.btn-primary:hover{ transform: translateY(-1px); }

.btn-ghost{
  background: rgba(136,38,21,0.045);
  color: var(--mtc-text);
  border-color: rgba(136,38,21,0.14);
}
.btn-ghost:hover{
  border-color: rgba(253,194,17,0.35);
  transform: translateY(-1px);
}

.btn-block{ width: 100%; }

.icon-btn{
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(136,38,21,0.14);
  background: rgba(136,38,21,0.045);
  color: var(--mtc-text);
  cursor: pointer;
  transition: 0.2s ease;
}
.icon-btn:hover{
  border-color: rgba(253,194,17,0.35);
  transform: translateY(-1px);
}

/* Cards */
.card{
  background: rgba(136,38,21,0.045);
  border: 1px solid rgba(136,38,21,0.12);
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow: var(--mtc-shadow-soft);
}

/* Admin Auth Page */
.admin-auth{
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.2rem;
  padding: 2rem;
  background:
    radial-gradient(900px circle at 15% 10%, rgba(253,194,17,0.14), transparent 55%),
    radial-gradient(900px circle at 85% 0%, rgba(233,78,26,0.14), transparent 55%),
    linear-gradient(180deg, rgba(136,38,21,0.35), rgba(244,239,228,1));
}

.brand{
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.brand-logo{
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.25));
}

.brand-name{ font-weight: 1000; }
.brand-sub{ color: var(--mtc-muted); font-weight: 850; }

.feature-list{
  margin-top: 1.2rem;
  display: grid;
  gap: 0.7rem;
  color: var(--mtc-muted);
  font-weight: 800;
}
.feature{
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #e94e1a;
  box-shadow: 0 0 0 3px rgba(233,78,26,0.18);
}

.auth-links{
  margin-top: 1.3rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.link{
  color: #fdc211;
  font-weight: 950;
  text-decoration: none;
}
.link:hover{ text-decoration: underline; }

.auth-card{
  align-self: center;
  background: rgba(136,38,21,0.045);
  border: 1px solid rgba(136,38,21,0.12);
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow: var(--mtc-shadow);
}

.pill{
  display: inline-flex;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(253,194,17,0.35);
  background: rgba(253,194,17,0.12);
  font-weight: 950;
  font-size: 0.85rem;
  margin-bottom: 0.7rem;
}

.card-head{ margin-bottom: 0.9rem; }

.form{
  display: grid;
  gap: 0.85rem;
}
.form *{ min-width: 0; }

label{
  display: grid;
  gap: 0.35rem;
  font-weight: 950;
}

input{
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(136,38,21,0.14);
  background: rgba(255,255,255,0.92);
  color: var(--mtc-text);
  outline: none;
  width: 100%;
}

/* Match textarea/select styling to inputs (used heavily in Opportunities) */
select,
textarea{
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(136,38,21,0.14);
  background: rgba(255,255,255,0.92);
  color: var(--mtc-text);
  outline: none;
  width: 100%;
  font: inherit;
}

textarea{
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

select{
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.75) 50%),
    linear-gradient(135deg, rgba(255,255,255,0.75) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 13px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
}

input:focus{
  border-color: rgba(253,194,17,0.5);
  box-shadow: 0 0 0 4px rgba(253,194,17,0.12);
}

select:focus,
textarea:focus{
  border-color: rgba(253,194,17,0.5);
  box-shadow: 0 0 0 4px rgba(253,194,17,0.12);
}

select:focus,
textarea:focus{
  border-color: rgba(253,194,17,0.5);
  box-shadow: 0 0 0 4px rgba(253,194,17,0.12);
}

.password-row{ position: relative; }

.small-link{
  justify-self: end;
  margin-top: -1.7rem;
  font-size: 0.85rem;
  font-weight: 950;
  color: #fdc211;
  text-decoration: none;
}
.small-link:hover{ text-decoration: underline; }

.row{
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.1rem;
}

.checkline{
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--mtc-muted);
  font-weight: 850;
}
.checkline input{ width: auto; }

.divider{
  display: grid;
  place-items: center;
  margin: 0.3rem 0;
  position: relative;
}
.divider::before{
  content: "";
  position: absolute;
  inset: 50% 0 auto 0;
  height: 1px;
  background: rgba(136,38,21,0.10);
}
.divider span{
  position: relative;
  padding: 0 0.8rem;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(136,38,21,0.10);
  border-radius: 999px;
  color: var(--mtc-muted);
  font-weight: 900;
  font-size: 0.85rem;
}

.hint{
  margin-top: 0.6rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(136,38,21,0.12);
  background: rgba(136,38,21,0.035);
  color: var(--mtc-muted);
}

/* Shell layout */
.admin-shell{
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar{
  position: sticky;
  top: 0;
  height: 100vh;

  /* key fix */
  display: flex;
  flex-direction: column;
  overflow: hidden;

  padding: 1.1rem;
  border-right: 1px solid rgba(136,38,21,0.08);
  background: linear-gradient(180deg, rgba(123,36,28,0.98), rgba(233,106,26,0.92));
}

.side-brand{
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding: 0.8rem;
  border-radius: 18px;
  border: 1px solid rgba(136,38,21,0.10);
  background: rgba(136,38,21,0.035);
  margin-bottom: 1rem;
}

.side-logo{
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.side-title{ font-weight: 1000; }
.side-sub{ font-weight: 850; }

/* make the nav area scroll */
.nav{
  display: grid;
  gap: 0.4rem;

  /* key fix */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 6px; /* space for scrollbar */
}

.nav-item{
  display: block;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(136,38,21,0.08);
  background: rgba(255,255,255,0.14);
  color: #fff8f0;
  text-decoration: none;
  font-weight: 900;
  transition: 0.2s ease;
}

.nav-item:hover{
  border-color: rgba(253,194,17,0.25);
  transform: translateY(-1px);
}

.nav-item.active{
  border-color: rgba(253,194,17,0.45);
  background: rgba(253,194,17,0.10);
  color: var(--mtc-text);
}

.nav-item.subtle{
  background: transparent;
  border-color: rgba(136,38,21,0.045);
  color: var(--mtc-muted);
}

.side-foot{
  margin-top: auto; /* key fix */
  display: grid;
  gap: 0.4rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(136,38,21,0.08);
}

/* Main */
.main{
  padding: 1.1rem 1.1rem 2rem;
}

.topbar{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid rgba(136,38,21,0.10);
  background: rgba(136,38,21,0.035);
}

.page-title h1{
  margin: 0.1rem 0 0;
  font-size: 1.6rem;
}

.admin-pill{
  padding: 0.65rem 0.85rem;
  border-radius: 16px;
  border: 1px solid rgba(136,38,21,0.10);
  background: rgba(136,38,21,0.035);
  text-align: right;
}

.admin-name{ font-weight: 1000; }

.content{
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
}

.grid-4{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.grid-3{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.grid-2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat-label{ font-weight: 900; }
.stat-value{ font-size: 2rem; font-weight: 1100; margin-top: 0.2rem; }
.stat-trend{ margin-top: 0.45rem; color: var(--mtc-muted); font-weight: 850; }

.action-bar{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.action-title{ font-weight: 1000; }
.action-buttons{
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.card-head-row{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.list{
  display: grid;
  gap: 0.65rem;
}

.list-row{
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-start;
  padding: 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(136,38,21,0.10);
  background: rgba(136,38,21,0.035);
}

.list-title{ font-weight: 950; margin-bottom: 0.25rem; }

.tag{
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-weight: 950;
  font-size: 0.85rem;
  border: 1px solid rgba(136,38,21,0.14);
  background: rgba(136,38,21,0.04);
  white-space: nowrap;
}

.tag-gold{
  border-color: rgba(253,194,17,0.35);
  background: rgba(253,194,17,0.12);
}
.tag-ok{
  border-color: rgba(136,38,21,0.16);
}
.tag-warn{
  border-color: rgba(233,78,26,0.45);
  background: rgba(233,78,26,0.12);
}

.timeline{
  display: grid;
  gap: 0.8rem;
}

.tl-row{
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 0.7rem;
  align-items: start;
  padding: 0.8rem;
  border-radius: 16px;
  border: 1px solid rgba(136,38,21,0.10);
  background: rgba(136,38,21,0.035);
}

.tl-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #e94e1a;
  margin-top: 0.35rem;
  box-shadow: 0 0 0 3px rgba(233,78,26,0.18);
}

.footer-note{
  padding: 0 0.2rem;
}

/* Sidebar hidden (mobile) */
.admin-shell.sidebar-collapsed{
  grid-template-columns: 1fr;
}
.admin-shell.sidebar-collapsed .sidebar{
  display: none;
}

/* Responsive */
@media (max-width: 1100px){
  .admin-auth{ grid-template-columns: 1fr; padding: 1.2rem; }
  .admin-shell{ grid-template-columns: 1fr; }
  .sidebar{ display: none; position: fixed; z-index: 50; left: 0; top: 0; width: 86vw; max-width: 320px; }
  .sidebar.show{ display: block; }
  .grid-4{ grid-template-columns: 1fr 1fr; }
  .grid-3{ grid-template-columns: 1fr; }
  .grid-2{ grid-template-columns: 1fr; }
}

@media (max-width: 700px){
  .grid-4{ grid-template-columns: 1fr; }
}

.nav-item-danger{
  border-color: rgba(233,78,26,0.45) !important;
  background: rgba(233,78,26,0.14) !important;
  color: var(--mtc-deep) !important;
}

.nav-item-danger:hover{
  border-color: rgba(233,78,26,0.70) !important;
  background: rgba(233,78,26,0.22) !important;
}

@media (max-width: 1100px){
  .sidebar{
    height: 100vh;
    overflow: hidden;
  }
  .nav{
    overflow-y: auto;
  }
}

.grid-5{
  display:grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap:1rem;
}

@media (max-width: 1200px){ .grid-5{ grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 820px){ .grid-5{ grid-template-columns: 1fr; } }


.admin{
  background: linear-gradient(180deg, #fbf8f2 0%, #f4efe4 100%);
  color: var(--mtc-text);
}
.muted{ color: var(--mtc-muted); }
.card, .admin-sidebar, .admin-topbar, .table-wrap, .stat-card, .form-card, .list-card{
  background: var(--mtc-surface-strong);
  border: 1px solid var(--mtc-border);
  box-shadow: var(--mtc-shadow-soft);
}
.btn-ghost, .icon-btn{
  background: rgba(255,255,255,0.82);
  color: var(--mtc-deep);
  border-color: var(--mtc-border);
}
.sidebar, .admin-sidebar{
  background: linear-gradient(180deg, rgba(123,36,28,0.98), rgba(233,106,26,0.92));
}
.sidebar a, .admin-sidebar a, .admin-sidebar .brand, .sidebar .brand{ color: #fff8f0; }
