/* ===========================================
   SHIVAJI PATIL & ASSOCIATES — Admin Styles
   =========================================== */

:root {
  --primary: #5E2E8A;
  --primary-dark: #43205F;
  --primary-light: #A585C9;
  --primary-soft: #F1EBF8;
  --on-accent: #FFFFFF;
  --y: #5E2E8A;
  --y-dk: #43205F;
  --bg: #F7F5FA;
  --white: #FFFFFF;
  --dark: #1A1523;
  --mid: #6B6675;
  --light: #A29DAD;
  --border: #E8E4EF;
  --sb-w: 230px;
  --sh-sm: 0 1px 4px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.04);
  --sh-md: 0 4px 20px rgba(0,0,0,.07);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --font: 'Plus Jakarta Sans', sans-serif;
  --ease: .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--dark); font-size: 14px; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { text-decoration: none; color: inherit; }

/* ---- Accent ---- */
.ay { color: var(--primary); }

/* ---- Admin Buttons ---- */
.abtn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--r-sm);
  font-family: var(--font); font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: all var(--ease); border: 1.5px solid transparent;
  white-space: nowrap;
}
.abtn-primary { background: var(--primary); color: var(--on-accent); border-color: var(--primary); }
.abtn-primary:hover { background: var(--primary-dark); color: var(--on-accent); border-color: var(--primary-dark); }
.abtn-outline { background: transparent; color: var(--mid); border-color: var(--border); }
.abtn-outline:hover { border-color: var(--dark); color: var(--dark); }
.abtn-danger  { background: transparent; color: #dc2626; border-color: #fca5a5; }
.abtn-danger:hover { background: #fef2f2; }
.abtn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ==========================================
   LOGIN SCREEN
   ========================================== */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px;
}
.login-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 40px;
  width: 100%; max-width: 400px; box-shadow: var(--sh-md);
}
.login-logo { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: 24px; }
.login-logo-img { height: 64px; width: auto; margin: 0 auto 20px; display: block; }
.login-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; }
.login-sub { color: var(--mid); font-size: .875rem; margin-bottom: 28px; line-height: 1.6; }
.lfg { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.lfg label { font-size: .8rem; font-weight: 600; }
.lfg input {
  padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-family: var(--font); font-size: .9rem; background: var(--bg); color: var(--dark);
  outline: none; transition: border-color var(--ease), box-shadow var(--ease);
}
.lfg input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(94,46,138,.12); }
#login-form .abtn { width: 100%; justify-content: center; padding: 11px; font-size: .875rem; margin-top: 4px; }
.login-err {
  display: none; margin-top: 10px; padding: 9px 12px;
  background: #fef2f2; border: 1px solid #fca5a5; border-radius: var(--r-sm);
  color: #dc2626; font-size: .8rem; font-weight: 500;
}
.login-err.show { display: block; }
.login-hint { margin-top: 20px; font-size: .75rem; color: var(--light); text-align: center; }
.login-hint code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: .72rem; color: var(--mid); font-family: monospace; border: 1px solid var(--border); }

/* ==========================================
   ADMIN APP LAYOUT
   Robust pattern: fixed sidebar + sticky topbar,
   the page body scrolls naturally (never gets stuck).
   ========================================== */
.admin-app { min-height: 100vh; }

/* ---- Sidebar (fixed to the left, scrolls on its own if tall) ---- */
.sidebar {
  position: fixed; top: 0; left: 0; z-index: 50;
  width: var(--sb-w); height: 100vh;
  background: var(--dark); color: var(--white);
  display: flex; flex-direction: column; padding: 24px 0;
  overflow-y: auto;
}
.sb-logo {
  padding: 0 20px 20px; border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 20px;
}
.sb-logo img { height: 30px; width: auto; }
.sb-label {
  font-size: .65rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.35);
  padding: 0 20px 10px;
}
.sb-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; flex: 1; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  background: none; border: none; color: rgba(255,255,255,.5);
  font-family: var(--font); font-size: .85rem; font-weight: 500;
  cursor: pointer; text-align: left; transition: all var(--ease); width: 100%;
}
.sb-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.sb-item:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.8); }
.sb-item.active { background: rgba(255,255,255,.1); color: var(--white); }
.sb-item.active svg { color: var(--primary-light); }

.sb-actions {
  padding: 16px 12px 0;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column; gap: 6px; margin-top: 16px;
}
.sb-btn { width: 100%; justify-content: flex-start; padding: 9px 12px; border-color: rgba(255,255,255,.12); color: rgba(255,255,255,.5); }
.sb-btn:hover { border-color: rgba(255,255,255,.25); color: rgba(255,255,255,.85); background: rgba(255,255,255,.05); }

/* ---- Main Area (offset by the fixed sidebar) ---- */
.admin-main { margin-left: var(--sb-w); min-height: 100vh; }

