
// Enhanced Variables
$primary: #e94d18;
$primary-dark: #e94d18;
$primary-light: #42A5F5;
$success: #4CAF50;
$warning: #FF9800;
$danger: #F44336;
$info: #00BCD4;
$dark: #0a0a0a;
$light: #ffffff;
$gray-50: #fafafa;
$gray-100: #f5f5f5;
$gray-200: #eeeeee;
$gray-300: #e0e0e0;
$gray-400: #bdbdbd;
$gray-500: #9e9e9e;
$gray-600: #757575;
$gray-700: #616161;
$gray-800: #424242;
$gray-900: #212121;

// Enhanced Animations
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba($primary, 0.3); }
  50% { box-shadow: 0 0 30px rgba($primary, 0.6); }
}

@keyframes flowData {
  0% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -20; }
}

@keyframes nodeAppear {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  50% {
    transform: scale(1.05) translateY(-5px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

// Enhanced Mixins
@mixin glass-effect {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

@mixin dark-glass-effect {
  background: rgba(20, 20, 20, 0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

@mixin neumorphism {
  background: linear-gradient(145deg, #f0f0f0, #cacaca);
  box-shadow: 20px 20px 60px #bebebe, -20px -20px 60px #ffffff;
}

@mixin dark-neumorphism {
  background: linear-gradient(145deg, #1e1e1e, #2a2a2a);
  box-shadow: 20px 20px 60px #0a0a0a, -20px -20px 60px #3a3a3a;
}

:host {
  display: block;
  height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
}

.ci-explorer-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: linear-gradient(135deg, $gray-50 0%, $gray-100 100%);
  position: relative;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);


}

// Enhanced Top Toolbar
.top-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 24px;
  @include glass-effect;
  z-index: 100;
  transition: all 0.3s ease;

  &:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  }

  .toolbar-left,
  .toolbar-right {
    display: flex;
    align-items: center;
    gap: 24px;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;

    &:hover {
      transform: translateX(4px);
    }

    .brand-icon {
      font-size: 32px;
      color: $primary;
      font-weight: 500;
      animation: spin 20s linear infinite;
    }
  }

  .search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba($gray-200, 0.8);
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 0 20px;
    height: 44px;
    width: 420px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    &:focus-within {
      background: $light;
      border-color: $primary;
      box-shadow: 0 0 0 4px rgba($primary, 0.15);
      transform: translateY(-1px);

      .search-icon {
        color: $primary;
        transform: rotate(90deg);
      }
    }

    .search-icon {
      color: $gray-600;
      margin-right: 12px;
      transition: all 0.3s ease;
    }

    .search-input {
      flex: 1;
      border: none;
      background: none;
      outline: none;
      font-size: 14px;
      font-family: inherit;
      font-weight: 500;
    }

    .search-results-count {
      position: absolute;
      right: 20px;
      font-size: 12px;
      color: $gray-500;
      font-weight: 600;
    }

    .search-hint {
      position: absolute;
      top: 100%;
      left: 0;
      margin-top: 8px;
      padding: 8px 16px;
      background: $dark;
      color: $light;
      font-size: 12px;
      border-radius: 8px;
      white-space: nowrap;
      animation: slideIn 0.2s ease;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);

      &::before {
        content: '';
        position: absolute;
        top: -4px;
        left: 20px;
        width: 8px;
        height: 8px;
        background: $dark;
        transform: rotate(45deg);
      }
    }
  }

  .control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: $gray-700;
    position: relative;
    overflow: hidden;

    &::before {
      content: '';
      position: absolute;
      inset: 0;
      background: radial-gradient(circle at center, transparent, rgba($primary, 0.1));
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    &:hover {
      background: rgba($gray-200, 0.8);
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

      &::before {
        opacity: 1;
      }
    }

    &:active {
      transform: translateY(0);
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    &.active {
      background: $primary;
      color: $light;
      box-shadow: 0 4px 12px rgba($primary, 0.3);

      &:hover {
        background: darken($primary, 5%);
        transform: translateY(-2px) scale(1.05);
      }
    }

    .material-icons {
      font-size: 22px;
    }
  }

  .zoom-level {
    min-width: 60px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: $gray-700;
    padding: 6px 12px;
    background: rgba($gray-200, 0.5);
    border-radius: 8px;
  }
}

// Enhanced Minimap
.minimap {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 220px;
  height: 165px;
  @include glass-effect;
  border-radius: 16px;
  padding: 16px;
  animation: slideIn 0.3s ease;
  transition: all 0.3s ease;
  cursor: pointer;

  &:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  }

  .minimap-title {
    font-size: 12px;
    font-weight: 700;
    color: $gray-700;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .minimap-svg {
    width: 100%;
    height: calc(100% - 24px);
    border: 2px solid rgba($gray-300, 0.5);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4));
    overflow: hidden;

    .minimap-viewport {
      fill: none;
      stroke: $primary;
      stroke-width: 2;
      stroke-dasharray: 4 2;
      animation: flowData 1s linear infinite;
    }

    .minimap-node {
      cursor: pointer;
      transition: all 0.2s ease;

      &:hover {
        transform: scale(1.5);
      }
    }
  }
}

// Enhanced CI Nodes
.ci-node {
  position: absolute;
  // @include glass-effect;
  border-radius: 16px;
  cursor: move;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: nodeAppear 0.5s ease;
  overflow: visible;
  
  &::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, transparent, $primary, transparent);
    border-radius: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
  }

  &:hover {
    transform: translateY(-4px) scale(1.02);
    // box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);

    // &::before {
    //   opacity: 0.5;
    //   animation: spin 2s linear infinite;
    // }

    .node-actions {
      opacity: 1;
      transform: translateY(0);
    }

    .status-indicator {
      transform: scale(1.2);
    }
  }

  &.selected {
    // box-shadow: 0 0 0 3px $primary, 0 12px 40px rgba($primary, 0.25);
    animation: glow 2s ease-in-out infinite;
  }

  &.root-node {
    // box-shadow: 0 0 25px rgba(56, 239, 125, 0.5);
    .node-header {
      position: relative;
      overflow: visible;
      // background: linear-gradient(135deg, #11998e, #38ef7d); 
      color: #fff;
      
      
      

      &::before {
        content: '👑';
        position: absolute;
        top: -14px;
        right: -10px;
        font-size: 24px;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
        animation: pulse 2s ease-in-out infinite;
      }
    }
  }

  &.loading {
    pointer-events: none;
    opacity: 0.7;
  }

  &.highlighted {
    // box-shadow: 0 0 30px rgba($warning, 0.5);
    z-index: 10;
  }

  .node-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 16px 16px 0 0;
    color: $light;
    font-size: 13px;
    font-weight: 600;
    position: relative;
    overflow: hidden;

    &::after {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
      pointer-events: none;
    }

    .node-icon {
      font-size: 20px;
      filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
    }

    .node-type {
      flex: 1;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      text-transform: uppercase;
      font-size: 11px;
      letter-spacing: 0.5px;
    }

    .node-badges {
      display: flex;
      gap: 6px;
    }

    .badge {
      display: flex;
      align-items: center;
      gap: 3px;
      padding: 3px 8px;
      background: rgba(0, 0, 0, 0.25);
      border-radius: 12px;
      font-size: 11px;
      font-weight: 700;
      backdrop-filter: blur(10px);
      transition: all 0.2s ease;

      &:hover {
        background: rgba(0, 0, 0, 0.4);
        transform: scale(1.1);
      }

      .material-icons.tiny {
        font-size: 12px;
      }

      &.parent-badge {
        .material-icons { color: $info; }
      }

      &.child-badge {
        .material-icons { color: $warning; }
      }
    }
  }

  .node-body {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 0 0 16px 16px;
    position: relative;

    .node-title {
      margin: 0;
      font-size: 15px;
      font-weight: 700;
      color: $gray-900;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-bottom: 6px;
    }

    .node-info {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 8px;
    }

    .node-level {
      font-size: 12px;
      color: $gray-600;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 6px;

      .level-icon {
        font-size: 14px;
        color: $primary;
      }
    }

    .status-indicator {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      transition: all 0.3s ease;
      position: relative;

      &.active {
        background: $success;
        box-shadow: 0 0 8px rgba($success, 0.6);

        &::after {
          content: '';
          position: absolute;
          inset: -4px;
          border: 2px solid rgba($success, 0.3);
          border-radius: 50%;
          animation: pulse 2s ease-in-out infinite;
        }
      }

      &.inactive {
        background: $danger;
        box-shadow: 0 0 8px rgba($danger, 0.6);      }

      &.warning {
        background: $warning;
        box-shadow: 0 0 8px rgba($warning, 0.6);
      }

      &.error {
        background: $danger;
        box-shadow: 0 0 8px rgba($danger, 0.6);
      }
    }
  }

  .node-actions {
    position: absolute;
    bottom: -16px;
    right: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    .action-btn {
      width: 32px;
      height: 32px;
      border: none;
      background: $light;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
      transition: all 0.2s ease;
      position: relative;
      overflow: hidden;

      &::after {
        content: '';
        position: absolute;
        inset: 0;
        background: radial-gradient(circle at center, transparent 0%, rgba($primary, 0.1) 100%);
        opacity: 0;
        transition: opacity 0.3s ease;
      }

      &:hover {
        transform: scale(1.15) translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);

        &::after {
          opacity: 1;
        }
      }

      &:active {
        transform: scale(1.05) translateY(0);
      }

      .material-icons {
        font-size: 18px;
        color: $gray-700;
        transition: color 0.2s ease;
      }

      &.expand-btn:hover .material-icons {
        color: $primary;
      }

      &.add-btn:hover .material-icons {
        color: $success;
      }

      &.focus-btn:hover .material-icons {
        color: $info;
      }
    }
  }

  .loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);

    .spinner {
      width: 32px;
      height: 32px;
      border: 3px solid rgba($primary, 0.2);
      border-top-color: $primary;
      border-radius: 50%;
      animation: spin 0.8s cubic-bezier(0.6, 0, 0.4, 1) infinite;
    }
  }

  // .hover-card {
  //   position: absolute;
  //   top: calc(100% + 16px);
  //   left: 50%;
  //   transform: translateX(-50%);
  //   min-width: 320px;
  //   max-width: 400px;
  //   @include glass-effect;
  //   border-radius: 16px;
  //   padding: 20px;
  //   z-index: 4002;
  //   animation: slideIn 0.2s ease;
  //   pointer-events: none;

  //   &::before {
  //     content: '';
  //     position: absolute;
  //     top: -8px;
  //     left: 50%;
  //     transform: translateX(-50%);
  //     width: 16px;
  //     height: 16px;
  //     background: rgba(255, 255, 255, 0.9);
  //     border-top: 1px solid rgba(255, 255, 255, 0.3);
  //     border-left: 1px solid rgba(255, 255, 255, 0.3);
  //     transform: translateX(-50%) rotate(45deg);
  //   }

  //   .hover-card-header {
  //     display: flex;
  //     align-items: flex-start;
  //     justify-content: space-between;
  //     margin-bottom: 16px;
  //     padding-bottom: 16px;
  //     border-bottom: 2px solid rgba($gray-200, 0.5);

  //     h4 {
  //       margin: 0;
  //       font-size: 18px;
  //       font-weight: 700;
  //       color: $gray-900;
  //       display: flex;
  //       align-items: center;
  //       gap: 8px;
  //     }

  //     .node-id {
  //       font-size: 13px;
  //       color: $gray-500;
  //       font-weight: 600;
  //       padding: 4px 8px;
  //       background: rgba($gray-200, 0.5);
  //       border-radius: 6px;
  //     }
  //   }

  //   .info-grid {
  //     display: grid;
  //     grid-template-columns: repeat(2, 1fr);
  //     gap: 12px;
  //     margin-bottom: 16px;
  //   }

  //   .info-item {
  //     padding: 12px;
  //     background: rgba($gray-100, 0.5);
  //     border-radius: 12px;
  //     transition: all 0.2s ease;

  //     &:hover {
  //       background: rgba($primary, 0.05);
  //       transform: translateX(2px);
  //     }

  //     .info-label {
  //       font-size: 11px;
  //       font-weight: 600;
  //       color: $gray-600;
  //       text-transform: uppercase;
  //       letter-spacing: 0.5px;
  //       margin-bottom: 4px;
  //     }

  //     .info-value {
  //       font-size: 14px;
  //       font-weight: 600;
  //       color: $gray-800;
  //       display: flex;
  //       align-items: center;
  //       gap: 6px;

  //       .material-icons {
  //         font-size: 16px;
  //         color: $primary;
  //       }
  //     }
  //   }

  //   .fields-section {
  //     .fields-title {
  //       font-size: 13px;
  //       font-weight: 700;
  //       color: $gray-700;
  //       margin-bottom: 12px;
  //       display: flex;
  //       align-items: center;
  //       gap: 8px;

  //       .material-icons {
  //         font-size: 18px;
  //         color: $primary;
  //       }
  //     }

  //     .fields-grid {
  //       display: grid;
  //       gap: 8px;
  //       max-height: 200px;
  //       overflow-y: auto;
  //       padding: 16px;
  //       background: rgba($gray-100, 0.3);
  //       border-radius: 12px;
        
  //       &::-webkit-scrollbar {
  //         width: 6px;
  //       }

  //       &::-webkit-scrollbar-track {
  //         background: rgba($gray-200, 0.5);
  //         border-radius: 3px;
  //       }

  //       &::-webkit-scrollbar-thumb {
  //         background: rgba($primary, 0.3);
  //         border-radius: 3px;

  //         &:hover {
  //           background: rgba($primary, 0.5);
  //         }
  //       }

  //       .field-item {
  //         display: flex;
  //         align-items: flex-start;
  //         gap: 12px;
  //         font-size: 13px;
  //         padding: 8px;
  //         border-radius: 8px;
  //         transition: all 0.2s ease;

  //         &:hover {
  //           background: rgba($primary, 0.05);
  //           padding-left: 12px;
  //         }

  //         .field-name {
  //           font-weight: 600;
  //           color: $gray-700;
  //           min-width: 100px;
  //           text-transform: capitalize;
  //         }

  //         .field-value {
  //           color: $gray-800;
  //           word-break: break-word;
  //           flex: 1;
  //         }
  //       }
  //     }

  //     .more-fields {
  //       margin-top: 12px;
  //       font-size: 13px;
  //       color: $primary;
  //       font-weight: 600;
  //       display: flex;
  //       align-items: center;
  //       gap: 6px;
  //       cursor: pointer;

  //       .material-icons {
  //         font-size: 16px;
  //       }

  //       &:hover {
  //         text-decoration: underline;
  //       }
  //     }
  //   }
  // }
}

