/* Αριστερό μενού — Apple platinum #f5f5f7, SF typography */

.app-shell {
  --sidebar-w: 19rem;
}

.app-shell.sidebar-collapsed {
  --sidebar-w: 4.75rem;
}

.app-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100%;
  z-index: 50;
  width: var(--sidebar-w);
  transition: width 0.22s ease;
  overflow: hidden;
  color: #1c1c1e;
  background: #f5f5f7;
  border-right: 1px solid rgba(60, 60, 67, 0.12);
  box-shadow: none;
  --nav-icon-slot: 1.375rem;
  --nav-trail-slot: 1.25rem;
  --nav-row-h: 2.25rem;
  --nav-subnav-indent: calc(0.75rem + var(--nav-icon-slot) + 0.625rem);
  --sidebar-text: #1c1c1e;
  --sidebar-text-muted: #48484a;
  --sidebar-hover: rgba(60, 60, 67, 0.06);
  --sidebar-active: rgba(0, 95, 170, 0.12);
  --sidebar-active-text: #005faa;
  --sidebar-accent: #005faa;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-sidebar::before {
  content: none;
}

.app-sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1rem 0.75rem 0.85rem;
  min-height: 0;
  position: relative;
  z-index: 1;
}

/* Brand card */
.app-sidebar-brand-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  margin-bottom: 0.65rem;
  border-radius: 0.875rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(60, 60, 67, 0.08);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: none;
}

.app-sidebar-brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.625rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--brand-primary, #005faa);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.app-sidebar-brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.app-sidebar-brand-text {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.app-sidebar-brand-kicker {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #1c1c1e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar-brand-sub {
  margin: 0.2rem 0 0;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar-collapse-btn {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.72);
  color: #404752;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.app-sidebar-collapse-btn:hover {
  background: #fff;
  color: #005faa;
}

.app-sidebar-nav-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.1rem;
}

.app-sidebar-section-label {
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sidebar-text-muted);
  padding: 0.75rem 0.5rem 0.3rem;
  margin: 0;
  pointer-events: none;
  user-select: none;
}

.app-sidebar-section-label:first-child {
  padding-top: 0.15rem;
}

.app-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sidebar-nav-row {
  display: grid;
  grid-template-columns: 0 minmax(0, 1fr);
  align-items: stretch;
  min-width: 0;
  transition: grid-template-columns 0.15s ease;
}

.sidebar-nav-row:hover,
#sidebarNav.is-reordering .sidebar-nav-row {
  grid-template-columns: 0.875rem minmax(0, 1fr);
}

.sidebar-nav-row > a,
.sidebar-nav-row > details,
.sidebar-nav-row > .app-sidebar-group {
  grid-column: 2;
  min-width: 0;
}

.sidebar-drag-handle {
  grid-column: 1;
  flex-shrink: 0;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 0.875rem;
  min-height: var(--nav-row-h);
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: grab;
  opacity: 0;
  overflow: hidden;
  transition: opacity 0.15s ease, color 0.15s ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.sidebar-drag-handle .material-symbols-outlined {
  font-size: 1rem;
}

.sidebar-nav-row:hover .sidebar-drag-handle,
#sidebarNav.is-reordering .sidebar-drag-handle {
  opacity: 0.55;
}

.sidebar-drag-handle:hover {
  opacity: 1 !important;
  color: var(--sidebar-accent);
}

.sidebar-drag-handle:active {
  cursor: grabbing;
}

.app-shell.sidebar-collapsed .sidebar-drag-handle {
  display: none;
}

