/* =========================================================
   S.I TECH SYSTEM - Theme
   ========================================================= */
:root {
  --primary: #6C3BFF;
  --primary-dark: #5527e0;
  --secondary: #2563EB;
  --accent: #ffffff;
  --bg: #f7f7fb;
  --surface: rgba(255,255,255,0.7);
  --surface-solid: #ffffff;
  --text: #1a1b25;
  --text-muted: #6b7280;
  --border: rgba(15,23,42,0.08);
  --radius: 18px;
  --shadow: 0 20px 45px -20px rgba(108,59,255,0.25), 0 2px 10px rgba(15,23,42,0.05);
  --gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

[data-theme="dark"] {
  --bg: #0f0f18;
  --surface: rgba(30,30,45,0.6);
  --surface-solid: #171724;
  --text: #f1f1f6;
  --text-muted: #a1a1b5;
  --border: rgba(255,255,255,0.08);
  --shadow: 0 20px 45px -20px rgba(108,59,255,0.4), 0 2px 10px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.25s, color 0.25s;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* ---------- Glass card ---------- */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--shadow);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  font-family: inherit;
}
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 12px 24px -10px rgba(108,59,255,0.5); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -10px rgba(108,59,255,0.6); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 0.55rem 1rem; font-size: 0.85rem; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  isolation: isolate;
  /* Solid instead of glassy — backdrop-filter blur on this bar was the source of
     the blur/see-through bleed into the mobile drawer on some Android browsers. */
  background: var(--surface-solid);
}
.navbar .logo { font-weight: 800; font-size: 1.25rem; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.navbar .logo img { height: 54px; max-width: 160px; width: auto; object-fit: contain; object-position: left center; }
@media (max-width: 480px) { .navbar .logo img { height: 28px; max-width: 130px; } }
.navbar-links { display: flex; gap: 1.75rem; list-style: none; margin: 0; padding: 0; align-items: center; }
.navbar-links a { font-size: 0.92rem; font-weight: 500; color: var(--text-muted); transition: color 0.15s; }
.navbar-links a:hover, .navbar-links a.active { color: var(--primary); }
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: 10px; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); }
.nav-toggle { display: none; background: none; border: none; font-size: 1.4rem; color: var(--text); cursor: pointer; }