// Enhanced SVG Connections
// .connections-svg {
//   position: absolute;
//   width: 100%;
//   height: 100%;
//   pointer-events: none;
//   overflow: visible;

//   .connection-path {
//     fill: none;
//     stroke-width: 3;
//     pointer-events: stroke;
//     cursor: pointer;
//     transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
//     stroke-linecap: round;

//     &.valid {
//       filter: drop-shadow(0 2px 4px rgba($primary, 0.2));
      
//       &.data-flow {
//         stroke-dasharray: 5, 10;
//         animation: flowData 1s linear infinite;
//       }
//     }

//     &.invalid {
//       stroke-dasharray: 8, 4;
//       opacity: 0.4;
//       filter: drop-shadow(0 2px 4px rgba($danger, 0.2));
//     }

//     &:hover,
//     &.selected {
//       stroke-width: 5;
//       filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
//     }

//     &.selected {
//       animation: pulse 2s ease-in-out infinite;
//     }

//     &.highlighted {
//       stroke-width: 6;
//       filter: drop-shadow(0 0 12px currentColor);
//     }
//   }

//   .connection-label-group {
//     pointer-events: all;
//     cursor: pointer;

//     .connection-label-bg {
//       fill: rgba(255, 255, 255, 0.95);
//       stroke: rgba($gray-300, 0.5);
//       stroke-width: 1;
//       rx: 6;
//       filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
//     }