/* Nav items — 3-column grid: icon | label | chevron/spacer */
.app-sidebar-nav-item,
.app-sidebar-link {
  position: relative;
  display: grid;
  grid-template-columns: var(--nav-icon-slot) minmax(0, 1fr) var(--nav-trail-slot);
  align-items: center;
  column-gap: 0.625rem;
  height: var(--nav-row-h);
  min-height: var(--nav-row-h);
  max-height: var(--nav-row-h);
  padding: 0 0.625rem 0 0.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  color: var(--sidebar-text);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  border: none;
  background: transparent;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.app-sidebar-nav-item:not(.app-sidebar-group-toggle)::after {
  content: "";
  grid-column: 3;
  width: var(--nav-trail-slot);
  height: 1px;
}

.app-sidebar-nav-item:hover,
.app-sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #1c1c1e;
}

.app-sidebar-nav-item.is-active,
.app-sidebar-link.is-active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--sidebar-accent);
}

.app-sidebar-nav-item.is-active::before,
.app-sidebar-link.is-active::before {
  content: none;
}

.app-sidebar-nav-icon {
  grid-column: 1;
  width: var(--nav-icon-slot);
  height: var(--nav-icon-slot);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.125rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
}

.app-sidebar-nav-icon.material-symbols-outlined {
  font-size: 1.125rem;
}

svg.app-sidebar-nav-icon {
  width: 1.125rem !important;
  height: 1.125rem !important;
  stroke-width: 1.75;
}

.app-sidebar-nav-item.is-active .app-sidebar-nav-icon,
.app-sidebar-link.is-active .app-sidebar-nav-icon {
  color: var(--sidebar-active-text);
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 20;
}

.app-sidebar-nav-label,
.app-sidebar-link-label {
  grid-column: 2;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Υποστήριξη */
.app-sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.app-sidebar-group-toggle {
  width: 100%;
  text-align: left;
  list-style: none;
  padding: 0 0.625rem 0 0.5rem;
  height: var(--nav-row-h);
  min-height: var(--nav-row-h);
  max-height: var(--nav-row-h);
  cursor: pointer;
  border: none;
  background: transparent;
  font: inherit;
  color: var(--sidebar-text);
  appearance: none;
  -webkit-appearance: none;
}

.sidebar-nav-row:has(.app-sidebar-group.is-expanded) {
  position: relative;
  z-index: 6;
}

.app-sidebar-group-toggle::-webkit-details-marker {
  display: none;
}

.app-sidebar-group > summary {
  list-style: none;
}

.app-sidebar-chevron {
  grid-column: 3;
  justify-self: center;
  align-self: center;
  margin: 0;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.85;
  color: var(--sidebar-text-muted);
  transition: transform 0.2s ease, opacity 0.15s ease;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
}

.app-sidebar-group-toggle:hover .app-sidebar-chevron {
  opacity: 0.9;
}

.app-sidebar-group.is-expanded .app-sidebar-chevron,
.app-sidebar-group[open] .app-sidebar-chevron {
  transform: rotate(180deg);
}

.app-sidebar-subnav {
  display: none;
  flex-direction: column;
  gap: 0.125rem;
  margin: 0.125rem 0 0.25rem;
  padding: 0.125rem 0 0.125rem var(--nav-subnav-indent);
  border-left: 1px solid rgba(60, 60, 67, 0.12);
  position: relative;
  z-index: 2;
}

.app-sidebar-group.is-expanded .app-sidebar-subnav,
.app-sidebar-group[open] .app-sidebar-subnav {
  display: flex;
}

.app-sidebar-sublink {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 2rem;
  min-height: 2rem;
  max-height: 2rem;
  padding: 0 0.625rem;
  border-radius: 0.4375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease;
  position: relative;
  z-index: 1;
  pointer-events: auto;
  cursor: pointer;
}

.app-sidebar-sublink:hover {
  background: var(--sidebar-hover);
  color: #005faa;
}

.app-sidebar-sublink.is-active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--sidebar-accent);
}

.app-sidebar-sublink-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
  flex-shrink: 0;
}

.app-sidebar-sublink.is-active .app-sidebar-sublink-dot {
  opacity: 1;
}

