/* ============================================================
   ALL-TOOLS.CSS — Admin Panel Layout with Accordion Sidebar
   ============================================================ */

/* ─── LAYOUT ─── */
.alltools-layout {
  display: flex;
  min-height: calc(100vh - 60px);
}

/* ─── SIDEBAR ─── */
.alltools-sidebar {
  width: 270px;
  min-width: 270px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  z-index: 10;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.alltools-sidebar__header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.alltools-sidebar__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.alltools-sidebar__title svg {
  color: var(--primary);
}

.alltools-sidebar__nav {
  padding: 8px 10px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

/* ─── CATEGORY ITEM (accordion header) ─── */
.sidebar-cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
  position: relative;
}

.sidebar-cat-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-cat-item.active {
  color: var(--sidebar-color, var(--primary));
  font-weight: 600;
}

.sidebar-cat-item--all {
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding-bottom: 11px;
}

.sidebar-cat-item--all.active {
  background: color-mix(in srgb, var(--primary), transparent 88%);
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary), transparent 75%);
  border-bottom-color: color-mix(in srgb, var(--primary), transparent 75%);
}

.sidebar-cat-item__icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-cat-item__icon svg {
  width: 16px;
  height: 16px;
}

.sidebar-cat-item__text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-cat-item__badge {
  font-size: 10px;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-subtle);
  line-height: 1.4;
}

.sidebar-cat-item.active .sidebar-cat-item__badge {
  background: color-mix(in srgb, var(--sidebar-color, var(--primary)), transparent 75%);
  color: var(--sidebar-color, var(--primary));
}

/* ─── ACCORDION ARROW ─── */
.sidebar-cat-item__arrow {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.sidebar-cat-item__arrow svg {
  width: 14px;
  height: 14px;
}

.sidebar-accordion.open > .sidebar-cat-item .sidebar-cat-item__arrow {
  transform: rotate(180deg);
}

/* ─── SUBMENU (tool links) ─── */
.sidebar-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  opacity: 0;
  padding-left: 12px;
}

.sidebar-accordion.open > .sidebar-submenu {
  max-height: 2000px;
  opacity: 1;
  padding-bottom: 4px;
}

/* ─── TOOL LINK (inside submenu) ─── */
.sidebar-tool-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
  position: relative;
}

.sidebar-tool-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-tool-link.active {
  background: color-mix(in srgb, var(--sidebar-color, var(--primary)), transparent 88%);
  color: var(--sidebar-color, var(--primary));
  font-weight: 600;
  border-right: 2px solid var(--sidebar-color, var(--primary));
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.sidebar-tool-link__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--surface-3);
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.sidebar-tool-link:hover .sidebar-tool-link__dot {
  background: var(--text-muted);
}

.sidebar-tool-link.active .sidebar-tool-link__dot {
  background: var(--sidebar-color, var(--primary));
  box-shadow: 0 0 6px color-mix(in srgb, var(--sidebar-color, var(--primary)), transparent 50%);
}

.sidebar-tool-link__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── MAIN CONTENT ─── */
.alltools-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  position: relative;
}

/* ─── TOP BAR ─── */
.alltools-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 64px;
  z-index: 9;
  flex-wrap: wrap;
}

.alltools-topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.alltools-topbar__title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.alltools-topbar__count {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--primary), transparent 85%);
  color: var(--primary);
}

.alltools-topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-label span {
  display: none !important;
}

/* ─── GLOBAL HEADER SEARCH (Compact) ─── */
.alltools-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  width: 180px;
  transition: all 0.25s ease;
  margin-right: 12px;
}

.alltools-search:focus-within {
  width: 240px;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary), transparent 85%);
}

.alltools-search svg {
  width: 14px;
  height: 14px;
  color: var(--text-subtle);
}

.alltools-search input {
  font-size: 13px;
  border: none;
  background: none;
  color: var(--text);
  outline: none;
  width: 100%;
}

.alltools-search input::placeholder {
  color: var(--text-subtle);
}

/* ─── CONTENT AREA ─── */
.alltools-content {
  flex: 1;
  overflow-y: auto;
  transition: opacity 0.2s ease;
}

/* ─── TOOL GRID ─── */
.alltools-grid {
  padding: 24px;
  display: block;
  min-height: 100%;
}

/* ─── TOOL WRAP (when tool is loaded in the panel) ─── */
.alltools-tool-wrap {
  padding: 0;
  animation: panelSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.alltools-tool-wrap .tool-page {
  padding: 32px 24px;
  margin: 0 auto;
  max-width: 1000px;
  width: 100%;
  animation: none;
}

.alltools-tool-wrap .tool-header-row {
  display: block;
  margin: 0 auto 24px;
  max-width: 1000px;
  width: 100%;
}

.alltools-tool-wrap .tool-header-actions {
  display: none !important;
}

.alltools-tool-wrap .tool-header {
  width: 100% !important;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 0;
}

.alltools-tool-wrap .tool-page-icon {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
}

.alltools-tool-wrap .tool-page-icon svg {
  width: 22px !important;
  height: 22px !important;
}

.alltools-tool-wrap .tool-header__text h1 {
  font-size: 1.25rem !important;
  margin-bottom: 4px;
}

.alltools-tool-wrap .tool-header__text p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.tool-card {
  padding: 16px 14px;
}

.tool-card__icon {
  width: 38px;
  height: 38px;
  margin-bottom: 10px;
}

.tool-card__icon svg {
  width: 18px;
  height: 18px;
}

.tool-card__name {
  font-size: 13.5px;
  margin-bottom: 6px;
}

.tool-card__desc {
  font-size: 11.5px;
  margin-bottom: 0px;
}

.tool-card__badge {
  display: none !important;
}

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


/* ─── LOADER ─── */
.alltools-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 20;
  background: color-mix(in srgb, var(--bg), transparent 30%);
  backdrop-filter: blur(4px);
}