//     .connection-label {
//       fill: $gray-700;
//       font-size: 12px;
//       font-weight: 600;
//       text-anchor: middle;
//       dominant-baseline: central;
//     }

//     &:hover {
//       .connection-label-bg {
//         fill: $primary;
//         stroke: darken($primary, 10%);
//       }

//       .connection-label {
//         fill: $light;
//       }
//     }
//   }

//   .connection-markers {
//     .marker-path {
//       transition: all 0.3s ease;
//     }
//   }
// }

// Simple Improved Connections - Smaller Markers & User-Friendly Edges
.connections-svg {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;

  // Smaller, cleaner arrow markers
  defs {
    marker#arrow-valid {
      markerWidth: 8;
      markerHeight: 8;
      refX: 7;
      refY: 3;
      orient: auto;
      markerUnits: strokeWidth;
      
      path {
        fill: $primary;
        d: "M0,0 L0,6 L7,3 z";
      }
    }

    marker#arrow-invalid {
      markerWidth: 8;
      markerHeight: 8;
      refX: 7;
      refY: 3;
      orient: auto;
      markerUnits: strokeWidth;
      
      path {
        fill: $danger;
        d: "M0,0 L0,6 L7,3 z";
      }
    }

    marker#arrow-data-flow {
      markerWidth: 8;
      markerHeight: 8;
      refX: 7;
      refY: 3;
      orient: auto;
      markerUnits: strokeWidth;
      
      path {
        fill: $info;
        d: "M0,0 L0,6 L7,3 z";
      }
    }
  }

  // .connection-path {
  //   fill: none;
  //   stroke-width: 2;
  //   pointer-events: stroke;
  //   cursor: pointer;
  //   transition: all 0.2s ease;
  //   stroke-linecap: round;
  //   stroke-linejoin: round;

  //   &.valid {
  //     stroke: $primary;
  //     marker-end: url(#arrow-valid);
  //     opacity: 0.8;
      
  //     &:hover {
  //       stroke-width: 3;
  //       opacity: 1;
  //     }

  //     &.data-flow {
  //       stroke: $info;
  //       marker-end: url(#arrow-data-flow);
  //       stroke-dasharray: 5, 10;
  //       animation: flowData 1s linear infinite;
  //     }
  //   }

  //   &.invalid {
  //     stroke: $danger;
  //     marker-end: url(#arrow-invalid);
  //     stroke-dasharray: 8, 4;
  //     opacity: 0.6;
      
  //     &:hover {
  //       stroke-width: 3;
  //       opacity: 0.8;
  //     }
  //   }

  //   &:hover,
  //   &.selected {
  //     stroke-width: 3;
  //   }

  //   &.selected {
  //     opacity: 1;
  //   }

  //   &.highlighted {
  //     stroke-width: 3;
  //     opacity: 1;
  //   }
  // }


