/* =============================================
   WebAgency Admin Panel — admin.css
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg-base:    #0a0e1a;
  --bg-card:    #111827;
  --bg-hover:   #1e293b;
  --border:     rgba(255,255,255,0.08);
  --accent:     #6366f1;
  --accent2:    #0ea5e9;
  --success:    #22c55e;
  --warning:    #f59e0b;
  --danger:     #ef4444;
  --info:       #06b6d4;
  --purple:     #a855f7;
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --sidebar-w: 260px;
  --topbar-h:  64px;
  --radius:    12px;
}

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

body.admin-body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; z-index: 100;
  transition: transform .3s ease;
}
.sidebar-header {
  padding: 1.5rem 1.2rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo { display: flex; align-items: center; gap: .7rem; }
.logo-icon { width: 36px; height: 36px; background: linear-gradient(135deg,var(--accent),var(--accent2)); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.logo-text { font-family: 'Syne', sans-serif; font-weight: 700; font-size: .95rem; color: var(--text-primary); }
.sidebar-close { display: none; background: none; border: none; color: var(--text-secondary); font-size: 1.2rem; cursor: pointer; }

.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-group { margin-bottom: .5rem; }
.nav-label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); padding: .5rem 1.2rem; display: block; }
.nav-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .65rem 1.2rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 0;
  transition: .2s;
  font-size: .9rem;
  position: relative;
}
.nav-item:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-item.active { color: var(--text-primary); background: rgba(99,102,241,.15); border-right: 3px solid var(--accent); }
.nav-item.active .nav-icon { filter: drop-shadow(0 0 6px var(--accent)); }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: .7rem; padding: .1rem .45rem; border-radius: 10px; font-weight: 600; }
.nav-item-danger:hover { color: var(--danger); }

.sidebar-user {
  padding: 1rem 1.2rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: .8rem;
}
.user-avatar { width: 36px; height: 36px; background: linear-gradient(135deg,var(--accent),var(--purple)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; flex-shrink: 0; }
.user-info { overflow: hidden; }
.user-info strong { display: block; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span { font-size: .75rem; color: var(--text-muted); }

/* ---- Main Area ---- */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin .3s;
}
.topbar {
  position: sticky; top: 0; z-index: 90;
  height: var(--topbar-h);
  background: rgba(10,14,26,.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.menu-toggle { background: none; border: 1px solid var(--border); border-radius: 8px; color: var(--text-secondary); font-size: 1.1rem; padding: .35rem .55rem; cursor: pointer; display: none; }
.page-title { font-family: 'Syne', sans-serif; font-size: 1.1rem; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.notif-wrapper { position: relative; }
.notif-btn { background: none; border: 1px solid var(--border); border-radius: 8px; color: var(--text-secondary); padding: .4rem .7rem; cursor: pointer; font-size: .9rem; position: relative; }
.notif-dot { position: absolute; top: -5px; right: -5px; background: var(--danger); color: #fff; font-size: .65rem; padding: .05rem .3rem; border-radius: 10px; font-weight: 700; }
.notif-dropdown { position: absolute; right: 0; top: calc(100% + .5rem); width: 300px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: none; z-index: 200; }
.notif-dropdown.show { display: block; }
.notif-header { padding: .75rem 1rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: .85rem; font-weight: 600; }
.mark-read { color: var(--accent); font-size: .8rem; text-decoration: none; }
.notif-item { padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.notif-item strong { font-size: .85rem; display: block; }
.notif-item p { font-size: .8rem; color: var(--text-secondary); margin: .2rem 0 .1rem; }
.notif-item small { color: var(--text-muted); font-size: .75rem; }
.notif-empty { padding: 1rem; text-align: center; color: var(--text-muted); font-size: .85rem; }
.btn-view-site { background: rgba(99,102,241,.15); border: 1px solid rgba(99,102,241,.3); color: #a5b4fc; text-decoration: none; padding: .4rem .9rem; border-radius: 8px; font-size: .85rem; }

.admin-content { padding: 1.5rem; flex: 1; }

/* ---- Stats Grid ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stats-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; display: flex; align-items: center; gap: 1rem; }
.stat-icon { font-size: 2rem; flex-shrink: 0; }
.stat-body { display: flex; flex-direction: column; gap: .2rem; }
.stat-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat-value { font-family: 'Syne', sans-serif; font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat-sub { font-size: .78rem; color: var(--text-muted); }
.stat-blue   { border-left: 3px solid var(--accent2); }
.stat-purple { border-left: 3px solid var(--accent); }
.stat-green  { border-left: 3px solid var(--success); }
.stat-orange { border-left: 3px solid var(--warning); }
.stat-teal   { border-left: 3px solid var(--info); }
.stat-red    { border-left: 3px solid var(--danger); }

/* ---- Quick Actions ---- */
.quick-actions { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.5rem; margin-bottom: 1.5rem; }
.qa-grid { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }
.qa-btn { background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.3); color: #a5b4fc; text-decoration: none; padding: .5rem 1rem; border-radius: 8px; font-size: .85rem; font-weight: 500; transition: .2s; }
.qa-btn:hover { background: rgba(99,102,241,.25); transform: translateY(-1px); }
.qa-btn-secondary { background: rgba(255,255,255,.05); border-color: var(--border); color: var(--text-secondary); }

/* ---- Dashboard Grid ---- */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.dash-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.5rem; }
.card-title { font-family: 'Syne', sans-serif; font-size: .95rem; font-weight: 700; margin-bottom: 1rem; }
.card-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.view-all { color: var(--accent2); font-size: .82rem; text-decoration: none; }

/* ---- Tables ---- */
.table-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th { background: rgba(255,255,255,.04); padding: .85rem 1rem; text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.data-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }
.table-footer { padding: .75rem 1rem; font-size: .8rem; color: var(--text-muted); border-top: 1px solid var(--border); }

/* ---- Badges ---- */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 6px; font-size: .75rem; font-weight: 600; }
.badge-success  { background: rgba(34,197,94,.15);  color: #86efac; }
.badge-warning  { background: rgba(245,158,11,.15); color: #fcd34d; }
.badge-danger   { background: rgba(239,68,68,.15);  color: #fca5a5; }
.badge-info     { background: rgba(6,182,212,.15);  color: #67e8f9; }
.badge-purple   { background: rgba(168,85,247,.15); color: #d8b4fe; }
.badge-secondary{ background: rgba(255,255,255,.08);color: var(--text-secondary); }
.code-badge { font-family: monospace; font-size: .78rem; background: rgba(99,102,241,.15); color: #a5b4fc; padding: .15rem .5rem; border-radius: 5px; }

/* ---- Buttons ---- */
.btn-primary   { background: linear-gradient(135deg,var(--accent),var(--accent2)); color: #fff; border: none; padding: .6rem 1.2rem; border-radius: 8px; font-size: .88rem; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; transition: .2s; font-family: inherit; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(99,102,241,.4); }
.btn-secondary { background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border); padding: .6rem 1.2rem; border-radius: 8px; font-size: .88rem; cursor: pointer; text-decoration: none; display: inline-block; transition: .2s; }
.btn-success   { background: rgba(34,197,94,.15); color: #86efac; border: 1px solid rgba(34,197,94,.3); padding: .6rem 1.2rem; border-radius: 8px; font-size: .88rem; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; transition: .2s; }
.btn-back { color: var(--text-secondary); text-decoration: none; font-size: .9rem; display: inline-flex; align-items: center; gap: .4rem; }
.btn-back:hover { color: var(--text-primary); }
.btn-sm { background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border); padding: .25rem .6rem; border-radius: 6px; font-size: .78rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-sm:hover { background: rgba(255,255,255,.1); color: var(--text-primary); }
.btn-sm-warning { border-color: rgba(245,158,11,.3); color: #fcd34d; }
.btn-sm-danger  { border-color: rgba(239,68,68,.3);  color: #fca5a5; }
.btn-sm-success { border-color: rgba(34,197,94,.3);  color: #86efac; }
.btn-wa { background: rgba(37,211,102,.12); border-color: rgba(37,211,102,.3); color: #86efac; }
.actions-cell { white-space: nowrap; }
.actions-cell a, .actions-cell button { margin-right: .3rem; }

/* ---- Form Styles ---- */
.form-page { max-width: 960px; margin: 0 auto; }
.form-header { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.5rem; }
.form-header h2 { font-family: 'Syne', sans-serif; font-size: 1.3rem; font-weight: 700; }
.form-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; }
.form-section-title { font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--accent2); margin: 1.5rem 0 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
.form-section-title:first-child { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.form-group label small { text-transform: none; font-weight: 400; font-size: .78rem; letter-spacing: 0; }
.form-group input, .form-group select, .form-group textarea {
  background: rgba(255,255,255,.05); border: 1px solid var(--border); border-radius: 8px;
  padding: .7rem .9rem; color: var(--text-primary); font-size: .9rem; font-family: inherit;
  transition: .2s; outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent); background: rgba(99,102,241,.08);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-group select option { background: var(--bg-card); }
.form-group textarea { resize: vertical; min-height: 90px; }
.form-actions { display: flex; gap: .8rem; align-items: center; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }

/* ---- Toolbar ---- */
.page-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.search-form input { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: .55rem .9rem; color: var(--text-primary); font-family: inherit; font-size: .88rem; outline: none; }
.search-form input:focus { border-color: var(--accent); }
.search-form select { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: .55rem .9rem; color: var(--text-primary); font-family: inherit; font-size: .88rem; outline: none; cursor: pointer; }
.toolbar-actions { display: flex; gap: .5rem; }

/* ---- Detail Views ---- */
.detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.detail-actions { display: flex; gap: .6rem; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.detail-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.detail-card h3 { font-family: 'Syne', sans-serif; font-size: .95rem; margin-bottom: 1rem; padding-bottom: .7rem; border-bottom: 1px solid var(--border); }
.detail-row { display: flex; padding: .5rem 0; border-bottom: 1px solid rgba(255,255,255,.04); font-size: .88rem; }
.detail-row:last-child { border-bottom: none; }
.detail-row label { width: 110px; flex-shrink: 0; color: var(--text-muted); font-size: .82rem; }
.detail-row a { color: var(--accent2); text-decoration: none; }
.detail-row p { color: var(--text-secondary); line-height: 1.6; }

/* ---- Project mini item ---- */
.project-mini { padding: .75rem; background: var(--bg-hover); border-radius: 8px; margin-bottom: .5rem; }

/* ---- Payment ---- */
.payment-summary { background: var(--bg-hover); border-radius: 8px; padding: 1rem; }
.pay-row { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.pay-row:last-child { border-bottom: none; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.transaction-item { padding: .6rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.transaction-item small { color: var(--text-muted); }

/* ---- Progress bar ---- */
.progress-bar-wrap { width: 100%; height: 5px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; display: inline-block; vertical-align: middle; }
.progress-bar { height: 100%; background: linear-gradient(90deg,var(--accent),var(--accent2)); border-radius: 3px; transition: width .4s; }

/* ---- Leads ---- */
.leads-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.lead-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.lead-card.new    { border-left: 3px solid var(--info); }
.lead-card.contacted { border-left: 3px solid var(--warning); }
.lead-card.quoted { border-left: 3px solid var(--purple); }
.lead-card.converted { border-left: 3px solid var(--success); }
.lead-card.lost   { border-left: 3px solid var(--text-muted); opacity: .7; }
.lead-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .8rem; }
.lead-header h4 { font-family: 'Syne', sans-serif; font-size: 1rem; }
.lead-source { font-size: .75rem; color: var(--text-muted); }
.lead-body p { font-size: .85rem; margin: .3rem 0; color: var(--text-secondary); }
.lead-body a { color: var(--accent2); text-decoration: none; }
.lead-msg { font-style: italic; color: var(--text-muted) !important; }
.admin-note { background: rgba(245,158,11,.08); border-radius: 5px; padding: .4rem .6rem; color: var(--warning) !important; }
.lead-actions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--border); }
.status-select-wrap select { background: var(--bg-hover); border: 1px solid var(--border); border-radius: 6px; color: var(--text-primary); font-size: .78rem; padding: .25rem .5rem; font-family: inherit; }
.lead-actions textarea { width: 100%; background: rgba(255,255,255,.05); border: 1px solid var(--border); border-radius: 6px; color: var(--text-primary); padding: .5rem; font-family: inherit; font-size: .85rem; resize: vertical; min-height: 70px; }

/* ---- Status Tabs ---- */
.status-tabs { display: flex; align-items: center; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab { text-decoration: none; color: var(--text-secondary); padding: .5rem .9rem; border-radius: 8px; font-size: .85rem; background: var(--bg-card); border: 1px solid var(--border); transition: .2s; }
.tab:hover, .tab.active { background: rgba(99,102,241,.15); border-color: rgba(99,102,241,.3); color: #a5b4fc; }
.tab-count { background: rgba(255,255,255,.12); padding: .05rem .4rem; border-radius: 10px; font-size: .72rem; font-weight: 600; margin-left: .3rem; }

/* ---- Flash Messages ---- */
.flash-msg { padding: .85rem 1.2rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; transition: opacity .4s; }
.flash-success { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); color: #86efac; }
.flash-error   { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }

/* ---- Section Title ---- */
.section-title { font-family: 'Syne', sans-serif; font-size: .95rem; font-weight: 700; margin-bottom: .8rem; }
.empty-state { color: var(--text-muted); font-size: .9rem; text-align: center; padding: 1.5rem; }
.empty-state a { color: var(--accent2); text-decoration: none; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .menu-toggle { display: block; }
  .sidebar-close { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .form-full { grid-column: auto; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-toolbar { flex-direction: column; align-items: flex-start; }
  .admin-content { padding: 1rem; }
  .leads-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stats-grid-4 { grid-template-columns: 1fr 1fr; }
}