.app-sidebar-hint {
  font-size: 0.625rem;
  color: var(--sidebar-text-muted);
  text-align: center;
  padding: 0.5rem 0.35rem 0;
  line-height: 1.35;
}

/* CTA — Νέο σέρβις */
.app-sidebar-cta {
  padding: 0.65rem 0.25rem 0.5rem;
  flex-shrink: 0;
}

.app-sidebar-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 0.625rem;
  background: #005faa;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 95, 170, 0.28);
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.app-sidebar-cta-btn:hover {
  background: #0078d4;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 95, 170, 0.32);
}

/* Footer */
.app-sidebar-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(60, 60, 67, 0.1);
  flex-shrink: 0;
}

.app-sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.25rem;
  min-width: 0;
}

.app-sidebar-user-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.65rem;
  background: linear-gradient(145deg, #d3e3ff, #a3c9ff);
  color: #004883;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.app-sidebar-user-meta {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.app-sidebar-user-meta p {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #181c22;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar-user-meta span {
  font-size: 0.625rem;
  color: var(--sidebar-text-muted);
}

.app-sidebar-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.app-sidebar-footer-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.28rem 0.5rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(192, 199, 212, 0.5);
  background: rgba(255, 255, 255, 0.72);
  color: #404752;
  text-decoration: none;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.2;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.app-sidebar-footer-btn:hover {
  background: #fff;
  border-color: rgba(192, 199, 212, 0.8);
  color: #005faa;
}

.app-sidebar-footer-btn--danger:hover {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(252, 165, 165, 0.35);
}

/* Collapsed */
.app-shell.sidebar-collapsed .app-sidebar-brand-text,
.app-shell.sidebar-collapsed .app-sidebar-nav-label,
.app-shell.sidebar-collapsed .app-sidebar-link-label,
.app-shell.sidebar-collapsed .app-sidebar-section-label,
.app-shell.sidebar-collapsed .app-sidebar-user-meta,
.app-shell.sidebar-collapsed .app-sidebar-hint,
.app-shell.sidebar-collapsed .app-sidebar-cta,
.app-shell.sidebar-collapsed .app-sidebar-footer-btn span:not(.material-symbols-outlined),
.app-shell.sidebar-collapsed .app-sidebar-chevron,
.app-shell.sidebar-collapsed .app-sidebar-subnav {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  width: 0;
  height: 0;
}

.app-shell.sidebar-collapsed .app-sidebar-brand-card {
  justify-content: center;
  padding: 0.65rem 0.35rem;
}

.app-shell.sidebar-collapsed .app-sidebar-collapse-btn {
  position: absolute;
  right: 0.25rem;
  top: 0.25rem;
}

.app-shell.sidebar-collapsed .app-sidebar-nav-item,
.app-shell.sidebar-collapsed .app-sidebar-link {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem;
  min-height: var(--nav-row-h);
}

.app-shell.sidebar-collapsed .app-sidebar-nav-item::after {
  display: none;
}

.app-shell.sidebar-collapsed .app-sidebar-nav-icon {
  width: auto;
  height: auto;
}

.app-shell.sidebar-collapsed .app-sidebar-group-toggle {
  justify-content: center;
}

.app-shell.sidebar-collapsed .app-sidebar-footer-actions {
  flex-direction: column;
}

.app-shell.sidebar-collapsed .app-sidebar-collapse-btn .material-symbols-outlined {
  transform: rotate(180deg);
}

/* Flyout υπομενού όταν collapsed */
.app-shell.sidebar-collapsed .app-sidebar-group.is-expanded,
.app-shell.sidebar-collapsed .app-sidebar-group[open] {
  position: relative;
}