// .connection-path {
//   fill: none;
//   stroke-width: 2;
//   pointer-events: stroke;
//   cursor: pointer;
//   transition: all 0.2s ease;
//   stroke-linecap: round;
//   stroke-linejoin: round;

//   &.valid {
//     stroke: #90A4AE;
//     marker-end: url(#arrow-valid);
//     opacity: 0.8;
    
//     &:hover {
//       stroke: #90A4AE;
//       stroke-width: 1.5px;
//       opacity: 0.85;
//     }

//     &.data-flow {
//       stroke: #90A4AE;
//       marker-end: url(#arrow-data-flow);
//       stroke-dasharray: 5, 10;
//       animation: flowData 1s linear infinite;
//       opacity: 0.75;
//     }
//   }

//   &.invalid {
//     stroke: rgba(239, 68, 68, 0.4); 
//     marker-end: url(#arrow-invalid);
//     stroke-dasharray: 8, 4;
//     opacity: 0.5;
    
//     &:hover {
//       stroke-width: 3;
//       opacity: 0.7;
//       stroke: rgba(239, 68, 68, 0.6);
//     }
//   }
// }

.connection-path {
  transition: all 0.1s ease;
  fill: none;
  stroke-width: 2;
  pointer-events: stroke;
  cursor: pointer;
  transition: all 0.2s ease;
  stroke-linecap: round;
  stroke-linejoin: round;

  &.hovered {
    stroke-width: 4px !important;
    opacity: 1 !important;
    
    &.valid {
      stroke: #2196F3 !important;
    }
    
    &.invalid {
      stroke: #ef4444 !important;
    }
  }
  
  // Add invisible wider stroke for easier clicking
  &::before {
    content: '';
    stroke-width: 20px; // Much wider invisible area
    stroke: transparent;
    pointer-events: stroke;
  }

  &.valid {
    stroke: #90A4AE;
    marker-end: url(#arrow-valid);
    opacity: 0.8;
    
    &:hover {
      stroke: #2196F3; // Blue on hover
      stroke-width: 5px;
      opacity: 1;
    }

    // Selected/clicked state
    &.clicked {
      stroke: #e94d18 !important; // Orange when clicked
      stroke-width: 4px !important;
      opacity: 1 !important;
      filter: drop-shadow(0 2px 4px rgba(233, 77, 24, 0.3));
    }
  }

  &.invalid {
    stroke: rgba(239, 68, 68, 0.4); 
    marker-end: url(#arrow-invalid);
    stroke-dasharray: 8, 4;
    opacity: 0.5;
    
    &:hover {
      stroke: #ef4444;
      stroke-width: 3px;
      opacity: 0.8;
    }

    &.clicked {
      stroke: #e94d18 !important;
      stroke-width: 4px !important;
      opacity: 1 !important;
    }
  }
}

.connections-group {
  cursor: pointer;
  stroke-width: 32px;
  .connection-click-area {
    fill: none;
    stroke: transparent;
    stroke-width: 30px; // Wide invisible stroke for easier clicking
    pointer-events: stroke;
    cursor: pointer;
  }
}

defs {
  marker#arrow-valid {
    path {
      fill: #90A4AE; 
    }
  }

  marker#arrow-invalid {
    path {
      fill: rgba(239, 68, 68, 0.7); 
    }
  }

  marker#arrow-data-flow {
    path {
      fill: #90A4AE; 
    }
  }
}

  .connection-label-group {
    pointer-events: all;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;

    &.visible {
      opacity: 1;
    }

    .connection-label-bg {
      fill: rgba(255, 255, 255, 0.95);
      stroke: rgba($gray-300, 0.5);
      stroke-width: 1;
      rx: 4;
      filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    }

    .connection-label {
      fill: $gray-700;
      font-size: 11px;
      font-weight: 600;
      text-anchor: middle;
      dominant-baseline: central;
    }

    &:hover {
      .connection-label-bg {
        fill: $primary;
        stroke: darken($primary, 10%);
      }

      .connection-label {
        fill: $light;
      }
    }
  }
}

