/* =============================================
   AGRISTRUCT TECHNOLOGIES LTD — admin.css
   Admin panel styles
   ============================================= */

:root {
  --primary:     #292C51;
  --secondary:   #3F51B5;
  --bg:          #F0F2F8;
  --bg-sidebar:  #1A1D38;
  --text:        #0F1117;
  --accent:      #E5B24A;
  --white:       #ffffff;
  --muted:       #6B7280;
  --border:      #E2E4EC;
  --card-bg:     #ffffff;
  --danger:      #EF4444;
  --danger-bg:   #FEF2F2;
  --success:     #22C55E;
  --success-bg:  #F0FDF4;
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.15);
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --font-display: 'Outfit', sans-serif;
  --font-body:    'Plus Jakarta Sans', sans-serif;
  --sidebar-w:   260px;
  --topbar-h:    60px;
  --transition:  all 0.22s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
h1,h2,h3,h4 { font-family: var(--font-display); }

/* ===== LOGIN SCREEN ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  position: relative;
  overflow: hidden;
}
.login-bg-pattern {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 2;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 28px;
}
.logo-mark {
  width: 36px; height: 36px;
  background: var(--white);
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
.login-title {
  font-size: 1.6rem;
  color: var(--primary);
  margin-bottom: 8px;
}
.login-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}
.pass-wrap {
  position: relative;
  display: flex;
}
.pass-wrap input { flex: 1; padding-right: 44px; }
.pass-toggle {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  transition: var(--transition);
  padding: 4px;
}
.pass-toggle:hover { color: var(--primary); }
.pass-toggle svg { width: 18px; height: 18px; }
.login-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 16px;
}

/* ===== ADMIN LAYOUT ===== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}
.sidebar-close {
  display: none;
  color: rgba(255,255,255,0.5);
  padding: 4px;
}
.sidebar-close svg { width: 20px; height: 20px; }
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 8px 10px 4px;
  margin-top: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { color: var(--white); background: rgba(255,255,255,0.08); }
.nav-item.active { color: var(--white); background: var(--secondary); }
.badge {
  margin-left: auto;
  background: var(--danger);
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 100px;
  min-width: 18px;
  text-align: center;
}
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.view-site-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.55);
  font-size: 0.85rem;
  transition: var(--transition);
}
.view-site-btn svg { width: 15px; height: 15px; }
.view-site-btn:hover { color: var(--white); background: rgba(255,255,255,0.07); }
.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  transition: var(--transition);
  width: 100%;
  text-align: left;
}
.logout-btn svg { width: 15px; height: 15px; }
.logout-btn:hover { color: #fca5a5; background: rgba(239,68,68,0.12); }

/* ===== ADMIN MAIN ===== */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== TOP BAR ===== */
.admin-topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-menu-btn {
  display: none;
  color: var(--muted);
  padding: 6px;
  border-radius: var(--radius-sm);
}
.topbar-menu-btn svg { width: 20px; height: 20px; }
.topbar-menu-btn:hover { background: var(--bg); color: var(--primary); }
.topbar-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 7px 10px;
  transition: var(--transition);
}
.topbar-back-btn svg { width: 16px; height: 16px; }
.topbar-back-btn:hover {
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 500;
}
.topbar-breadcrumb span:last-child { color: var(--primary); font-weight: 600; }
.breadcrumb-sep { opacity: 0.4; }
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-user-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--bg);
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
}
.admin-user-badge svg { width: 15px; height: 15px; }
.topbar-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 10px;
  transition: var(--transition);
}
.topbar-logout-btn svg { width: 15px; height: 15px; }
.topbar-logout-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

/* ===== PANELS ===== */
.admin-panel-wrap { flex: 1; padding: 32px; }
.panel { display: none; }
.panel.active { display: block; }
.panel-header { margin-bottom: 28px; }
.panel-title {
  font-size: 1.6rem;
  color: var(--primary);
  margin-bottom: 6px;
}
.panel-sub { color: var(--muted); font-size: 0.92rem; }
.panel-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.card-section-title {
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ===== OVERVIEW ===== */
.overview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--secondary); box-shadow: var(--shadow-md); }
.stat-card-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 6px;
}
.stat-card-label { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.stat-card-icon {
  float: right;
  width: 36px; height: 36px;
  background: rgba(41,44,81,0.07);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}
.stat-card-icon svg { width: 18px; height: 18px; }
.overview-quick { margin-top: 8px; }
.quick-title {
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 16px;
  font-weight: 700;
}
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.quick-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  transition: var(--transition);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.quick-card svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--secondary); }
.quick-card:hover { border-color: var(--secondary); background: rgba(63,81,181,0.04); }