.app-shell.sidebar-collapsed .app-sidebar-group.is-expanded .app-sidebar-subnav,
.app-shell.sidebar-collapsed .app-sidebar-group[open] .app-sidebar-subnav {
  position: fixed;
  left: var(--sidebar-w);
  top: 0;
  width: 11.5rem;
  margin: 0;
  padding: 0.5rem;
  border-left: none;
  border-radius: 0.625rem;
  background: #f5f5f7;
  border: 1px solid rgba(60, 60, 67, 0.12);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14);
  opacity: 1;
  max-width: none;
  height: auto;
  overflow: visible;
  pointer-events: auto;
  z-index: 12050;
}

.app-sidebar-sublink .material-symbols-outlined.app-sidebar-sublink-icon {
  font-size: 0.875rem;
  width: 0.875rem;
  height: 0.875rem;
  line-height: 1;
  opacity: 0.92;
  flex-shrink: 0;
}

.app-sidebar-sublink.is-active .material-symbols-outlined.app-sidebar-sublink-icon {
  opacity: 1;
}

/* Κλικ στο εικονίδιο ομάδας όταν το sidebar είναι στενό */
.app-shell.sidebar-collapsed .app-sidebar-group > summary,
.app-shell.sidebar-collapsed .app-sidebar-group > .app-sidebar-group-toggle {
  cursor: pointer;
}

/* Drag reorder */
#sidebarNav.is-reordering {
  user-select: none;
  touch-action: none;
}

body.is-sidebar-reordering .app-sidebar-nav-wrap {
  overflow: hidden;
}

/* Τεχνικός — πάντα ορατό handle για drag */
body[data-field-technician="1"] .sidebar-nav-row {
  grid-template-columns: 0.875rem minmax(0, 1fr);
}

body[data-field-technician="1"] .sidebar-drag-handle {
  opacity: 0.55;
}

body[data-field-technician="1"] .sidebar-nav-row:hover .sidebar-drag-handle,
body[data-field-technician="1"] #sidebarNav.is-reordering .sidebar-drag-handle {
  opacity: 0.85;
}

#sidebarNav .sidebar-nav-row.is-dragging {
  opacity: 0.65;
  z-index: 2;
}

#sidebarNav .sidebar-nav-row.is-dragging > a,
#sidebarNav .sidebar-nav-row.is-dragging > details,
#sidebarNav .sidebar-nav-row.is-dragging > .app-sidebar-group {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

#sidebarNav .sidebar-nav-row.is-drag-over > a,
#sidebarNav .sidebar-nav-row.is-drag-over > details,
#sidebarNav .sidebar-nav-row.is-drag-over > .app-sidebar-group {
  outline: 2px dashed rgba(0, 95, 170, 0.4);
  outline-offset: 1px;
}

/* Force readable text inside sidebar (overrides body/tailwind inherit) */
.app-sidebar .app-sidebar-nav-item,
.app-sidebar .app-sidebar-link,
.app-sidebar .app-sidebar-group-toggle,
.app-sidebar .app-sidebar-sublink,
.app-sidebar .app-sidebar-section-label {
  color: var(--sidebar-text);
}

.app-sidebar .app-sidebar-section-label {
  color: var(--sidebar-text-muted);
  font-weight: 800;
}

.app-sidebar-sublink-text {
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar-ticket-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: auto;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.35);
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar-ticket-badge__count {
  color: #b91c1c;
}

.sidebar-ticket-badge__label {
  color: #dc2626;
  text-transform: lowercase;
}

.sidebar-ticket-badge--group {
  margin-left: 0.25rem;
  margin-right: 0.15rem;
}

.sidebar-ticket-badge--mobile {
  position: absolute;
  top: -2px;
  right: 0.15rem;
  margin-left: 0;
  transform: scale(0.92);
  transform-origin: top right;
}

.support-nav__item {
  position: relative;
}

.support-nav__item .sidebar-ticket-badge {
  margin-left: 0.35rem;
}

@media (min-width: 768px) {
  .app-main,
  main.app-main,
  main.md\:ml-sidebar_width {
    margin-left: var(--sidebar-w) !important;
    transition: margin-left 0.22s ease;
  }
}