// Keep the existing animation
@keyframes flowData {
  0% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -15; }
}

// Enhanced Legend
.legend {
  position: absolute;
  top: 88px;
  right: 24px;
  width: 260px;
  @include glass-effect;
  border-radius: 16px;
  padding: 20px;
  animation: slideIn 0.3s ease;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  &:hover {
    transform: translateX(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  }

  .legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;

    .legend-title {
      font-size: 14px;
      font-weight: 700;
      color: $gray-700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      display: flex;
      align-items: center;
      gap: 8px;

      .material-icons {
        font-size: 20px;
        color: $primary;
      }
    }

    .collapse-btn {
      width: 24px;
      height: 24px;
      border: none;
      background: transparent;
      border-radius: 6px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s ease;
      color: $gray-600;

      &:hover {
        background: rgba($gray-200, 0.5);
        color: $gray-800;
      }

      .material-icons {
        font-size: 18px;
      }
    }
  }

  .legend-content {
    .legend-section {
      margin-bottom: 20px;

      &:last-child {
        margin-bottom: 0;
      }

      .section-title {
        font-size: 12px;
        font-weight: 600;
        color: $gray-600;
        margin-bottom: 12px;
        padding-bottom: 8px;
        border-bottom: 1px solid rgba($gray-300, 0.5);
      }
    }

    .legend-items {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .legend-item {
      display: flex;
      align-items: center;
      gap: 12px;
      font-size: 13px;
      color: $gray-700;
      padding: 8px;
      border-radius: 8px;
      transition: all 0.2s ease;
      cursor: pointer;

      &:hover {
        background: rgba($primary, 0.05);
        transform: translateX(4px);

        .legend-color {
          transform: scale(1.1);
        }
      }

      .legend-color {
        width: 28px;
        height: 28px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        transition: all 0.2s ease;
        position: relative;
        overflow: hidden;

        &::after {
          content: '';
          position: absolute;
          inset: 0;
          background: linear-gradient(135deg, rgba(255,255,255,0.3), transparent);
          pointer-events: none;
        }

        .material-icons.tiny {
          font-size: 16px;
          color: white;
          filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
        }
      }

      .legend-label {
        flex: 1;
        font-weight: 500;
      }

      .legend-count {
        font-size: 11px;
        color: $gray-500;
        font-weight: 600;
        padding: 2px 6px;
        background: rgba($gray-200, 0.5);
        border-radius: 4px;
      }
    }
  }
}

// Enhanced Context Menu
.modern-menu {
  position: fixed;
  min-width: 280px;
  @include glass-effect;
  border-radius: 16px;
  overflow: hidden;
  z-index: 1000;
  animation: slideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);

  .menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba($primary, 0.1), rgba($primary, 0.05));
    border-bottom: 1px solid rgba($primary, 0.2);
    font-size: 14px;
    font-weight: 700;
    color: $primary;

    .material-icons {
      font-size: 22px;
    }
  }

  .menu-section {
    padding: 8px 0;

    .menu-section-title {
      padding: 8px 20px;
      font-size: 11px;
      font-weight: 600;
      color: $gray-500;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
  }

  .menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    position: relative;
    overflow: hidden;

    &::before {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      width: 3px;
      height: 100%;
      background: $primary;
      transform: translateX(-3px);
      transition: transform 0.2s ease;
    }

    &:hover {
      background: rgba($primary, 0.05);
      padding-left: 24px;

      &::before {
        transform: translateX(0);
      }

      .material-icons {
        color: $primary;
        transform: scale(1.1);
      }
    }

    &.highlight {
      font-weight: 600;
      
      &:hover {
        background: rgba($success, 0.1);
        
        &::before {
          background: $success;
        }
        
        .material-icons {
          color: $success;
        }
      }
    }

    &.danger {
      &:hover {
        background: rgba($danger, 0.1);
        
        &::before {
          background: $danger;
        }
        
        .material-icons {
          color: $danger;
        }
      }
    }

    &.disabled {
      opacity: 0.5;
      cursor: not-allowed;

      &:hover {
        background: transparent;
        padding-left: 20px;

        &::before {
          transform: translateX(-3px);
        }
      }
    }

    .material-icons {
      font-size: 20px;
      color: $gray-600;
      transition: all 0.2s ease;
    }

    .menu-item-text {
      flex: 1;
    }

    kbd {
      margin-left: auto;
      padding: 3px 8px;
      background: rgba($gray-200, 0.5);
      border: 1px solid rgba($gray-300, 0.5);
      border-radius: 6px;
      font-size: 11px;
      font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
      color: $gray-600;
      font-weight: 600;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }
  }

  .menu-divider {
    height: 1px;
    background: rgba($gray-200, 0.5);
    margin: 8px 16px;
  }
}

