/* ==========================================================================
   CITY MAINTAINANCE — ADMIN PANEL LAYOUT & NAVIGATION
   ========================================================================== */

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

html, body {
  height: 100%;
  font-family: var(--adm-font-sans);
  background-color: var(--adm-bg);
  color: var(--adm-text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* App Root Grid */
.adm-app {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ==========================================================================
   1. SIDEBAR
   ========================================================================== */
.adm-sidebar {
  width: var(--adm-sidebar-width);
  background-color: var(--adm-bg-sidebar);
  border-right: 1px solid var(--adm-sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Custom Scrollbar for Sidebar */
.adm-sidebar::-webkit-scrollbar {
  width: 4px;
}
.adm-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.adm-sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--adm-sidebar-border);
}

.adm-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #FFFFFF;
}

.adm-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--adm-radius-md);
  background: var(--adm-accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(0, 86, 224, 0.35);
}

.adm-brand-info {
  display: flex;
  flex-direction: column;
}

.adm-brand-title {
  font-family: var(--adm-font-heading);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  line-height: 1.2;
}

.adm-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #38BDF8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Sidebar Vendor Status Widget */
.adm-sidebar-vendor {
  margin: 1rem 1rem 0.5rem;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--adm-radius-md);
}

.adm-sidebar-vendor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.adm-vendor-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--adm-whatsapp);
}

.adm-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--adm-whatsapp);
  box-shadow: 0 0 8px var(--adm-whatsapp);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.adm-sidebar-vendor-name {
  font-size: 0.8125rem;
  color: #E2E8F0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-sidebar-vendor-phone {
  font-size: 0.75rem;
  color: #94A3B8;
  font-family: var(--adm-font-mono);
}

/* Sidebar Nav Groups */
.adm-nav-group {
  padding: 0.75rem 0.75rem 0.25rem;
}

.adm-nav-label {
  padding: 0 0.5rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748B;
}

.adm-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.adm-nav-item {
  position: relative;
}

.adm-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.75rem;
  color: var(--adm-sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--adm-radius-sm);
  transition: var(--adm-transition);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.adm-nav-link-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.adm-nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.8;
  transition: var(--adm-transition);
}

.adm-nav-link:hover {
  background-color: var(--adm-bg-sidebar-hover);
  color: #FFFFFF;
}

.adm-nav-link:hover .adm-nav-icon {
  opacity: 1;
  color: #38BDF8;
}

.adm-nav-link.active {
  background-color: var(--adm-bg-sidebar-active);
  color: var(--adm-sidebar-text-active);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.adm-nav-link.active .adm-nav-icon {
  opacity: 1;
  color: #FFFFFF;
}

.adm-nav-badge {
  padding: 0.15rem 0.45rem;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: var(--adm-radius-full);
  line-height: 1;
}

.adm-nav-badge.danger {
  background-color: var(--adm-danger);
  color: #FFFFFF;
}

.adm-nav-badge.info {
  background-color: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
}

/* Sidebar Footer */
.adm-sidebar-footer {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid var(--adm-sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.adm-storefront-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--adm-radius-sm);
  color: #38BDF8;
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: var(--adm-transition);
}

.adm-storefront-link:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.3);
  color: #FFFFFF;
}

/* ==========================================================================
   2. MAIN CONTENT AREA
   ========================================================================== */
.adm-main-wrapper {
  margin-left: var(--adm-sidebar-width);
  width: calc(100% - var(--adm-sidebar-width));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Top Navigation Bar */
.adm-header {
  height: var(--adm-header-height);
  background: var(--adm-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--adm-border);
  position: sticky;
  top: 0;
  z-index: 90;
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.adm-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.adm-mobile-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--adm-border);
  color: var(--adm-text-main);
  padding: 0.5rem;
  border-radius: var(--adm-radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.adm-header-title-box {
  display: flex;
  flex-direction: column;
}

.adm-page-title {
  font-family: var(--adm-font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--adm-text-main);
  line-height: 1.2;
}

.adm-page-breadcrumb {
  font-size: 0.75rem;
  color: var(--adm-text-muted);
}

/* Header Global Search */
.adm-header-search {
  position: relative;
  width: 320px;
}

.adm-search-input {
  width: 100%;
  padding: 0.55rem 2.25rem 0.55rem 2.25rem;
  background: var(--adm-surface-subtle);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-md);
  font-size: 0.85rem;
  color: var(--adm-text-main);
  font-family: inherit;
  transition: var(--adm-transition);
}

.adm-search-input:focus {
  outline: none;
  border-color: var(--adm-primary);
  background: var(--adm-surface);
  box-shadow: 0 0 0 3px var(--adm-primary-glow);
}

.adm-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--adm-text-muted);
  pointer-events: none;
  display: flex;
}

.adm-search-kbd {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  color: var(--adm-text-muted);
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: var(--adm-font-mono);
  pointer-events: none;
}

/* Header Actions */
.adm-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.adm-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--adm-radius-md);
  border: 1px solid var(--adm-border);
  background: var(--adm-surface);
  color: var(--adm-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--adm-transition);
  position: relative;
}

.adm-icon-btn:hover {
  background: var(--adm-surface-alt);
  color: var(--adm-text-main);
  border-color: var(--adm-border-dark);
}

.adm-icon-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--adm-danger);
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--adm-surface);
}

/* Header Quick Actions */
.adm-quick-actions-dropdown {
  position: relative;
}

/* Vendor Profile Menu in Header */
.adm-user-profile {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--adm-radius-md);
  border: 1px solid var(--adm-border);
  background: var(--adm-surface);
  cursor: pointer;
  transition: var(--adm-transition);
}

.adm-user-profile:hover {
  border-color: var(--adm-primary);
}

.adm-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--adm-accent-gradient);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8125rem;
}

.adm-user-meta {
  display: flex;
  flex-direction: column;
}

.adm-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--adm-text-main);
  line-height: 1.2;
}

.adm-user-role {
  font-size: 0.7rem;
  color: var(--adm-text-muted);
}

/* ==========================================================================
   3. PAGE CONTENT CONTAINER
   ========================================================================== */
.adm-content {
  flex: 1;
  padding: 1.75rem;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* Router Views */
.adm-view {
  display: none;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.adm-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sidebar Backdrop on Mobile */
.adm-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 95;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.adm-sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

/* ==========================================================================
   4. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1024px) {
  .adm-sidebar {
    transform: translateX(-100%);
  }

  .adm-sidebar.open {
    transform: translateX(0);
  }

  .adm-main-wrapper {
    margin-left: 0;
    width: 100%;
  }

  .adm-mobile-toggle {
    display: flex;
  }

  .adm-header-search {
    width: 220px;
  }
}

@media (max-width: 768px) {
  .adm-header {
    padding: 0 1rem;
  }

  .adm-content {
    padding: 1rem;
  }

  .adm-header-search {
    display: none;
  }

  .adm-user-meta {
    display: none;
  }
}