@media (max-width: 900px) {
  .navbar-links {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -280px;
    height: 100vh;
    width: 220px;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    /* Solid, theme-matched fallback PLUS the var, so the drawer is never see-through
       even if a custom property fails to resolve on an older mobile browser. */
    background-color: #ffffff;
    background-color: var(--surface-solid);
    opacity: 1;
    background-image: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(108,59,255,0.18);
    border-radius: 0 60% 60% 0 / 0 22% 22% 0;
    padding: 2.5rem 1.75rem;
    gap: 0.35rem;
    box-shadow: 0 30px 70px -20px rgba(76,29,149,0.35), 0 6px 20px rgba(15,23,42,0.12);
    z-index: 999;
    overflow-y: auto;
    transition: left 0.35s cubic-bezier(.22,.9,.3,1);
    /* Forces the drawer onto its own GPU compositing layer so it can never inherit
       or "bleed" the navbar's backdrop-filter blur behind it on mobile Chrome/WebView. */
    isolation: isolate;
    will-change: transform;
    transform: translateZ(0);
    contain: layout paint;
  }
  [data-theme="dark"] .navbar-links {
    background-color: #171724;
    background-color: var(--surface-solid);
  }
  .navbar-links.open { left: 0; }
  .navbar-links a {
    padding: 0.6rem 0.75rem;
    border-radius: 999px;
    text-align: center;
    font-size: 0.83rem;
  }
  .navbar-links a:hover, .navbar-links a.active { background: var(--gradient); color: #fff; }
  .navbar-links li:first-child a, .navbar-links li:last-child a { margin: 0 0.5rem; }
  .navbar-links li:last-child { margin-top: 0.75rem; }
  .nav-toggle { display: block; }
  .nav-overlay {
    position: fixed; inset: 0;
    /* Plain dim scrim, no blur — backdrop-filter here was bleeding a blur
       effect onto the drawer itself on some Android browsers/WebViews. */
    background: rgba(10,10,20,0.55);
    opacity: 0;
    z-index: 90;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .nav-overlay.open { opacity: 1; pointer-events: auto; }
}

/* ---------- Hero ---------- */
.hero { padding: 5rem 0 4rem; position: relative; overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: -20% -10% auto -10%; height: 500px;
  background: var(--gradient); opacity: 0.15; filter: blur(80px); z-index: -1;
}
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin: 0 0 1.25rem; max-width: 780px; }
.hero .accent { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.sub { font-size: 1.05rem; color: var(--text-muted); max-width: 620px; margin: 0 0 2rem; }
.hero-ctas { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-tags { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 2rem; }
.hero-tag { padding: 0.4rem 0.9rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 0.8rem; color: var(--text-muted); }

/* ---------- Section headings ---------- */
.section { padding: 4.5rem 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 3rem; }
.section-head .eyebrow { color: var(--primary); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -0.02em; margin: 0.5rem 0 0.75rem; }
.section-head p { color: var(--text-muted); }

/* ---------- Grids / cards ---------- */
.grid { display: grid; gap: 1.5rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card { padding: 1.75rem; border-radius: var(--radius); background: var(--surface-solid); border: 1px solid var(--border); transition: transform 0.2s, box-shadow 0.2s; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card .icon { width: 48px; height: 48px; border-radius: 12px; background: var(--gradient); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.2rem; margin-bottom: 1rem; }
.card h3 { font-size: 1.05rem; margin: 0 0 0.5rem; }
.card p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }

/* ---------- Portfolio ---------- */
.portfolio-card { border-radius: var(--radius); overflow: hidden; background: var(--surface-solid); border: 1px solid var(--border); }
.portfolio-card img { width: 100%; height: 190px; object-fit: cover; background: var(--gradient); }
.portfolio-card .body { padding: 1.25rem; }
.portfolio-card .tech { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.75rem 0 1rem; }
.portfolio-card .tech span { font-size: 0.72rem; padding: 0.25rem 0.6rem; border-radius: 999px; background: rgba(108,59,255,0.1); color: var(--primary); }

/* ---------- Footer ---------- */
footer.site-footer { background: var(--surface-solid); border-top: 1px solid var(--border); padding: 3rem 0 1.5rem; margin-top: 2rem; }
footer.site-footer .grid { grid-template-columns: 2fr 1fr 1fr 1fr; margin-bottom: 2rem; }
footer.site-footer h4 { font-size: 0.95rem; margin-bottom: 1rem; }
footer.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
footer.site-footer ul a { color: var(--text-muted); font-size: 0.88rem; }
footer.site-footer ul a:hover { color: var(--primary); }
footer.site-footer .bottom { text-align: center; color: var(--text-muted); font-size: 0.82rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }
@media (max-width: 800px) { footer.site-footer .grid { grid-template-columns: 1fr 1fr; } }

/* =========================================================
   DASHBOARD LAYOUT (Admin / Client)
   ========================================================= */
.dash-shell { display: flex; min-height: 100vh; }

.dash-sidebar {
  --brass: #c9a24b;
  --brass-dim: rgba(201,162,75,0.35);
  --ink: #14110d;
  --ink-2: #1e1a14;
  --parchment: #ece3d0;
  --parchment-muted: #a89a80;

  width: 268px; flex-shrink: 0;
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(201,162,75,0.08) 0%, transparent 55%),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  border-right: 1px solid rgba(201,162,75,0.18);
  padding: 1.75rem 1rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.02);
}
.dash-sidebar::-webkit-scrollbar { width: 6px; }
.dash-sidebar::-webkit-scrollbar-thumb { background: rgba(201,162,75,0.25); border-radius: 999px; }

.dash-sidebar .logo {
  padding: 0.25rem 0.75rem 1.5rem;
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.03em;
  color: var(--parchment);
  position: relative;
  margin-bottom: 0.75rem;
}
.dash-sidebar .logo span { color: var(--brass); font-style: italic; }
.dash-sidebar .logo::after {
  content: '';
  position: absolute; left: 0.75rem; right: 0.75rem; bottom: 0.6rem;
  height: 1px;
  background: linear-gradient(90deg, var(--brass) 0%, rgba(201,162,75,0.05) 100%);
}

.dash-nav { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.dash-nav a {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.75rem 0.95rem;
  border-radius: 8px;
  color: var(--parchment-muted);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.015em;
  border-left: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.dash-nav a i { width: 18px; text-align: center; color: var(--brass-dim); transition: color 0.15s; font-size: 0.9rem; }
.dash-nav a:hover { background: rgba(201,162,75,0.07); color: var(--parchment); border-left-color: var(--brass-dim); }
.dash-nav a:hover i { color: var(--brass); }
.dash-nav a.active {
  background: linear-gradient(90deg, rgba(201,162,75,0.16) 0%, rgba(201,162,75,0.03) 100%);
  color: var(--parchment);
  border-left-color: var(--brass);
}
.dash-nav a.active i { color: var(--brass); }
.dash-nav li[style*="border-top"] { border-top-color: rgba(201,162,75,0.18) !important; }

.dash-main { flex: 1; min-width: 0; }
.dash-topbar { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 2rem; background: var(--surface-solid); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.dash-content { padding: 2rem; }

@media (max-width: 950px) {
  .dash-sidebar { position: fixed; left: -280px; z-index: 999; transition: left 0.25s ease; box-shadow: 0 20px 50px -20px rgba(0,0,0,0.6); }
  .dash-sidebar.open { left: 0; }
  .dash-content { padding: 1.25rem; }
  .dash-topbar { padding: 1rem 1.25rem; }
  .dash-sidebar-close {
    display: flex; align-items: center; justify-content: center;
    position: absolute; top: 1rem; right: 1rem;
    width: 32px; height: 32px; border-radius: 8px;
    background: rgba(201,162,75,0.12); color: var(--parchment);
    border: none; cursor: pointer; font-size: 1rem;
  }
  .dash-sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(10,10,20,0.55);
    z-index: 90;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .dash-sidebar-overlay.open { opacity: 1; pointer-events: auto; }
}
@media (min-width: 951px) {
  .dash-sidebar-close { display: none; }
}

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-bottom: 2rem; }
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card { padding: 1.5rem; border-radius: var(--radius); background: var(--surface-solid); border: 1px solid var(--border); }
.stat-card .label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.stat-card .value { font-size: 1.7rem; font-weight: 800; }
.stat-card .icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; margin-bottom: 0.75rem; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-solid); }
table.dash-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.dash-table th { text-align: left; padding: 0.9rem 1.1rem; color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); }
table.dash-table td { padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--border); }
table.dash-table tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 0.25rem 0.7rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.badge-green { background: rgba(16,185,129,0.12); color: #10b981; }
.badge-yellow { background: rgba(245,158,11,0.12); color: #f59e0b; }
.badge-red { background: rgba(239,68,68,0.12); color: #ef4444; }
.badge-blue { background: rgba(37,99,235,0.12); color: #2563eb; }
.badge-purple { background: rgba(108,59,255,0.12); color: #6c3bff; }

/* Forms */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.4rem; }
.form-control {
  width: 100%; padding: 0.7rem 0.9rem; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 0.9rem; font-family: inherit; outline: none;
  transition: border-color 0.15s;
}
.form-control:focus { border-color: var(--primary); }
textarea.form-control { resize: vertical; min-height: 100px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.5); display: none; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface-solid); border-radius: var(--radius); max-width: 520px; width: 100%; padding: 1.75rem; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin-top: 0; }

.flash { padding: 0.9rem 1.1rem; border-radius: 10px; margin-bottom: 1rem; font-size: 0.88rem; }
.flash-success { background: rgba(16,185,129,0.12); color: #10b981; }
.flash-error { background: rgba(239,68,68,0.12); color: #ef4444; }

/* Settings page + reusable responsive helpers */
.settings-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 1.5rem; align-items: start; }
.form-row { display: flex; gap: 0.75rem; }
@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .form-row { flex-direction: column; gap: 0; }
  .table-wrap { padding: 1.1rem !important; }
  .modal { padding: 1.25rem; }
}

/* ---------- Logo upload widget (settings page) ---------- */
.logo-dropzone {
  cursor: pointer;
  border-radius: 20px;
  outline: none;
}
.logo-preview-frame {
  position: relative;
  width: 130px; height: 130px;
  margin: 0 auto 0.85rem;
  border-radius: 20px;
  border: 1.5px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background:
    linear-gradient(45deg, rgba(108,59,255,0.05) 25%, transparent 25%, transparent 75%, rgba(108,59,255,0.05) 75%) 0 0/16px 16px,
    linear-gradient(45deg, rgba(108,59,255,0.05) 25%, transparent 25%, transparent 75%, rgba(108,59,255,0.05) 75%) 8px 8px/16px 16px,
    var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.logo-dropzone:hover .logo-preview-frame,
.logo-dropzone:focus-visible .logo-preview-frame,
.logo-dropzone.drag .logo-preview-frame {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108,59,255,0.12);
}
#logoPreviewIcon { font-size: 2rem; color: var(--text-muted); }
#logoPreviewImg { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.logo-dropzone-hint {
  font-size: 0.75rem; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
}
.logo-dropzone-hint i { color: var(--primary); }

.logo-upload-overlay {
  position: absolute; inset: 0;
  background: rgba(15,15,25,0.72);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.5rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.logo-upload-overlay.active { opacity: 1; pointer-events: auto; }
.logo-spinner {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  animation: sits-spin 0.7s linear infinite;
}
.logo-progress-track {
  width: 78%; height: 5px; border-radius: 999px;
  background: rgba(255,255,255,0.22);
  overflow: hidden;
}
.logo-progress-fill {
  height: 100%; width: 0%;
  background: var(--gradient);
  border-radius: 999px;
  transition: width 0.15s ease;
}
.logo-progress-pct { font-size: 0.7rem; color: #fff; font-weight: 600; letter-spacing: 0.02em; }

@keyframes sits-spin { to { transform: rotate(360deg); } }

/* ---------- Global page onloader ---------- */
.page-loader {
  position: fixed; inset: 0;
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.page-loader.page-loader-hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.page-loader-mark {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.page-loader-ring {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-right-color: var(--secondary);
  animation: sits-spin 0.8s linear infinite;
}
.page-loader-word {
  font-weight: 800; font-size: 1.05rem;
  background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: 0.02em;
}