// Enhanced Connection Info Panel
.connection-info-panel {
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: 360px;
  @include glass-effect;
  border-radius: 16px;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);

  .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: linear-gradient(135deg, rgba($primary, 0.05), transparent);
    border-bottom: 2px solid rgba($gray-200, 0.5);

    h3 {
      margin: 0;
      font-size: 16px;
      font-weight: 700;
      color: $gray-800;
      display: flex;
      align-items: center;
      gap: 10px;

      .material-icons {
        font-size: 24px;
        color: $primary;
      }
    }

    .panel-actions {
      display: flex;
      gap: 8px;
    }

    .action-btn {
      width: 32px;
      height: 32px;
      border: none;
      background: transparent;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s ease;
      color: $gray-600;

      &:hover {
        background: rgba($gray-200, 0.5);
        color: $gray-800;
      }

      .material-icons {
        font-size: 20px;
      }
    }
  }

  .panel-body {
    padding: 20px;

    .connection-visualization {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 24px;
      padding: 16px;
      background: rgba($gray-100, 0.5);
      border-radius: 12px;

      .node-preview {
        flex: 1;
        text-align: center;

        .node-icon {
          width: 48px;
          height: 48px;
          margin: 0 auto 8px;
          display: flex;
          align-items: center;
          justify-content: center;
          border-radius: 12px;
          box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

          .material-icons {
            font-size: 24px;
            color: white;
          }
        }

        .node-name {
          font-size: 13px;
          font-weight: 600;
          color: $gray-800;
          margin-bottom: 4px;
        }

        .node-type {
          font-size: 11px;
          color: $gray-600;
          text-transform: uppercase;
          letter-spacing: 0.5px;
        }
      }

      .connection-arrow {
        padding: 0 20px;
        color: $gray-400;

        .material-icons {
          font-size: 28px;
        }

        &.valid {
          color: $success;
        }

        &.invalid {
          color: $danger;
        }
      }
    }

    .info-section {
      margin-bottom: 20px;

      .section-title {
        font-size: 12px;
        font-weight: 700;
        color: $gray-600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        gap: 8px;

        .material-icons {
          font-size: 16px;
          color: $primary;
        }
      }

      .info-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
      }

      .info-row {
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 14px;
        padding: 10px;
        background: rgba($gray-100, 0.3);
        border-radius: 8px;
        transition: all 0.2s ease;

        &:hover {
          background: rgba($primary, 0.05);
          transform: translateX(2px);
        }

        &.full-width {
          grid-column: 1 / -1;
        }

        .info-label {
          font-weight: 600;
          color: $gray-600;
          min-width: 80px;
        }

        .info-value {
          color: $gray-800;
          font-weight: 500;
          
          &.valid {
            color: $success;
            display: flex;
            align-items: center;
            gap: 6px;

            .material-icons {
              font-size: 16px;
            }
          }
          
          &.invalid {
            color: $danger;
            display: flex;
            align-items: center;
            gap: 6px;

            .material-icons {
              font-size: 16px;
            }
          }
        }
      }
    }

    .metadata-section {
      .metadata-grid {
        display: grid;
        gap: 10px;
        max-height: 200px;
        overflow-y: auto;
        padding: 12px;
        background: rgba($gray-100, 0.3);
        border-radius: 12px;

        &::-webkit-scrollbar {
          width: 6px;
        }

        &::-webkit-scrollbar-track {
          background: rgba($gray-200, 0.5);
          border-radius: 3px;
        }

        &::-webkit-scrollbar-thumb {
          background: rgba($primary, 0.3);
          border-radius: 3px;

          &:hover {
            background: rgba($primary, 0.5);
          }
        }

        .metadata-item {
          display: flex;
          align-items: flex-start;
          gap: 12px;
          font-size: 13px;
          padding: 8px;
          border-radius: 8px;
          transition: all 0.2s ease;

          &:hover {
            background: rgba($primary, 0.05);
            padding-left: 12px;
          }

          .meta-key {
            font-weight: 600;
            color: $gray-700;
            min-width: 120px;
            text-transform: capitalize;
          }

          .meta-value {
            color: $gray-800;
            word-break: break-word;
            flex: 1;
          }
        }
      }
    }
  }
}