.admin-topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); gap: 16px;
}
.atb-title { font-size: 1.1rem; font-weight: 700; }
.atb-actions { display: flex; align-items: center; gap: 12px; }
.save-msg {
  font-size: .8rem; font-weight: 600; color: #16a34a;
  background: #f0fdf4; padding: 6px 12px; border-radius: var(--r-sm);
  border: 1px solid #bbf7d0; opacity: 0; transition: opacity .3s;
}
.save-msg.show { opacity: 1; }

.admin-content {
  padding: 28px;
  display: flex; flex-direction: column; gap: 24px;
  max-width: 860px;
}

/* ==========================================
   FORM ELEMENTS
   ========================================== */
.acard {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.acard-head {
  padding: 16px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.acard-title { font-size: .9rem; font-weight: 700; }
.acard-sub { font-size: .75rem; color: var(--mid); margin-top: 1px; }
.acard-body { padding: 22px; display: flex; flex-direction: column; gap: 16px; }

.afg { display: flex; flex-direction: column; gap: 5px; }
.afg label { font-size: .78rem; font-weight: 600; color: var(--dark); }
.afg .hint { font-size: .72rem; color: var(--light); margin-top: -2px; margin-bottom: 2px; }
.afg input, .afg textarea, .afg select {
  padding: 10px 13px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-family: var(--font); font-size: .875rem; background: var(--bg); color: var(--dark);
  outline: none; transition: border-color var(--ease), box-shadow var(--ease);
  resize: vertical;
}
.afg input:focus, .afg textarea:focus, .afg select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(94,46,138,.1);
}
.afg input::placeholder, .afg textarea::placeholder { color: var(--light); }
.afg select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 36px; cursor: pointer; }

.arow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.arow-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ---- Dynamic list items (services, projects, etc.) ---- */
.dyn-list { display: flex; flex-direction: column; gap: 14px; }
.dyn-item {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 18px;
  position: relative; display: flex; flex-direction: column; gap: 12px;
}
.dyn-item-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;
}
.dyn-item-num {
  font-size: .7rem; font-weight: 700; color: var(--mid);
  background: var(--border); padding: 2px 8px; border-radius: 100px;
}
.dyn-add {
  display: flex; align-items: center; gap: 7px; padding: 10px 16px;
  background: var(--white); border: 1.5px dashed var(--border); border-radius: var(--r-md);
  font-family: var(--font); font-size: .82rem; font-weight: 600; color: var(--mid);
  cursor: pointer; transition: all var(--ease); justify-content: center; width: 100%;
}
.dyn-add:hover { border-color: var(--dark); color: var(--dark); }
.dyn-add svg { width: 14px; height: 14px; }

/* ---- Highlight numbers ---- */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.stat-edit {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.stat-edit-badge {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 12px; border-radius: var(--r-sm);
  background: var(--primary-soft); color: var(--primary);
  font-size: 1.35rem; font-weight: 800; letter-spacing: -.03em;
}
.stat-edit-badge span { font-size: .68rem; font-weight: 600; color: var(--mid); text-transform: none; letter-spacing: 0; }
.stat-edit .afg label { font-size: .72rem; font-weight: 600; color: var(--dark); }
.stat-edit .afg input { text-align: left; font-weight: 500; }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 820px) {
  .stats-grid, .arow, .arow-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  /* Sidebar becomes a top bar; section tabs scroll horizontally */
  .admin-app { display: block; }
  .sidebar {
    position: static; width: 100%; height: auto;
    flex-direction: column; align-items: stretch;
    padding: 10px 14px; gap: 10px;
  }
  .sb-logo { padding: 0; margin: 0; border: none; }
  .sb-logo img { height: 24px; }
  .sb-label { display: none; }
  .sb-nav {
    flex-direction: row; flex-wrap: nowrap; overflow-x: auto;
    padding: 2px 0; gap: 6px; flex: none;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .sb-nav::-webkit-scrollbar { display: none; }
  .sb-item { width: auto; flex: 0 0 auto; white-space: nowrap; }
  .sb-actions {
    flex-direction: row; border: none; margin: 0; padding: 0; gap: 6px;
  }
  .sb-btn { width: auto; flex: 1; justify-content: center; padding: 9px 10px; }
  .admin-main { margin-left: 0; min-height: auto; }
  .admin-topbar { padding: 12px 16px; gap: 10px; }
  .atb-title { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .atb-actions { flex-shrink: 0; }
  .save-msg { display: none; }
  .admin-content { max-width: 100%; padding: 16px; }
  /* Prevent iOS auto-zoom on focus (needs >=16px) */
  .afg input, .afg textarea, .afg select, .lfg input { font-size: 16px; }
}
@media (max-width: 420px) {
  .login-card { padding: 28px 22px; }
  .acard-body { padding: 18px 16px; }
  .stat-edit-badge { font-size: 1.15rem; }
}
