/* === KEYFRAME ANIMATIONS === */
@keyframes node-glow {
  0%, 100% { box-shadow: 0 0 6px rgba(0, 255, 0, 0.4); }
  50% { box-shadow: 0 0 12px rgba(0, 255, 0, 0.7); }
}

@keyframes node-hint {
  0%, 90%, 100% { border-color: #555; background: #333; }
  95% { border-color: #888; background: #444; }
}

@keyframes energy-flow-vertical {
  0% { transform: translateY(-100%); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: translateY(300%); opacity: 0; }
}

@keyframes energy-flow-dot {
  0% { transform: translateX(-50%) translateY(0); opacity: 0; }
  10%, 90% { opacity: 1; }
  100% { transform: translateX(-50%) translateY(20px); opacity: 0; }
}

@keyframes line-glow {
  0%, 100% { box-shadow: 0 0 4px rgba(0, 255, 0, 0.6); }
  50% { box-shadow: 0 0 8px rgba(0, 255, 0, 0.9); }
}

@keyframes line-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes hint-fade {
  0%, 70%, 100% { opacity: 0.6; }
  85% { opacity: 1; color: #aaa; }
}

/* === BASE COMPONENT STYLES === */
.specialization-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
  /* Specialization Description */
  .specialization-description {
    padding: 16px;
    background: rgba(30, 30, 30, 0.4);
    border-top: 1px solid #555;
    margin: 0;

    .spec-type {
      color: #fff;
      font: italic bold 14px/1 sans-serif;
      margin: 0 0 12px 0;
      text-align: center;
    }

    .spec-benefits {
      list-style: none;
      padding: 0;
      margin: 0;

      li {
        color: #ccc;
        margin: 8px 0;
        padding-left: 16px;
        position: relative;
        font-size: 13px;
        line-height: 1.4;

        &::before {
          content: "▶";
          position: absolute;
          left: 0;
          color: #888;
          font-size: 11px;
        }

        strong { color: #fff; }

        &.spec-best-for {
          margin-top: 12px;
          color: #aaa;
          font-style: italic;

          &::before {
            content: "★";
            color: #f90;
          }
        }
      }
    }
  }

  /* Active Specialization */
  .specialization-active {
    text-align: center;
    padding: 20px;
    display: flex;
  }

  /* === UPGRADE SYSTEM === */
  
  /* Base upgrade node styles */
  .upgrade-node {
    width: 160px;
    height: 40px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    position: relative;
    text-align: center;
    margin: 8px 0;
    z-index: 2;
    transition: transform 0.2s, box-shadow 0.2s;

    /* State variations */
    &.unlocked {
      width: 180px;
      height: 45px;
      border-radius: 22px;
      background: linear-gradient(45deg, #0f0, #090);
      color: black;
      box-shadow: 0 0 6px rgba(0, 255, 0, 0.4);
      animation: node-glow 3s ease-in-out infinite;
    }

    &.locked {
      background: #333;
      color: #666;
      border: 2px dashed #555;
      animation: node-hint 4s ease-in-out infinite;
      font-size: 14px;
    }

    &.purchasable {
      background: linear-gradient(45deg, #f90, #f60);
      color: white;
      border: 2px solid #ff6;
      box-shadow: 0 0 8px rgba(255, 153, 0, 0.6);
      cursor: pointer;

      &:hover {
        transform: scale(1.05);
        box-shadow: 0 0 12px rgba(255, 153, 0, 0.8);
      }
    }
    &.purchasable.insufficient {
      background: grey;
      cursor: not-allowed;
      border: 2px solid grey;

      &:hover {
        transform: none;
        box-shadow: none
      }
    }

    &.unlockable {
      background: linear-gradient(45deg, #666, #444);
      color: white;
      border: 2px solid #888;
      box-shadow: 0 0 8px rgba(102, 102, 102, 0.6);
      cursor: pointer;

      &:hover {
        transform: scale(1.05);
        box-shadow: 0 0 12px rgba(102, 102, 102, 0.8);
      }
    }
    
    &.unlockable.insufficient {
      background: #444;
      cursor: not-allowed;
      border: 2px solid #666;
      box-shadow: none;

      &:hover {
        transform: none;
        box-shadow: none;
      }
    }
  }

  /* Upgrade Tree Layout */
  .upgrade-tree {
    margin: 16px 0;
    width: 200px;

    h4 {
      margin: 8px 0;
      color: #ccc;
      font-size: 14px;
      text-align: center;
    }
  }

  .upgrade-node-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;

    /* Connection lines between nodes */
    .upgrade-node:not(:last-child)::after {
      content: '';
      position: absolute;
      top: calc(100%);
      left: 50%;
      width: 3px;
      height: 16px;
      background: linear-gradient(to bottom, #555, #333);
      transform: translateX(-50%);
      z-index: 1;
      border-radius: 2px;
      animation: line-pulse 2s ease-in-out infinite;
    }

    .upgrade-node.unlocked:not(:last-child) {
      &::after {
        background: linear-gradient(to bottom, #0a0, #070);
        box-shadow: 0 0 4px rgba(0, 255, 0, 0.6);
        animation: line-glow 2s ease-in-out infinite;
      }

      /* Animated energy dot */
      &::before {
        content: '';
        position: absolute;
        top: calc(100% + 4px);
        left: 50%;
        width: 6px;
        height: 6px;
        background: #0f0;
        border-radius: 50%;
        box-shadow: 0 0 8px rgba(0, 255, 0, 0.8);
        transform: translateX(-50%);
        z-index: 3;
        animation: energy-flow-dot 2s linear infinite;
      }
    }
  }

  /* Legacy upgrade components */
  .upgrade-preview { margin-top: 12px; }
  
  .upgrade-node-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
  }

  .upgrade-connector-vertical {
    width: 2px;
    height: 20px;
    background: linear-gradient(180deg, #090 0%, #333 50%, #333 100%);
    margin: 4px 0;
    position: relative;

    /* Energy flow effect */
    .upgrade-node.unlocked + &::after {
      content: '';
      position: absolute;
      top: 0;
      left: -1px;
      width: 4px;
      height: 30%;
      background: #0f0;
      box-shadow: 0 0 4px rgba(0, 255, 0, 0.6);
      animation: energy-flow-vertical 2s linear infinite;
    }
  }

  .upgrade-hint {
    font-size: 12px;
    color: #888;
    font-style: italic;
    margin-top: 8px;
    animation: hint-fade 3s ease-in-out infinite;
  }

  /* === UPGRADE BUTTON COMPONENT === */
  .upgrade-button {
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    text-decoration: none;
    position: absolute;
    top: 0;
    left: 0;

    &:focus { outline: none; box-shadow: none; }
    &:hover { color: inherit; text-decoration: none; }
    
    &.disabled {
      cursor: not-allowed;
      opacity: 0.6;
      
      &:hover {
        opacity: 0.6;
      }
    }
  }

  .upgrade-button-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
  }

  .upgrade-bonus {
    font-weight: bold;
    font-size: 14px;
    line-height: 1;
    margin-bottom: 2px;
  }

  .upgrade-cost {
    font-size: 10px;
    opacity: 0.9;
    font-weight: normal;
    line-height: 1;
    
    &.insufficient {
      color: #ff6b6b;
      opacity: 0.8;
    }
  }

  .upgrade-level { font-weight: bold; }

  /* === PRODUCT CARDS === */
  .product-card {
    max-width: 400px;
    min-height: 500px;
    height: auto;

    &.product-owned {
      border-color: lime;
      background: rgba(0, 255, 0, 0.05);
      opacity: 1;
      min-width: 400px;
      display: flex;
      align-items: center;

      &:hover {
        border-color: #0f0;
        background: rgba(0, 255, 0, 0.1);
      }

      .product-header { border-bottom-color: lime; }
      .product-title { color: ivory; }
      .product-description p,
      .product-description li,
      .product-description li:before { color: lime; }
    }
  }

  .product-grid {
    align-items: stretch;
  }
}


/* Locked specialization styles */
.specialization-locked {
  opacity: 0.4;
  pointer-events: none;
}

.locked-notice {
  border: 1px solid #e74c3c;
  padding: 20px;
  margin-bottom: 20px;
  border-radius: 4px;
  text-align: center;
}
