/* core.css — base + layout (slim) */

/* =========================
   Design Tokens
========================= */

#app-wrapper {
  transform: scale(0.8);          /* 80% zoom out */
  transform-origin: top left;     /* anchor zoom from top-left corner */
  width: 125%;                    /* compensate scaling so content fills horizontally */
  height: 125%;                   /* prevent cutoff in height */
}

:root{
  --primary-color:#295237;
  --secondary-color:#f8f9fa;
  --text-color:#333;

  /* used via fallbacks in components */
  --surface:#fff;
  --border:#e5e7eb;
  --text-muted:#64748b;
  --muted:#f1f5f9;
  --text:#0f172a;
}

/* =========================
   Reset & Base
========================= */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  background:#f5f5f5;
  color:var(--text-color);
  font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif;
}

/* =========================
   Layout
========================= */
.container{max-width:1400px;margin:0 auto;padding:20px}
@media (max-width:768px){.container{padding:15px}}

/* =========================
   Header
========================= */
header{
  background:var(--secondary-color);
  box-shadow:0 2px 4px rgba(0,0,0,.1);
  padding:10px 0;
  margin-bottom:24px;
}
header .container{display:flex;align-items:center}
header .container>a{display:inline-flex;align-items:center;text-decoration:none;color:inherit}
header .container>nav{margin-left:auto}

/* =========================
   Logo
========================= */
header .logo{margin-right:100px}
.logo{display:flex;align-items:center;gap:.6rem}
.logo img{display:block;height:40px;width:auto}
.logo h1{line-height:1;font-size:1.445rem;color:var(--primary-color)}

/* =========================
   Navigation
========================= */
nav ul {
  display: flex;
  list-style: none;
  gap: 75px;
  transition: gap 0.3s ease;   /* animate the spacing */
}

nav ul li {
  transition: transform .3s ease;
}

nav ul li:hover {
  transform: scale(1.2);
}


nav ul li a {
  text-decoration: none;
  color: var(--text-color);
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 4px;
  transition: color .2s ease;
}

nav ul li:hover a,
nav ul li a.active {
  font-weight: bold;
  color: #55823B; /* or your brand color */
}



/* =========================
   Subnav
========================= */
.subnav{
  position:sticky;top:0;z-index:100;
  background:var(--surface,#fff);
  border-bottom:1px solid var(--border,#e5e7eb);
}
.subnav .container{display:flex;align-items:center}
.subnav-list{display:flex;gap:100px;padding:.5rem 0;list-style:none}
.subnav a{
  display:inline-block;
  padding:.5rem .75rem;
  border-radius:.5rem;
  text-decoration:none;
  color:var(--text-muted,#64748b);
  font-size:1rem;
  font-weight:500;
}
.subnav a.active,
.subnav a:focus-visible,
.subnav a:hover{
  color:var(--text,#0f172a);
  background:var(--muted,#f1f5f9);
}
.subsection{padding-block:1rem 2rem}

/* =========================
   Dashboard Grid
========================= */
.dashboard{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(350px,1fr));
  gap:20px;
  margin-bottom:30px;
}

/* =========================
   Recent Products
========================= */
.recent-contracts{
  background:#fff;
  border-radius:8px;
  box-shadow:0 2px 4px rgba(0,0,0,.1);
  padding:20px;
  margin-bottom:30px;
}
.recent-contracts h2{
  color:var(--primary-color);
  margin:0 0 20px;
  font-size:1.5rem;
}

/* =========================
   Responsive
========================= */
@media (max-width:768px){
  header .container{flex-direction:column;align-items:stretch;gap:.75rem}
  .logo{justify-content:center}
  nav ul{justify-content:center;flex-wrap:wrap}
  .dashboard{grid-template-columns:1fr}
  table{display:block;overflow-x:auto}
}



/* =========================
   Fix modal positioning under #app-wrapper scaling
   ========================= */
#modals-root,
#modals-root .modal {
  transform: scale(1) !important;
  transform-origin: center center !important; /* re-center */
  position: fixed !important;
  inset: 0;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.45);
}

#modals-root .modal-content {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 25px rgba(0,0,0,0.25);
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: none !important;
}

#app-wrapper #modals-root {
  transform: none !important;
  transform-origin: center center !important;
}

/* =========================
   Fix for modals appearing off-screen when #app-wrapper is scaled
========================= */
#modals-root,
#modals-root .modal {
  position: fixed !important;
  inset: 0;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  transform: none !important;
  transform-origin: center center !important;
}

/* Make sure modal content itself stays centered and unscaled */
#modals-root .modal-content {
  transform: none !important;
  margin: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

/* Override any inherited scale from #app-wrapper */
#app-wrapper #modals-root {
  transform: none !important;
  transform-origin: center center !important;
}
