@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  background: #002a4c;
}

img,
svg {
  display: inline-block;
}

body {
  color: var(--foreground);
  background: var(--background);
  font-family: Arial, Helvetica, sans-serif;
}

.workspace {
  background: white;
  display: flex;
  flex-direction: column;
  height: 100vh;

  .top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #002a4c;

    .ws-name {
      font-size: 1.5em;
      flex: 1;
      color: white;
    }

    .logo img {
      height: 2em;
      vertical-align: middle;
      margin: 4px;
    }

    .tools {
      display: flex;
      align-items: center;

      .btn {
        color: oklch(75% 0.13 230);
        font-size: 1.5em;
        padding: 0 10px;
      }
    }
  }

  .error {
    background: #ffdddd;
    padding: 8px;
    font-size: 12px;
  }

  .node-container {
    padding: 8px;
    position: relative;
  }

  .lynxkite-node {
    box-shadow: 0px 5px 50px 0px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    background: white;
    display: flex;
    flex-direction: column;

    .node-content {
      flex: 1;
      overflow: auto;
      display: flex;
      flex-direction: column;
    }
  }

  .tooltip {
    padding: 8px;
    border-radius: 4px;
    opacity: 1;
    text-align: left;
    background: #fffa;
    color: black;
    box-shadow: 0px 5px 50px 0px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    font-size: 16px;
    font-weight: initial;
    max-width: 300px;

    p {
      margin-top: 1em;
      line-height: normal;
    }

    p:first-child {
      margin-top: 0;
    }
  }

  .expanded .lynxkite-node {
    height: 100%;
  }

  .lynxkite-node .title {
    font-weight: bold;
    padding: 8px;
    background-image: linear-gradient(
      to right,
      var(--status-color-1),
      var(--status-color-2) 40%,
      var(--status-color-2) 60%,
      var(--status-color-3)
    );
    background-blend-mode: luminosity;
    background-size: 180% 180%;
    --status-color-1: #0000;
    --status-color-2: #0000;
    --status-color-3: #0000;
    transition: --status-color-1 0.3s, --status-color-2 0.3s, --status-color-3 0.3s;
    display: flex;
    flex-direction: row;
    gap: 10px;

    .title-title {
      flex: 1;
    }
  }

  .lynxkite-node .title.active {
    --status-color-1: #0000;
    --status-color-2: #fff4;
    --status-color-3: #888f;
    animation: active-node-gradient-animation 1.2s alternate ease-in-out infinite;
  }

  .lynxkite-node .title.planned {
    --status-color-1: #888f;
    --status-color-2: #888f;
    --status-color-3: #888f;
  }

  .handle-name {
    font-size: 10px;
    color: black;
    letter-spacing: 0.05em;
    text-align: right;
    white-space: nowrap;
    position: absolute;
    top: -5px;
    backdrop-filter: blur(10px);
    padding: 2px 8px;
    border-radius: 4px;
    visibility: hidden;
  }

  .react-flow__handle-left {
    left: -5px;

    .handle-name {
      right: 30px;
    }
  }

  .react-flow__handle-right {
    right: -5px;

    .handle-name {
      left: 30px;
    }
  }

  .react-flow__handle-top {
    top: -5px;

    .handle-name {
      top: -3px;
      left: 13px;
      backdrop-filter: none;
    }
  }

  .react-flow__handle-bottom {
    bottom: -5px;

    .handle-name {
      top: 0px;
      left: 13px;
      backdrop-filter: none;
    }
  }

  .node-container:hover .handle-name {
    visibility: visible;
  }

  .node-resizer {
    position: absolute;
    bottom: 8px;
    right: 8px;
    cursor: nwse-resize;
  }

  .lynxkite-node {
    .param {
      padding: 4px 8px 4px 8px;
      display: block;
    }

    .param-name-row {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: end;
    }

    .param-name {
      display: block;
      font-size: 10px;
      letter-spacing: 0.05em;
      margin-left: 10px;
      width: fit-content;
      padding: 2px 8px;
      border-radius: 4px 4px 0 0;
    }

    .collapsed-param {
      min-height: 20px;
      line-height: 10px;
    }
  }

  .node-search {
    position: fixed;
    width: 300px;
    z-index: 5;
    padding: 4px;
    border-radius: 4px;
    border: 1px solid #888;
    background-color: white;
    max-height: -webkit-fill-available;
    max-height: -moz-available;
    display: flex;
    flex-direction: column;

    input {
      width: calc(100% - 26px);
      font-size: 20px;
      padding: 8px;
      border-radius: 4px;
      border: 1px solid #eee;
      margin: 4px;
    }

    .search-result {
      padding: 4px;
      cursor: pointer;
    }

    .search-result.selected {
      background-color: oklch(75% 0.2 55);
      border-radius: 4px;
    }

    .matches {
      overflow-y: auto;
    }
  }

  .react-flow__node-table_view {
    .df-head {
      font-weight: bold;
      padding: 8px;
      background: #f0f0f0;
      cursor: pointer;
    }

    dl {
      margin: 10px;
    }
  }

  .env-select {
    background: transparent;
    color: #39bcf3;
  }

  .workspace-message {
    position: absolute;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    box-shadow: 0 5px 50px 0px #8008;
    padding: 10px 40px 10px 20px;
    border-radius: 5px;

    .close {
      position: absolute;
      right: 10px;
      cursor: pointer;
    }
  }

  .model-mapping-param {
    border: 1px solid var(--fallback-bc, oklch(var(--bc) / 0.2));
    border-collapse: separate;
    border-radius: 5px;
    padding: 5px 10px;
    width: 100%;
  }

  .table-viewer {
    td {
      padding: 5px 10px;
      vertical-align: top;
    }

    .image-in-table {
      max-height: 100px;
    }
  }
}