// Enhanced Scrollbars
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba($gray-200, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba($primary, 0.3);
  border-radius: 4px;
  transition: background 0.2s ease;

  &:hover {
    background: rgba($primary, 0.5);
  }
}

// Graph viewport
.graph-viewport {
  background: #f0f2f5; /* Soft light blue-gray */

  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: grab;
  background-image: 
    radial-gradient(circle at 20% 80%, rgba($primary, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba($info, 0.03) 0%, transparent 50%);

  &:active {
    cursor: grabbing;
  }

  &.panning {
    cursor: grabbing;
  }
}

.graph-canvas {
  position: absolute;
  transform-origin: 0 0;
  transition: transform 0.1s linear;
  width: 5000px;
  height: 3000px;
  
  &.smooth-transition {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
}

// Performance hints
.performance-hints {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  @include glass-effect;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 12px;
  color: $gray-600;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease;
  pointer-events: none;

  .material-icons {
    font-size: 18px;
    color: $warning;
  }

  &.hidden {
    display: none;
  }
}

// Focus mode overlay
.focus-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at var(--focus-x, 50%) var(--focus-y, 50%),
    transparent 0%,
    transparent 30%,
    rgba(0, 0, 0, 0.4) 100%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;

  &.active {
    opacity: 1;
  }
}

// Utility classes
.material-icons.tiny {
  font-size: 14px;
}

.no-select {
  user-select: none;
  -webkit-user-select: none;
}

// Responsive Design
@media (max-width: 1400px) {
  .connection-info-panel {
    width: 320px;
  }

  .legend {
    width: 220px;
  }
}

@media (max-width: 1200px) {
  .top-toolbar {
    .search-box {
      width: 320px;
    }
  }

  .legend {
    width: 200px;
    
    .legend-item {
      font-size: 12px;
    }
  }
}

@media (max-width: 768px) {
  .top-toolbar {
    padding: 0 16px;
    
    .brand-text {
      display: none;
    }
    
    .search-box {
      width: 200px;
    }
    
    .zoom-level {
      display: none;
    }
  }

  .legend,
  .minimap,
  .breadcrumb-nav {
    display: none;
  }

  .ci-node {
    .hover-card {
      display: none;
    }
  }

  .connection-info-panel {
    width: calc(100% - 48px);
    max-width: 360px;
  }
}



// Print Styles
@media print {
  .top-toolbar,
  .minimap,
  .legend,
  .modern-menu,
  .connection-info-panel,
  .breadcrumb-nav,
  .performance-hints,
  .node-actions {
    display: none !important;
  }

  .ci-explorer-container {
    background: white;
  }

  .ci-node {
    box-shadow: none;
    border: 1px solid $gray-400;
  }
}


.selected-types {
  margin-top: 8px;
  font-size: 14px;
  color: #555;
  display: flex;
  flex-direction: column;

  .selected-label {
    font-weight: bold;
    margin-bottom: 4px;
  }

  .selected-type-tag {
    display: inline-flex;
    align-items: center;
    background: #eee;
    color: #333;
    padding: 4px 8px;
    border-radius: 12px;
    margin: 2px;
    font-size: 13px;
    gap: 4px;

    .material-icons.tiny {
      font-size: 16px;
    }

    .remove-btn {
      cursor: pointer;
      font-size: 16px;
      color: #888;
      margin-left: 4px;

      &:hover {
        color: #e53935;
      }
    }
  }
}


/* Fix Toolbar Layout */
.top-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  z-index: 100;
  transition: all 0.3s ease;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.view-controls,
.toggle-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: #757575;
  position: relative;
  overflow: hidden;
}

