/* ============================================================
   Apple Pro Tech - Admin Panel Stylesheet
   ============================================================ */

:root {
  --admin-sidebar-width: 260px;
  --admin-header-height: 65px;
  --admin-bg: #F0F2F5;
  --admin-sidebar-bg: #0D1B2A;
  --admin-sidebar-text: rgba(255,255,255,0.75);
  --admin-sidebar-active: #007AFF;
  --card-bg: #FFFFFF;
  --border: #E5E7EB;
  --text: #1F2937;
  --text-muted: #6B7280;
  --primary: #007AFF;
  --primary-light: #E8F3FF;
  --success: #34C759;
  --danger: #FF3B30;
  --warning: #FF9500;
  --info: #32ADE6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --radius: 12px;
  --radius-sm: 8px;
}

[data-admin-theme="dark"] {
  --admin-bg: #0D1117;
  --card-bg: #161B22;
  --border: rgba(255,255,255,.1);
  --text: #F0F6FC;
  --text-muted: #8B949E;
  --admin-bg: #0D1117;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--admin-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--admin-sidebar-width);
  height: 100vh;
  background: var(--admin-sidebar-bg);
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s ease, width 0.3s ease;
  display: flex;
  flex-direction: column;
}
.admin-sidebar::-webkit-scrollbar       { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-decoration: none;
  flex-shrink: 0;
}
.sidebar-brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #007AFF, #5856D6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
}
.sidebar-brand-text .name { color: #fff; font-weight: 700; font-size: .95rem; line-height: 1.2; }
.sidebar-brand-text .sub  { color: rgba(255,255,255,.4); font-size: .65rem; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-section-label {
  padding: 16px 20px 6px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.25);
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--admin-sidebar-text);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  border-radius: 0;
  transition: all 0.2s ease;
  position: relative;
}
.sidebar-item:hover {
  background: rgba(255,255,255,.05);
  color: #fff;
}
.sidebar-item.active {
  background: rgba(0,122,255,.15);
  color: var(--admin-sidebar-active);
  border-right: 3px solid var(--admin-sidebar-active);
}
.sidebar-item .si-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: .85rem;
  flex-shrink: 0;
  transition: all 0.2s;
}
.sidebar-item:hover    .si-icon { background: rgba(255,255,255,.08); }
.sidebar-item.active   .si-icon { background: rgba(0,122,255,.2); color: var(--admin-sidebar-active); }
.sidebar-item .si-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.15);
}
.sidebar-user-name { color: rgba(255,255,255,.8); font-size: .82rem; font-weight: 600; line-height: 1.2; }
.sidebar-user-role { color: rgba(255,255,255,.35); font-size: .7rem; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.admin-main {
  margin-left: var(--admin-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

/* Header */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 900;
  height: var(--admin-header-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}
.admin-header-title {
  font-size: .95rem;
  font-weight: 700;
  flex: 1;
}
.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--admin-bg);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: .85rem;
  transition: all .2s;
  text-decoration: none;
  position: relative;
}
.admin-btn-icon:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.admin-btn-icon .notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--card-bg);
}
.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  cursor: pointer;
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.admin-content {
  flex: 1;
  padding: 24px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.page-title { font-size: 1.2rem; font-weight: 800; }
.breadcrumb { font-size: .8rem; color: var(--text-muted); }
.breadcrumb a { color: var(--primary); text-decoration: none; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-content .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 2px;
}
.stat-content .stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; }
.stat-content .stat-change {
  font-size: .72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   ADMIN CARDS
   ============================================================ */
.admin-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: .9rem;
}
.admin-card-body { padding: 20px; }

/* ============================================================
   TABLES
   ============================================================ */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  background: var(--admin-bg);
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--admin-bg); }
.admin-table .td-actions { display: flex; gap: 6px; }

/* ============================================================
   BADGES
   ============================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
}
.badge-success  { background: rgba(52,199,89,.1);   color: #27a745; }
.badge-warning  { background: rgba(255,149,0,.1);   color: #d68a00; }
.badge-danger   { background: rgba(255,59,48,.1);   color: #dc3545; }
.badge-info     { background: rgba(50,173,230,.1);  color: #17a2b8; }
.badge-primary  { background: rgba(0,122,255,.1);   color: #007AFF; }
.badge-secondary{ background: rgba(0,0,0,.05);      color: #6c757d; }

/* ============================================================
   FORMS
   ============================================================ */
.admin-form-group { margin-bottom: 18px; }
.admin-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.admin-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  font-size: .85rem;
  font-family: inherit;
  transition: all .2s;
  outline: none;
}
.admin-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,122,255,.1);
}
.admin-input::placeholder { color: var(--text-muted); opacity: .7; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.btn-admin-primary  { background: var(--primary); color: #fff; }
.btn-admin-primary:hover  { background: #0056CC; color: #fff; }
.btn-admin-success  { background: var(--success); color: #fff; }
.btn-admin-success:hover  { background: #28a745; color: #fff; }
.btn-admin-danger   { background: var(--danger);  color: #fff; }
.btn-admin-danger:hover   { background: #cc2f26; color: #fff; }
.btn-admin-warning  { background: var(--warning); color: #fff; }
.btn-admin-secondary{ background: var(--admin-bg); color: var(--text); border-color: var(--border); }
.btn-admin-secondary:hover { background: var(--border); }
.btn-admin-outline  { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-admin-outline:hover { background: var(--primary); color: #fff; }
.btn-admin-sm { padding: 5px 10px; font-size: .75rem; }
.btn-admin-xs { padding: 3px 8px; font-size: .7rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
.sidebar-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 1.1rem;
  color: var(--text);
}

@media (max-width: 991px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: block;
  }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
    display: none;
  }
  .sidebar-overlay.show {
    display: block;
  }
}

@media (max-width: 576px) {
  .admin-content { padding: 16px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.3rem !important; }
}

/* Quick action buttons */
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--admin-bg);
  border: 1.5px dashed var(--border);
  color: var(--text-muted);
  text-decoration: none;
  font-size: .8rem;
  font-weight: 600;
  transition: all .2s;
  text-align: center;
}
.quick-action i { font-size: 1.3rem; }
.quick-action:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Activity feed */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  flex-shrink: 0;
}
.activity-text { font-size: .82rem; line-height: 1.4; }
.activity-time { font-size: .72rem; color: var(--text-muted); }