.params-expander {
  font-size: 15px;
  padding: 4px;
  color: #000a;
}

.flippy {
  transition: transform 0.5s;
}

.flippy.flippy-90 {
  transform: rotate(-90deg);
}

.directory {
  .entry-list {
    width: 100%;
    margin: 10px auto;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0px 2px 4px;
    padding: 0 0 10px 0;
  }

  @media (min-width: 768px) {
    .entry-list {
      width: 768px;
    }
  }

  @media (min-width: 960px) {
    .entry-list {
      width: 80%;
    }
  }

  .logo {
    margin: 0;
    padding-top: 50px;
    text-align: center;
  }

  .logo-image {
    max-width: 50%;
  }

  .tagline {
    color: #39bcf3;
    font-size: 14px;
    font-weight: 500;
  }

  @media (min-width: 1400px) {
    .tagline {
      font-size: 18px;
    }
  }

  .actions {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    height: 50px;
    padding: 5px;

    form,
    button {
      flex: 1;
    }
  }

  .actions a {
    padding: 2px 10px;
    border-radius: 5px;
  }

  .actions a:hover {
    background: #39bcf3;
    color: white;
  }

  .breadcrumbs {
    padding-left: 10px;
    font-size: 20px;
    background: #002a4c20;
  }

  .breadcrumbs a:hover {
    color: #39bcf3;
  }

  .entry-list .entry {
    display: flex;
    border-bottom: 1px solid whitesmoke;
    color: #004165;
    cursor: pointer;
    user-select: none;

    a {
      text-decoration: none;
      flex: 1;
      padding-left: 10px;
    }

    .entry-name {
      padding-left: 10px;
    }

    button {
      padding-right: 10px;
    }
  }

  .entry-list .open .entry,
  .entry-list .entry:hover,
  .entry-list .entry:focus {
    background: #39bcf3;
    color: white;
  }

  .entry-list .entry:last-child {
    border-bottom: none;
  }

  a {
    text-decoration: none;
  }

  .loading {
    color: #39bcf3;
    margin: 10px;
  }
}

@keyframes active-node-gradient-animation {
  to {
    background-position-x: 100%;
  }
}

@property --status-color-1 {
  syntax: "<color>";
  initial-value: red;
  inherits: false;
}

@property --status-color-2 {
  syntax: "<color>";
  initial-value: red;
  inherits: false;
}

@property --status-color-3 {
  syntax: "<color>";
  initial-value: red;
  inherits: false;
}

.react-flow__edge.selected path.react-flow__edge-path {
  outline: var(--xy-selection-border, var(--xy-selection-border-default));
  outline-offset: 10px;
  border-radius: 1px;
}

.react-flow__handle {
  border-color: black;
  background: white;
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.react-flow__arrowhead * {
  stroke: none;
  fill: black;
}

.react-flow__node-area {
  z-index: -10 !important;
}

.selected .lynxkite-node {
  outline: var(--xy-selection-border, var(--xy-selection-border-default));
  outline-offset: 7.5px;
}

.graph-creation-view {
  display: flex;
  width: 100%;
  margin-top: 10px;
}

.graph-tables,
.graph-relations {
  flex: 1;
  padding-left: 10px;
  padding-right: 10px;
}

.graph-table-header {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  text-align: left;
  background-color: #333;
  color: white;
  padding: 10px;
  border-bottom: 2px solid #222;
  font-size: 16px;
}

.graph-creation-view .df-head {
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  /* Adds a separator between rows */
  border-bottom: 1px solid #ccc;
}

/* Alternating background colors for table-like effect */
.graph-creation-view .df-head:nth-child(odd) {
  background-color: #f9f9f9;
}

.graph-creation-view .df-head:nth-child(even) {
  background-color: #e0e0e0;
}

.graph-relation-attributes {
  display: flex;
  flex-direction: column;
  /* Adds space between each label-input pair */
  gap: 10px;
  width: 100%;
}

.graph-relation-attributes label {
  font-size: 12px;
  font-weight: bold;
  display: block;
  margin-bottom: 2px;
  /* Lighter text for labels */
  color: #666;
}

.graph-relation-attributes input {
  width: 100%;
  padding: 8px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  outline: none;
}

.graph-relation-attributes input:focus {
  /* Highlight input on focus */
  border-color: #007bff;
}

.add-relationship-button {
  background-color: #28a745;
  color: white;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 4px;
}

.add-relationship-button:hover {
  background-color: #218838;
}

.yRemoteSelection {
  background-color: rgb(250, 129, 0, 0.5);
}

.yRemoteSelectionHead {
  position: absolute;
  border-left: #ff8800 solid 2px;
  border-top: #ff8800 solid 2px;
  border-bottom: #ff8800 solid 2px;
  height: 100%;
  box-sizing: border-box;
}

.yRemoteSelectionHead::after {
  position: absolute;
  content: " ";
  border: 3px solid #ff8800;
  border-radius: 4px;
  left: -4px;
  top: -5px;
}