.alltools-loader p {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.alltools-loader__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ─── CATEGORY GROUP HEADERS ─── */
.alltools-category-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0 8px;
  margin-top: 8px;
  cursor: pointer;
  user-select: none;
  scroll-margin-top: 60px;
}

.alltools-category-header:hover .alltools-category-header__title {
  opacity: 0.8;
}

.alltools-category-header__title {
  font-size: var(--text-base);
  font-weight: 700;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alltools-category-header__arrow {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.alltools-category-header.collapsed .alltools-category-header__arrow {
  transform: rotate(-90deg);
}

.alltools-category-header__line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.alltools-grid-section {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  grid-column: 1 / -1;
  padding-bottom: 24px;
}

@media (min-width: 1400px) {
  .alltools-grid-section {
    grid-template-columns: repeat(5, 1fr);
  }
}

.alltools-grid-section.hidden {
  display: none;
}

.alltools-category-header__count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── NO RESULTS ─── */
.alltools-no-results {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 12px;
}

.alltools-no-results svg {
  width: 48px;
  height: 48px;
  color: var(--text-subtle);
  margin-bottom: 8px;
}

.alltools-no-results h3 {
  font-size: var(--text-xl);
  color: var(--text);
}

.alltools-no-results p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 360px;
}

/* ─── SIDEBAR TOGGLE (mobile) ─── */
.alltools-sidebar-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.alltools-sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

.alltools-sidebar-toggle:hover {
  color: var(--text);
  background: var(--surface-3);
}

/* ─── MOBILE OVERLAY ─── */
.alltools-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9;
  backdrop-filter: blur(2px);
}

.alltools-overlay.visible {
  display: block;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
  .alltools-search {
    min-width: 200px;
  }
  .alltools-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (max-width: 768px) {
  .alltools-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transform: translateX(-100%);
    z-index: 100;
    box-shadow: none;
  }

  .alltools-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.3);
  }

  .alltools-sidebar-toggle {
    display: flex;
  }

  .alltools-topbar {
    padding: 10px 16px;
    top: 60px;
  }

  .alltools-topbar__right {
    width: 100%;
    order: 3;
  }

  .alltools-search {
    flex: 1;
    min-width: 0;
  }

  .alltools-grid {
    padding: 16px;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .alltools-tool-wrap .tool-page {
    padding: 16px;
  }
}

/* ─── CATEGORIES SECTION (Home Page — unchanged) ─── */
.categories-section {
  padding: 60px 0 80px;
  scroll-margin-top: 40px;
}

.categories-section__header {
  text-align: center;
  margin-bottom: 48px;
}

.categories-section__header .section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: var(--text-2xl);
  margin-bottom: 12px;
}

.categories-section__header .section-subtitle {
  color: var(--text-muted);
  font-size: var(--text-base);
  max-width: 600px;
  margin: 0 auto;
}

/* ─── CATEGORY CARDS (Home Page) ─── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.category-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  cursor: pointer;
}

.category-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 50%, color-mix(in srgb, var(--cat-color), transparent 92%));
  opacity: 0;
  transition: opacity 0.35s ease;
}

.category-card:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--cat-color), transparent 50%);
  box-shadow:
    0 10px 40px color-mix(in srgb, var(--cat-color), transparent 85%),
    0 0 0 1px color-mix(in srgb, var(--cat-color), transparent 70%);
}

.category-card:hover::before {
  opacity: 1;
}

.category-card__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--cat-color), transparent 85%);
  color: var(--cat-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-card:hover .category-card__icon {
  transform: scale(1.1);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--cat-color), transparent 70%);
}

.category-card__icon svg {
  width: 24px;
  height: 24px;
}

.category-card__title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  position: relative;
  z-index: 1;
}

.category-card__desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  position: relative;
  z-index: 1;
}

.category-card__count {
  display: inline-flex;
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: color-mix(in srgb, var(--cat-color), transparent 88%);
  color: var(--cat-color);
  border: 1px solid color-mix(in srgb, var(--cat-color), transparent 75%);
  position: relative;
  z-index: 1;
}

.category-card__glow {
  position: absolute;
  bottom: -30px;
  right: -30px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--cat-color);
  opacity: 0.04;
  filter: blur(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.category-card:hover .category-card__glow {
  opacity: 0.1;
  transform: scale(1.5);
}

@media (max-width: 768px) {
  .categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .category-card {
    padding: 20px 16px;
  }
  .category-card__icon {
    width: 42px;
    height: 42px;
  }
  .category-card__icon svg {
    width: 20px;
    height: 20px;
  }
  .categories-section {
    padding: 40px 0 60px;
  }
}