/* ===== FORMS ===== */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}
.form-group label {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--primary);
}
.label-hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.78rem;
}
.req { color: #ef4444; }
.form-group input,
.form-group textarea,
.form-group select {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: var(--transition);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--secondary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(63,81,181,0.1);
}
.form-group input.error,
.form-group textarea.error {
  border-color: #ef4444;
}
.field-error {
  font-size: 0.76rem;
  color: #ef4444;
  font-weight: 500;
  min-height: 16px;
}
.form-actions {
  display: flex;
  gap: 12px;
  padding-top: 4px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  transition: var(--transition);
  cursor: pointer;
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--secondary); border-color: var(--secondary); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--primary); border-color: var(--primary); }
.btn-danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}
.btn-danger:hover { background: #dc2626; }
.btn-icon {
  padding: 7px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  border: 1px solid transparent;
}
.btn-icon svg { width: 15px; height: 15px; }
.btn-icon.edit { color: var(--secondary); }
.btn-icon.edit:hover { background: rgba(63,81,181,0.1); border-color: var(--secondary); }
.btn-icon.delete { color: var(--danger); }
.btn-icon.delete:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.full-width { width: 100%; justify-content: center; }

/* ===== ITEMS LIST ===== */
.items-list { display: flex; flex-direction: column; gap: 10px; }
.item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.item-row:hover { border-color: var(--secondary); background: rgba(63,81,181,0.03); }
.item-info { flex: 1; min-width: 0; }
.item-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--primary);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-meta {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.item-badge {
  background: rgba(63,81,181,0.1);
  color: var(--secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  white-space: nowrap;
  margin-top: 2px;
  display: inline-block;
}
.item-actions { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.item-step-num {
  background: rgba(41,44,81,0.08);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 8px;
}
.empty-list {
  text-align: center;
  padding: 32px;
  color: var(--muted);
  font-size: 0.9rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

/* ===== MESSAGES ===== */
.messages-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.messages-toolbar span { font-size: 0.88rem; color: var(--muted); font-weight: 500; }
.message-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.message-card.unread { border-left: 3px solid var(--secondary); }
.message-card:hover { box-shadow: var(--shadow-md); }
.msg-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.msg-sender { display: flex; flex-direction: column; gap: 2px; }
.msg-name { font-weight: 700; color: var(--primary); font-size: 0.96rem; }
.msg-email { font-size: 0.82rem; color: var(--muted); }
.msg-meta { text-align: right; }
.msg-time { font-size: 0.78rem; color: var(--muted); }
.msg-service {
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(229,178,74,0.15);
  color: #8B5E0A;
  padding: 2px 8px;
  border-radius: 100px;
  margin-top: 4px;
  display: inline-block;
}
.msg-body {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 12px;
  background: var(--bg);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.msg-body.expanded {
  display: block;
  overflow: visible;
}
.msg-phone { font-size: 0.82rem; color: var(--muted); margin-bottom: 12px; }
.msg-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.messages-empty {
  text-align: center;
  padding: 60px;
  color: var(--muted);
  background: var(--white);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.modal-icon {
  width: 56px; height: 56px;
  background: var(--danger-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: var(--danger);
}
.modal-icon svg { width: 24px; height: 24px; }
.modal-title { font-size: 1.2rem; color: var(--primary); margin-bottom: 10px; }
.modal-text { font-size: 0.9rem; color: var(--muted); margin-bottom: 28px; line-height: 1.6; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--primary);
  color: var(--white);
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.32s cubic-bezier(0.4,0,0.2,1);
  max-width: 340px;
  border-left: 4px solid var(--accent);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
  .topbar-menu-btn { display: flex; }
  .sidebar-close { display: flex; }
  .form-row-2 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .admin-panel-wrap { padding: 20px 16px; }
  .panel-card { padding: 20px 16px; }
  .overview-stats { grid-template-columns: 1fr 1fr; }
  .topbar-logout-btn span { display: none; }
  .topbar-logout-btn { padding: 7px; }
  .topbar-back-btn span { display: none; }
  .form-actions { flex-direction: column; }
  .btn.full-width { width: 100%; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; justify-content: center; }
}

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}
.sidebar-overlay.show { display: block; }