.control-btn:hover {
  background: rgba(158, 158, 158, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.control-btn.active {
  background: #2196F3;
  color: white;
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.control-btn .material-icons {
  font-size: 22px;
}

.zoom-level {
  min-width: 60px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #757575;
  padding: 6px 12px;
  background: rgba(158, 158, 158, 0.1);
  border-radius: 8px;
}

/* Enhanced Filter Bar Styles */
.filter-bar-container {
  position: absolute;
  top: 68px; // Below your toolbar
  left: 0;
  right: 0;
  z-index: 100;
  background: white;
  border-bottom: 1px solid #e9ecef;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  transform: translateY(-100%); // Hidden by default
  transition: transform 0.3s ease;
  opacity: 0;
  visibility: hidden;
  
  // Only show when visible class is applied
  &.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
}

.enhanced-filter-bar {
  display: flex;
  flex-direction: column;
  background: white;
}

// Filter mode toggle - clean style with orange accent
.filter-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  
  .toggle-group {
    display: flex;
    background: #e9ecef;
    border-radius: 6px;
    padding: 3px;
    gap: 2px;
  }
  
  .toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #6c757d;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    
    .material-icons {
      font-size: 14px;
    }
    
    &:hover {
      background: #dee2e6;
      color: #495057;
    }
    
    &.active {
      background: #e94d18; // Orange background
      color: white;
      box-shadow: 0 2px 4px rgba(253, 126, 20, 0.3);
    }
  }
}

// Filter content area 
.enhanced-filter-content {
  padding: 24px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

// Filter section layout 
.filter-section {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  
  &.flex-grow {
    flex: 1;
  }
}

// Labels matching modal input labels
.filter-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #495057;
  margin-bottom: 4px;
  
  .material-icons {
    font-size: 14px;
    color: #e74c3c;
    margin-right: 4px;
    vertical-align: middle;
  }
}

.filter-select {
}

// Action buttons layout
.filter-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

// Profile selector layout 
.profile-selector {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: end;
}

.profile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

// Responsive design
@media (max-width: 1200px) {
  .filter-section {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .profile-selector {
    grid-template-columns: 1fr;
    gap: 16px;
    
    .profile-actions {
      justify-content: flex-start;
    }
  }
}

@media (max-width: 768px) {
  .filter-mode-toggle {
    padding: 12px 16px;
    
    .toggle-group {
      flex-direction: column;
      width: 100%;
      max-width: 300px;
    }
    
    .toggle-btn {
      justify-content: center;
    }
  }
  
  .enhanced-filter-content {
    padding: 16px;
  }
  
  .filter-section,
  .profile-selector {
    padding: 16px;
  }
  
  .filter-actions,
  .profile-actions {
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .enhanced-filter-content {
    padding: 12px;
  }
  
  .filter-mode-toggle {
    padding: 10px 12px;
  }
  
  .filter-section,
  .profile-selector {
    padding: 12px;
  }
}


// Manual filter selector to match profile selector exactly
.manual-filter-selector {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: end;
}

.filter-inputs-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 1200px) {
  .manual-filter-selector {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .filter-inputs-section {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .filter-actions {
    justify-content: flex-start;
  }
}


.clickable-connection {
  cursor: pointer !important;
  transition: stroke-width 0.2s ease, opacity 0.2s ease;
  
  &:hover {
    stroke-width: 4px !important;
    opacity: 0.8;
  }
}

// Modal Responsive Styles
.connection-details-modal {
  .modal-dialog {
    max-width: 90vw;
    
    @media (max-width: 768px) {
      max-width: 95vw;
      margin: 1rem;
    }
  }
}

.connection-hit   { stroke: #F44336 !important; fill: none; }
.arrow-hitbox     { cursor: pointer !important; }